tyFlow Script操作符API中文翻译文档

tyFlow中的Script操作符使用 C# 提供对粒子的高级控制。但官方网页文档并不提供详细API细节,这是一份自用的翻译文档,方便大家查阅(版本1.120)

 

/*
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
//////////                                   //////////
//////////   脚本操作符文档                   //////////                 
//////////                                   //////////
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////

///////////// 内置键盘快捷键 /////////////                 
//
// [CTRL+E]                 = 评估脚本
//
/////////////////////////////////////////

//////////////// 模拟属性 ////////////////                  
//
// [tyFlow] tf                  = 当前tyFlow
// [INode]  node                = 当前tyFlow的场景节点
//
// [tfObj]  obj[XXX]            = 在操作员可脚本化对象列表框中单独访问对象(例如:'obj001')
// [List]   objects             = 操作员列表框中所有对象的List<tfObj>(例如:'objects[0]')
//
// [tfTex]  tex[XXX]            = 在操作员可脚本化纹理映射列表框中单独访问纹理映射(例如:'tex001')
// [List]   texmaps             = 操作员列表框中所有纹理映射的List<tfTex>(例如:'texmaps[0]')
//
// [float]  f                   = 当前帧
// [float]  frameStep           = 当前时间步(帧)
// [int]    t                   = 当前刻度
// [int]    tickStep            = 当前时间步(刻度)
// [int]    ticksPerFrame       = 每帧刻度数
//
// [int]    eventParticleCount      = 脚本执行前该事件中的粒子数量
// [int]    totalParticleCount      = 脚本执行前该模拟中的粒子总数,不包括已删除的粒子
// [int]    rawTotalParticleCount   = 脚本执行前该模拟中的粒子总数,包括已删除的粒子
// [int]    eventTerrainCount       = 脚本执行前该事件中的地形数量
//
// [List<int>] GetEventParticles(string eventName) = 获取具有给定名称(名称不区分大小写)的事件的粒子的模拟索引列表
//
///////////////////////////////////////////////////////

//////////////////// 杂项功能 ///////////////////
//
// [float]   GetFloat(string name)                          = 根据名称(在帧0时)获取'Floats'卷展开中的浮点值
// [float]   GetFloat(string name, float frame)             = 根据名称(在指定帧)获取'Floats'卷展开中的浮点值
//
// [float]   Lerp(float f1, float f2, float interp)         = 在两个数值之间线性插值
// [Point3]  Lerp(Point3 f1, Point3 f2, float interp)       = 在两个向量之间线性插值
// [Matrix3] Lerp(Matrix3 tm1, Matrix3 tm2, float interp)   = 在两个矩阵之间线性插值
// [Quat]    Lerp(Quat tm1, Quat tm2, float interp)         = 在两个四元数之间线性插值
//
// [Matrix3] Inverse(Matrix3 m)                             = 获取逆矩阵
// [Matrix3] Matrix3.MatrixFromVector(Point3 v)             = 从向量生成正交矩阵,其中向量将是上轴
//
// [float]   Remap(float f1, float inMin, float inMax, float outMin, float outMax) = 在'in'范围内重新映射浮点值到'out'范围
//
// [void]    Print(object value)                            = 将值打印到maxscript监听器(每步最多100次打印)
// [void]    PrintAll(object value)                         = 将值打印到maxscript监听器(无限次打印/步 - 可能导致长时间超时!)
//
// [void]    DrawMarker(Point3 pos, int r, int g, int b)                = 在视口中的位置绘制彩色(rgb)标记(必须在[simulationStep]中调用)
// [void]    DrawLine(Point3 pos1, Point3 pos2, int r, int g, int b)    = 在视口中的位置绘制彩色(rgb)线(必须在[simulationStep]中调用)
// [void]    DrawTM(Matrix3 tm, float size)                             = 在视口中绘制三色Matrix3轴(必须在[simulationStep]中调用)
//
///////////////////////////////////////////////////////

////////////// [tyFlow] 类属性 ////////////// 
//
// [void]    SetThreaded(bool val)          = 设置脚本是否多线程(SimulationStepThreaded将由多个线程评估)
// [void]    SetThreadedIterations(int n)   = 设置SimulationStepThreaded将从头到尾重新评估的次数
// [int]     GetThreadedIteration()         = 获取正在处理的当前迭代(从SimulationStepThreaded内部调用)
//
// [int]     GetSimIndex(int eInx)      = 获取当前事件中粒子的模拟索引
// [int]     GetSimIndexFromID(int ID)  = 根据其ID获取粒子的模拟索引 [-1 == 已删除]
//
// [int]     CopyParticle(int sInx)     = 复制模拟索引的粒子并获取新粒子的事件索引 [警告:非线程安全!]
// [int]     NewParticle()              = 生成新粒子并获取其事件索引 [警告:非线程安全!]
// [int]     NewParticles()             = 生成指定数量的新粒子并获取第一个粒子的事件索引(比多次调用NewParticle更快)[警告:非线程安全!]
// [void]    DeleteParticle(int sInx)   = 通过模拟索引删除粒子
//
// [void]    TestTrue(int eInx)         = 设置事件粒子的测试条件为真
// [void]    OutputParticle(int eInx)   = 等同于TestTrue(eInx)
//
// [int]     GetID(int sInx)            = 从模拟索引获取粒子ID
// [int]     GetParentID(int sInx)      = 从模拟索引获取父粒子ID
//
// [float]   GetAge(int sInx)           = 从模拟索引获取粒子年龄(以帧为单位)
// [int]     GetAgeTicks(int sInx)      = 从模拟索引获取粒子年龄(以刻度为单位)
// [float]   GetEventAge(int sInx)      = 从模拟索引获取粒子事件年龄(以帧为单位)
// [int]     GetEventAgeTicks(int sInx) = 从模拟索引获取粒子事件年龄(以刻度为单位)
//
// [Point3]  GetPos(int sInx)               = 从模拟索引获取粒子位置
// [Quat]    GetRot(int sInx)               = 从模拟索引获取粒子旋转(四元数)值
// [Point3]  GetScale(int sInx)             = 从模拟索引获取粒子缩放
// [Matrix3] GetTM(int sInx)                = 从模拟索引获取粒子变换
// [Point3]  GetSpin(int sInx)              = 从模拟索引获取粒子自旋
// [Point3]  GetVel(int sInx)               = 从模拟索引获取粒子速度
// [int]     GetSimulationGroups(int sInx)  = 获取粒子模拟组标志(1 << [0-15])
// [int]     GetExportGroups(int sInx)      = 获取粒子导出组标志(1 << [0-15])
// [int]     GetMatID(int sInx)             = 从模拟索引获取粒子材料ID [范围1-99] [0 == 未分配]
// [Point3]  GetUVW(int sInx, int channel)  = 从模拟索引和映射通道索引获取粒子映射UVW [范围0-99]
// [float]   GetMass(int sInx)              = 获取粒子绑定质量
// [float]   GetRadius(int sInx)            = 从模拟索引获取粒子半径
// [float]   GetVolume(int sInx)            = 从模拟索引获取粒子体积
//
// [tfMesh]  GetMesh(int sInx)                  = 获取粒子形状网格的tfMesh包装器
// [void]    SetMesh(int sInx, tfMesh mesh)     = 从模拟索引和tfMesh设置粒子网格
// [int]     GetMeshID(int sInx)                = 获取粒子形状网格的ID
// [void]    SetMeshID(int sInx, int meshID)    = 设置粒子形状网格ID
//
// [void]    SetPos(int sInx, Point3 pos)               = 从模拟索引设置粒子位置
// [void]    SetRot(int sInx, Quat rot)                 = 从模拟索引设置粒子旋转(四元数)值
// [void]    SetScale(int sInx, Point3 scale)           = 从模拟索引设置粒子缩放
// [void]    SetTM(int sInx, Matrix3 tm)                = 从模拟索引设置粒子变换
// [void]    SetSpin(int sInx, Point3 spin)             = 从模拟索引设置粒子自旋
// [void]    SetVel(int sInx, Point3 vel)               = 从模拟索引设置粒子速度
// [void]    SetSimulationGroups(int sInx, int flags)   = 设置粒子模拟组标志(1 << [0-15])
// [void]    SetExportGroups(int sInx, int flags)       = 设置粒子导出组标志(1 << [0-15])
// [void]    SetMatID(int sInx, int matID)              = 从模拟索引设置粒子材料ID [范围1-99] [0 == 取消分配]
// [void]    SetUVW(int sInx, int channel, Point3 uvw)  = 从模拟索引和映射通道设置粒子映射UVW [范围0-99]
// [void]    SetMass(int sInx, float mass)              = 从模拟索引设置粒子绑定质量
//
// [float]   GetCustomFloat(int sInx, string channel)   = 从模拟索引获取粒子自定义浮点数
// [Point3]  GetCustomVector(int sInx, string channel)  = 从模拟索引获取粒子自定义向量
// [Matrix3] GetCustomTM(int sInx, string channel)      = 从模拟索引获取粒子自定义变换
//
// [void]    SetCustomFloat(int sInx, string channel, float val)        = 从模拟索引设置粒子自定义浮点数
// [void]    SetCustomVector(int sInx, string channel, Point3 val)      = 从模拟索引设置粒子自定义向量
// [void]    SetCustomTM(int sInx, string channel, Matrix3 val)     = 从模拟索引设置粒子自定义变换
//
// [float]   GetNoise(float x, float y, float z)                                = 从坐标获取随机噪声
// [Point3]  GetCurlNoise(int time, Point3 pos, float frequency, float scale, float phase)  = 从坐标获取卷曲噪声
// [Point3]  GetTurbulence(int time, Point3 pos, float frequency, float scale, float lacunarity, int octaves, float phase)  = 从坐标获取湍流噪声
//
// [void]    SetSeed(int sInx, int seed)                    = 从模拟索引设置粒子随机种子
// [int]     GetRandInt(int sInx, int min, int max)         = 从模拟粒子获取随机整数 [>= min && < max]
// [float]   GetRandFloat(int sInx, float min, float max)   = 从模拟粒子获取随机浮点数 [>= min && <= max]
// [Point3]  GetRandVector(int sInx)                        = 从模拟粒子获取单位球上的随机向量
//
// [void]           SetBindsActive(int sInx, bool val)      = 设置粒子是否受其绑定影响
// [List<tfBind>]   GetBinds(int sInx)                      = 获取粒子的绑定 [警告:非线程安全!]
// [void]           SetBinds(List<tfBind> binds)            = 对使用GetBinds检索的粒子绑定应用更改 [警告:非线程安全!]
// [void]           NewBind(int sInx1, int sInx2, int id, float length, float stiffness) = 在它们的模拟索引之间创建两个粒子的新绑定 [警告:非线程安全!]
//
// [void]       PrepNeighbors(bool addVelocities)                                   = 构建用于进行邻居搜索的数据结构,可选择集成速度。必须在任何调用"GetNeighbors"之前调用此方法 [警告:在粒子循环外调用!]
// [void]       PrepNeighbors(bool addVelocities, List<int> neighborCandidates)     = 与上述'PrepNeighbors'相同,但您可以指定定义将添加到搜索结构中的粒子的模拟索引列表
// [void]       PrepNeighbors(List<Point3> neighborPositions)                       = 与上述'PrepNeighbors'相同,但您可以指定定义将添加到搜索结构中的点的位置列表
// [List<int>]  GetNeighbors(Point3 pos, float radius)                              = 获取位置半径内的粒子的模拟索引
// [int]        GetNearestNeighbor(Point3 pos, int excludeSInx)                     = 获取最近的粒子的模拟索引,可以指定一个模拟索引在搜索中被忽略(-1表示任何索引都可以)
//
// [void]   UpdatePhysXTM(int sInx)                                                 = 更新现有粒子的PhysX变换【警告:非线程安全!】
// [bool]   PhysXOverlapTest(int sInx1, Matrix3 tm1, int sInx2, Matrix3 tm2)        = 如果两个PhysX粒子壳体重叠,返回true,根据模拟索引和变换
// [bool]   PhysXSweepTest(int sInx, Matrix3 tm, Point3 sweepVec, bool includeSelf) = 如果一个PhysX粒子壳体与另一个PhysX粒子重叠,返回true,根据模拟索引、变换和扫描向量【includeSelf == 扫描测试将包括查询粒子】
//
// [tfObj]  GetObject(string name)  = 通过名称获取场景对象的tfObj包装器
// [tfObj]  GetObject(int handle)   = 通过句柄获取场景对象的tfObj包装器
//
// [tfTerrain] GetTerrain(string name)  = 通过名称获取现有的tfTerrain
// [tfTerrain] GetTerrain(int inx)      = 通过索引获取现有的tfTerrain
//
///////////////////////////////////////////////////////

///////////// [tfTex] 类属性 ////////////////
//
// [float]   GetMonoVal(int t, Point3 uvw)              = 根据时间(以ticks为单位)和UVW坐标(范围:0.0 - 1.0)获取纹理单色值
// [Point3]  GetColorVal(int t, Point3 uvw, bool gamma) = 根据时间(以ticks为单位)和UVW坐标(范围:0.0 - 1.0)获取纹理颜色值(可选,伽马校正)
//
///////////////////////////////////////////////////////

///////////// [tfBounds] 类属性 ////////////////
//
// [Point3]  min    = 边界框的最小范围
// [Point3]  max    = 边界框的最大范围
//
///////////////////////////////////////////////////////

///////////// [tfMesh] 类属性 ////////////////
//
// [int]     GetNumFaces()                          = 获取tfObj中的网格面数
// [int]     GetNumVerts()                          = 获取tfObj中的网格顶点数
// 
// [tfFace]  GetFace(int inx)                       = 从索引获取面
// [Point3]  GetVert(int inx)                       = 从索引获取顶点位置
//
// [Point3]  GetNormal(int vInx)                    = 从顶点索引获取网格上的法线
// [Point3]  GetVel(int vInx)                       = 从顶点索引获取网格上的速度
// [Point3]  GetUVW(int vInx, int channel)          = 从顶点索引和映射通道获取网格上的UVW
//
// [Point3] GetRandPointOnMesh(int seed)            = 使用种子获取网格上的随机点
// [tfFace] GetRandFaceOnMesh(int seed)             = 使用种子获取网格上的随机面
// [int]    GetRandVertOnMesh(int seed)             = 使用种子获取网格上的随机顶点
//
// [tfBounds]   GetBounds()                         = 获取网格的局部边界
// [Point3]     GetPosOffset()                      = 获取网格的局部枢轴位置偏移
//
///////////////////////////////////////////////////////

///////////// [tfObj] 类属性 ////////////////
// 
// [tfMesh]  GetMesh()                              = 获取tfObj的网格
//
// [Matrix3] GetTM()                                = 获取tfObj的世界空间变换
// [Point3]  GetPos()                               = 获取tfObj的世界空间位置
// [Quat]    GetRot()                               = 获取tfObj的世界空间旋转(四元数)
// [Point3]  GetScale()                             = 获取tfObj的世界空间缩放
//
// [tfFace]  GetClosestFace(Point3 p)               = 从点获取网格上最近的面(混合)
// [tfFace]  GetClosestFaceAccurate(Point3 p)       = 从点获取网格上最近的面(精确)
// [int]     GetClosestVert(Point3 p)               = 从点获取网格上最近的顶点索引
//
// [Point3]  GetClosestNormal(Point3 p)             = 从点获取网格上最近的法线
// [Point3]  GetClosestPoint(Point3 p)              = 从点获取网格上最近的点(混合)
// [Point3]  GetClosestPointAccurate(Point3 p)      = 从点获取网格上最近的点(精确)
// [Point3]  GetClosestUVW(Point3 p, int channel)   = 从点和映射通道获取网格上最近的UVW坐标
// [Point3]  GetClosestVel(Point3 p)                = 从点获取网格上最近的速度
// [Point3]  GetClosestBary(Point3 p)               = 从点获取网格上最近的重心坐标
//
// [RayHit] GetRaycastHit(Point3 p, Point3 dir)     = 向网格投射一条射线(从p沿dir方向)并返回命中数据
//
// [bool]   PointInside(Point3 p)                   = 测试点是否在网格内
// 
///////////////////////////////////////////////////////

///////////// [tfFace] 类属性 ///////////////
//
// [int]    inx                 = 获取面在其网格上的索引
//
// [int]    v1                  = 获取面的顶点索引1
// [int]    v2                  = 获取面的顶点索引2
// [int]    v3                  = 获取面的顶点索引3
//
// [float]  area                = 获取面的面积
// [Point3] normal              = 获取面的法线
// [int]    matID               = 获取面的matID
// [bool]   selected            = 获取面的选择状态
//
/////////////////////////////////////////////////////// 

///////////// [tfBind] 类属性 ///////////////
//
// [int]    Type()              = 获取绑定的类型(1 = 拉伸,2 = 剪切,3 = 弯曲,4 = 体积)
//
// [int]    id                  = 获取绑定的ID
// [int]    sInx1               = 获取绑定第一个粒子的模拟索引
// [int]    sInx2               = 获取绑定第二个粒子的模拟索引
//
// [float]  length              = 获取绑定的静止长度
// [float]  OrigLength()        = 获取绑定的原始静止长度
// [float]  CurrentLength()     = 获取绑定的当前长度
//
// [float]  stiffness           = 获取绑定的刚度
// [float]  OrigStiffness()     = 获取绑定的原始刚度
//
// [bool]   enableCollisions        = 控制绑定是否由CCCS处理
// [bool]   enableObjectCollisions  = 控制绑定是否与对象碰撞
// [float]  collisionThickness      = 控制绑定的碰撞厚度
// [float]  collisionFriction       = 控制绑定的碰撞摩擦力
//
// [void]   Break()                 = 断开绑定
// [void]   UnBreak()               = 取消断开绑定
// [bool]   IsBroken()              = 返回绑定当前是否断开
//
///////////////////////////////////////////////////////

///////////// [RayHit] 类属性 ///////////////
//
// [bool]   hit                 = 如果命中有效,则为true
//
// [Point3] hitPoint            = 获取命中点
// [int]    hitFace             = 获取命中面在网格上的索引
// [Point3] hitBary             = 获取命中点在命中面上的重心坐标
//
///////////////////////////////////////////////////////

///////////// [tfTerrain] 类属性 ////////////
//
// [string] name                = 获取地形的名称
//
// [int]        width           = 获取地形的宽度单元数
// [int]        length          = 获取地形的长度单元数
// [Matrix3]    tm              = 获取地形的场景变换
//
// [Point3] GetColor(string colorChannel, int x, int y)                         = 获取指定颜色通道中单元[x, y]的RGB值(作为Point3的XYZ分量)
// [void]   SetColor(string colorChannel, int x, int y, int r, int g, int b)    = 设置指定颜色通道中单元[x, y]的RGB值
// [float]  GetHeight(int x, int y)                 = 获取地形在单元[x, y]的局部高度
// [void]   SetHeight(int x, int y, float height)   = 设置地形在单元[x, y]的局部高度
//
// [Point3] GetPos(int x, int y)    = 获取地形在单元[x, y]的世界空间位置
// [Point3] GetNormal(int x, int y) = 获取地形在单元[x, y]的世界空间法线
//
// [void]               UpdateNormals()         = 如果您需要在更改高度值后访问地形的插值法线,请调用此方法
// [List<List<Point3>>] GetNormals()            = 缓存所有法线到列表(使用列表[y][x]与单元坐标访问)
// [List<List<float>>]  GetHeights()            = 缓存所有高度到列表(使用列表[y][x]与单元坐标访问)
//
///////////////////////////////////////////////////////

////////////// [Point2] 类属性 //////////////
//
// [float]  x           = 获取x值
// [float]  y           = 获取y值
//
///////////////////////////////////////////////////////

////////////// [Point3] 类属性 //////////////
//
// [float]  x                   = 获取x值
// [float]  y                   = 获取y值
// [float]  z                   = 获取z值
//
// [Point3] normalized          = 获取归一化向量
// [float]  magnitude           = 获取向量大小
// [float]  sqrMagnitude        = 获取向量平方大小
//
// [void]   Normalize()         = 归一化向量
// [void]   Scale(Point3 p)     = 按向量缩放
//
// [float]  Point3.Angle(Point3 p1, Point3 p2)              = 获取向量之间的角度
// [Point3] Point3.ClampMagnitude(Point3 p1, float length)  = 通过最大长度限制向量
// [Point3] Point3.Cross(Point3 p1, Point3 p2)              = 获取向量的叉积
// [float]  Point3.Distance(Point3 p1, Point3 p1)           = 获取向量之间的距离
// [float]  Point3.Dot(Point3 p1, Point3 p2)                = 获取向量的点积
// [Point3] Point3.Normalize(Point3 p1)                     = 获取归一化向量
// [Point3] Point3.ProjectOnPlane(Point3 p1, Point3 plane)  = 将向量投影到平面上
// [Point3] Point3.Reflect(Point3 dir, Point3 plane)        = 获取反射向量
//
///////////////////////////////////////////////////////

////////////// [Point4] 类属性 //////////////
//
// [float]  x           = 获取x值
// [float]  y           = 获取y值
// [float]  z           = 获取z值
// [float]  w           = 获取w值
//
///////////////////////////////////////////////////////

////////////// [Matrix3] 类属性 /////////////
//
// [Point3]  row1       = 获取矩阵的第一行(前向)
// [Point3]  row2       = 获取矩阵的第二行(右向)
// [Point3]  row3       = 获取矩阵的第三行(上向)
// [Point3]  row4       = 获取矩阵的第四行(平移)
//
// [Matrix3] inverted   = 获取逆矩阵
//
// [void] PreRotate(int axis, float ang)            = 沿(基于0的轴)预旋转矩阵(角度为ang)
// [void] PostRotate(int axis, float ang)       = 沿(基于0的轴)后旋转矩阵(角度为ang)
//
// [void]    Invert()                   = 逆转矩阵
// [Point3]  Transform(Point3 p)        = 使用矩阵变换一个点
// [Point3]  VectorTransform(Point3 p)  = 使用矩阵变换一个点(不包括平移)
//
///////////////////////////////////////////////////////

////////////// [Quat] 类属性 /////////////
//
// [float]   x      = 获取四元数的x值
// [float]   y      = 获取四元数的y值
// [float]   z      = 获取四元数的z值
// [float]   w      = 获取四元数的w值
//
// [Quat] normalized    = 获取标准化四元数
// [Quat] conjugated    = 获取共轭四元数
// [Quat] inverted      = 获取逆四元数
//
// [void] Conjugate()   = 共轭四元数
// [void] Invert()      = 逆转四元数
// [void] Normalize()   = 标准化四元数
//
///////////////////////////////////////////////////////

////////////// [AngAxis] 类属性 /////////////
//
// [Point3]  axis   = 获取AngAxis的轴
// [float]   angle  = 获取AngAxis的角度
//
///////////////////////////////////////////////////////

//__END__
*/

  

posted @ 2024-12-05 01:30  Jom  阅读(170)  评论(0)    收藏  举报