您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 销售管理 > Houdini的表达式翻译
EXPRESSIONSYNTAX(表达式语法)Herearesomeofthemainsyntaxelementswhichyouwillencounteragainandagainwhenusingexpressionfunctions:(以下是主要的语法元素,你会一次又一次地遇到一些使用表达式函数:)()BracketsBracketsareusedinordertolistalloftheargumentsthatwillbecontainedwithinafunction.Wheneverafunctionisused,theremustbeanopenbracketandaclosedbracket.Oneoftheeasiestmistakestomakewhencreatingexpressionsistoaccidentallyhavetheincorrectnumberofbrackets.()括号括号的使用是为了列举出所有的将要包含在函数中的参数。每当使用一个函数,必须有一个开放的括号和一个封闭的括号。最简单的错误之一就是当你创建表达式时,意外的有多个数目不正确的括号。“”QuotationWhenastringmustbeusedasanargumentinsideafunction,itmustbecontainedwithinquotationmarks.Thiscanincludeparameternames,andfilepaths.“”引号当一个字符串必须被用作在一个函数的参数,它必须包含在引号内。这可以包括参数名,和文件路径。``BackTicksWhenanHScriptexpressionhasbeenenteredintoastringtypeparameter,itmustbeenclosedinbackticksinordertobeevaluatedasanexpression.Forexample,ifyouareattemptingtouseanexpressionfunctioninsideafilepath,youwillneedtoincludethebackticksoneitherendofyourfunction.``返回标记当HScript表达式中已经输入了一个字符串类型的参数,它必须包含在返回标记内,以便作为一个表达式的计算。例如,如果您正试图使用在一个文件路径表达式功能,您需要在您的函数结束包含一个返回标记。‘’ApostropheTextinsideapostrophesarenotexpanded.Itmaybenecessaryattimestousethesecharactersinsidestringstopreventavariablefrombeingrecognizedasavariable.‘’单引号文本中的单引号不是大写的。可能有必要在有的时候字符串内使用这些字符,以防止一个变量被承认为一个变量。TYPESOFDATA(数据类型)TherearefourmaintypesofdatathatexistwithinHoudini(在Houdini中存在有四个主要的数据类型):Float:Floatingpointnumbersaresinglenumericalvalueswhichmaycontaindecimalsi.e.:15.5.Itispossibletobreakthisdownfurtherintointegers,whichdonotcontaindecimals.AnAlphaattribute/channelwouldbeagoodexampleofafloatvalue.浮点浮点数单一数值可能包含小数,即:15.5。很可能打破这种进一步下降为整数,不包含小数。一个Alpha属性/通道是一个很好的float值的例子。Vectors:Threefloatingpointvalues.Thesevaluescanbeusedtorepresentpositions,directions,normalsorcolors(RGBorHSV).矢量(向量):三浮点值。这些值可以用来代表的位置,方向,法线或颜色(RGB或HSV)。Strings:Stringsaredatawhicharenotnumbers,buttext.Anumberisnotrepresentedasnumericalinastringbutasatextsymbol.Youcanenclosestringsindoublequotes(“)orapostrophes(‘).Variablesinsidedouble-quotesareexpanded.Stringsinsideapostrophesarenotexpanded.Itispossibletocreatecustomvariableswhichmakeuseofstrings.字符串:字符串的数据不是数字,而是文字。一个数字并不表示为一个字符串中的数值,而是一个文本符号。你可以在双引号(“)或单引号(')中放入字符串。内双引号内的变量会被展开。单引号内的字符串是不会展开的。它可以利用字符串创建自定义的变量。Matrix:Sixteenfloatingpointvaluesrepresentinga3Dtransformationmatrix.矩阵:16个浮点值描述了一个三维变化矩阵。SIMPLEMATH+-Add,subtract(加,减)*/%Multiply,Divide(乘,除)%Moduloreturnstheremainderafterdivisionhasoccuredi.e.4%3=1,4%20=4百分号返回除法发生之后的剩余,即i.e.4%3=1,4%20=4^Raisetoexponenti.e.3^3=9(提高指数,例如3^3=9)eExponentialnotationisaconcisewayofrepresentinglargenumberswithaminimalamountofdigits,forexample3.2e-5(equivalentto0.000032).指数符号是一个代表了最少量的数字的简洁方式,例如3.2e-5(相当于0.000032)。()Grouping(群集)COMPARISONSLessthan,greaterthan(小于,大于)==inquireastowhetheritisequal(询问它是否等于)!=notequalto(不等于)||or(或)&&and(和)GLOBALVARIABLES(全局变量)Datathatisaccessibleinallcontexts.Therearedifferenttypesofglobalvariables,whichhavevariouspurposes.在任何情况下可访问的数据。不同的全局变量用于不同的目的。EnvironmentVariables:UsefulforsettingupyourHoudinienvironment.(环境变量:用于设定你的Houdini环境。)$HIPThisdefaultstothedirectorycontainingthecurrentHoudinifile.(这个默认值的目录包含了当前的Houdini文件。)$HIPNAMEThenameofthecurrent.hipfile(当前.hip文件的名称)$WEDGEThecurrentwedgeinformation(当前的wedge信息)$OSOperatorString-containsthecurrentOP’sname(运算符字符串-包含运算符字符串的名称)$JOBAcustomvariablethatdetermineswhereyourjobsarelocated(自定义变量取决于您工作的位置)$HOMEYourHomeenvironmentvariable-specifyinOSenvironmentvariables(你的home环境变量-指定运算符字符串的环境变量)$ACTIVETAKEContainsthenameofthecurrenttake(包含当前的名称)$CHCurrentchannelname(当前通道的名称)$TEMPWheretemporary(crash)filesaresaved-specifyinOSenvironmentvariables(临时(崩溃)文件保存的位置-指定运算符字符串环境变量)PLAYBARVARIABLES:TherearevariousvariablesthatareassociatedwithtimeinHoudini:(播放条变量:一些与Houdini时间有关的各种变量:)$FThecurrentframe.(当前帧)Thisisveryuseful,especiallyforfilenamenumbering.(这对于文件名的编号方式尤其有用。)Itallowsustointroducetheelementoftimeintoourexpressions.(它允许我们的表达式可以引入到时间的元素中去。)Inthecaseoffilenamingwecanaddpaddingto$F(因此我们能够在文件的名称中添加到$F)$F3givesusapaddingof3meaningthatFrame1=001(给我们提供了3个填充帧1=001)Wecanalsouse$Fonatranslationparametertellittomoveovertime(我们还可以使用$F把翻译参数告诉它移到那个时间)Wecanoffset$Fwithsimplemath.$F-1tellsframe1toreturnavalueof0(我们可以使用简单的数字补充$F.$F-1表示帧1的返回值为0)Certainelements,workinunitsof“Time”whichreferstosecondsratherthanframes:(在某些情况下,工作时所指的“时间”是秒而不是帧)$FPSPlaybackspeedinframes/second(setinGlobalAnimationOptions)(播放速度帧/秒(设定全局动画选项))$TCurrenttimeinseconds(当前时间秒)Wecanuse($F-1)/$FPStodeterminethecurrentframe’stimeinseconds.Thiscanbeusefultoknowwhenweseeparameterslikestarttimeonaparticlenetworkandwanttobeabletodeterminethestartframe.BytellingtheStartTimetobe40/$FPS,theparticlesimulationwillbeginonframe40.(我们可以使用($F-1)/$FPS取决于当前帧的时间是秒。当我们看到类似于在一个粒子网络结构上的起始时间,并希望可以确定起始帧,知道这些对我们是有用的。设定开始时间为40/$FPS,粒子将以40FPS进行模拟。)Particleanddynamicnetworksusetimeratherthanframesbecauseweoftenneedsubframedata:(粒子和动力学网络的使用时间不是帧,因为我们经常需要子帧数据:)$FFFloatingpointframenumber(浮点帧数)$SFSimulatedframenumber(模拟帧数)Thesebecomeimportantvariablestorememberwhenweadjusttheoversampling.i.e.:ifcollisiongeometryisn’tsampl
本文标题:Houdini的表达式翻译
链接地址:https://www.777doc.com/doc-5592794 .html