インタフェース: particleObjectExt

particleObjectExt インタフェースは、パーティクル フロー Source クラスで公開されます

プロパティ:

<PF_Source>.particleIndex : index : Read|Write|Validated by Range: 1 to 100000000     

現在のパーティクル インデックスを取得/設定します。

<PF_Source>.particleID : index : Read|Write|Validated by Range: 1 to 100000000   

現在のパーティクル ID を取得/設定します。

<PF_Source>.particleAge : time : Read|Write|Validated by Range: 0f to 625000f

現在のパーティクル エージを取得/設定します。

<PF_Source>.particleGroupTime : time : Read|Write|Validated by Range: 0f to 625000f

現在のパーティクルの Group Time を取得/設定します。

<PF_Source>.particlePosition : point3 : Read|Write

現在のパーティクルの位置を取得/設定します。

<PF_Source>.particleSpeed : point3 : Read|Write

現在のパーティクルの速度を取得/設定します。

<PF_Source>.particleOrientation : point3 : Read|Write

現在のパーティクルの方向を取得/設定します。

<PF_Source>.particleSpin : angleAxis : Read|Write

現在のパーティクルのスピンを取得/設定します。

<PF_Source>.particleScale : float : Read|Write|Validated by Range: 0.0 to 1e+009

現在のパーティクルのサイズを取得/設定します。

<PF_Source>.particleScaleXYZ : point3 : Read|Write

現在のパーティクルのスケールを Point3 値として取得/設定します。

<PF_Source>.particleTM : matrix3 : Read|Write

現在のパーティクルの変換行列を取得/設定します。

<PF_Source>.particleSelected : boolean : Read|Write

現在のパーティクルの選択された状態を取得/設定します。

<PF_Source>.particleShape : mesh : Read|Write

現在のパーティクルのメッシュを取得/設定します。

例と結果:

    --Create a default PF Source in the Scene from the Create Tab.
    --Get the Source by name to test the Interface Properties:

    pf = PF_Source()

    particleFlow.BeginEdit()
    op1 = Birth()
    op2 = Position_Icon()
    op3 = Speed()
    op4 = Rotation()
    op5 = ShapeLibrary()
    op6 = RenderParticles()
    op7 = DisplayParticles()
    op7.color = pf.wireColor
    ev1 = Event()
    ev1.SetPViewLocation (pf.X_Coord) (pf.Y_Coord+100)
    particleFlow.EndEdit()
    ev1.AppendAction op1
    ev1.AppendAction op2
    ev1.AppendAction op3
    ev1.AppendAction op4
    ev1.AppendAction op5
    ev1.AppendAction op7
    pf.AppendAction op6
    pf.AppendInitialActionList ev1


    --> $PF_Source:PF Source 01 @ [2.536594,-48.031052,0.000000]
    --Get the curren particle's index
    pf.particleIndex
    --> 1
    --Change the particle index. Any subsequent
    --properties will be from particle 2
    pf.particleIndex = 2
    --> 2
    --Check to make sure it worked...
    pf.particleIndex
    --> 2
    --Get the Particle ID of particle 2
    pf.particleID
    --> 0
    --Get the Particle Age on frame 0
    --This is a newborn particle, age is 0!
    pf.particleAge
    --> 0f
    --Now change the scene time to frame 10...
    sliderTime = 10
    --> 10
    --...and get the Age again -
    --10 frames later, the Age is 9.7 frames!
    pf.particleAge
    --> 9.7f
    --Check whether particle 2 is selected -
    --No, it is not
    pf.particleSelected
    --> false
    -- Select PF Source
    select pf
    --Change to Modify panel
    max modify mode
    --> OK
    --Change to Particle sub-object level
    subObjectLevel = 1
    --> 1
    --Select Particle 2 - one particle
    --should turn red in the viewport
    pf.particleSelected = true
    --> true
    --Get the particle position
    pf.particlePosition
    --> [12.1301,-40.7149,-96.9697]
    --You can change it -
    --The Particle should move there...
    pf.particlePosition = [10.0,-10.0,-40.0]
    --> [10,-10,-40]
    --Get the Speed of particle 2
    pf.particleSpeed
    --> [0,0,-0.0625]
    --Get the Orientation of particle 2
    pf.particleOrientation
    --> [-2.75317,-1.18547,-0.402363]
    --Get the Spin of particle 2
    pf.particleSpin
    --> (angleAxis 0 [1,0,0])
    --Get the size of the particle
    pf.particleScale
    --> 16.3299
    --Get the Scale of the particle
    pf.particleScaleXYZ
    --> [1,1,1]
    --Get the complete TM of the particle
    pf.particleTM
    --> (matrix3 [0.345842,-0.147184,0.926677] [-0.0394943,-0.989029,-0.142347] [0.937461,0.0126313,-0.34786] [12.1301,-40.7149,-96.9697])
    --Get the Shape as TriMesh.
    msh = pf.particleShape
    --> TriMesh
    --Take a look at the number of vertices
    msh.numverts
    --> 4
    --...and the number of faces
    msh.numfaces
    --> 4
    --Why not take a look at the actual TriMesh?
    --Create a new empty Editable Mesh
    new_mesh = Editable_mesh()
    --> $Editable_Mesh:Object01 @ [0.000000,0.000000,0.000000]
    --Assign the shape snapshot to the mesh
    new_mesh.mesh = msh
    --> TriMesh
    --And finally update all caches of the Emesh to see the result:
    update new_mesh
    --> OK

メソッド:

<void><PF_Source>.updateParticles <node>particleSystem <time>time

指定した時間にパーティクルを更新するように強制します。

<integer><PF_Source>.numParticles()

パーティクルの数を返します。

<integer><PF_Source>.numParticlesGenerated()

生成されたパーティクルの数を返します。

<void><PF_Source>.setEveryStepUpdateScriptLine <string>script

各更新ステップで実行されるようにスクリプト文字列を設定します。

<void><PF_Source>.setEveryStepUpdateScriptFile <filename>fileName

各更新ステップで実行されるようにスクリプト ファイルを設定します。

<void><PF_Source>.setFinalStepUpdateScriptLine <string>script

最後の更新ステップで実行されるようにスクリプト文字列を設定します。

<void><PF_Source>.setFinalStepUpdateScriptFile <filename>fileName

最後の更新ステップで実行されるようにスクリプト ファイルを設定します。

<time><PF_Source>.getUpdateTime()

現在の更新時間を返します。

<void><PF_Source>.getUpdateInterval <&time>timeStart <&time>timeEnd

timeStart is In and Out parameter
timeEnd is In and Out parameter

2 つの参照変数内の更新間隔を返します。

<index><PF_Source>.getParticleID <index>particleIndex

インデックスで指定されたパーティクルのパーティクル ID を返します。

<boolean><PF_Source>.hasParticleID <index>particleBornIndex <&index>particleIndex

particleIndex is In and Out parameter

指定したパーティクル発生 ID を持つパーティクルが存在する場合、true を返します。指定した参照変数内にある実際のパーティクル インデックスを返します。

<node><PF_Source>.getParticleGroup <index>particleIndex

インデックスで指定されたパーティクル グループのノードを返します。

<index><PF_Source>.getParticleIndex <index>particleBornIndex

指定した発生インデックスを持つパーティクルのパーティクル インデックスを返します。

<time><PF_Source>.getParticleAge <index>particleIndex

インデックスで指定されたパーティクルのパーティクル エージを返します。

<time><PF_Source>.getParticleAgeByID <index>particleID

パーティクル ID によって指定されたパーティクルのパーティクル エージを返します。

<void><PF_Source>.setParticleAge <index>particleIndex <time>age

指定したインデックス指定のパーティクルのパーティクル エージを、指定したエージの値に設定します。

<void><PF_Source>.setParticleAgeByID <index>particleID <time>age

ID によって指定されたパーティクルのパーティクル エージを、指定したエージの値に設定します。

<time><PF_Source>.getParticleLifeSpan <index>particleIndex

指定したインデックス指定のパーティクルのスパン期間を返します。

<time><PF_Source>.getParticleLifeSpanByID <index>particleID

ID によって指定されたパーティクルのスパン期間を返します。

<void><PF_Source>.setParticleLifeSpan <index>particleIndex <time>lifeSpan

インデックスで指定されたパーティクルのスパン期間を、指定された[寿命] (Lifespan)の値に設定します。

<void><PF_Source>.setParticleLifeSpanByID <index>particleID <time>lifeSpan

ID によって指定されたパーティクルのスパン期間を、指定された[寿命] (Lifespan)の値に設定します。

<time><PF_Source>.getParticleGroupTime <index>particleIndex

インデックスで指定されたパーティクルの Group Time を返します。

<time><PF_Source>.getParticleGroupTimeByID <index>particleID

ID によって指定されたパーティクルの Group Time を返します。

<void><PF_Source>.setParticleGroupTime <index>particleIndex <time>age

インデックスで指定されたパーティクルの Group Time を、指定したエージの値に設定します。

<void><PF_Source>.setParticleGroupTimeByID <index>particleID <time>age

ID によって指定されたパーティクルの Group Time を、指定したエージの値に設定します。

<point3><PF_Source>.getParticlePosition <index>particleIndex

インデックスで指定されたパーティクルの位置を返します。

<point3><PF_Source>.getParticlePositionByID <index>particleID

ID によって指定されたパーティクルの位置を返します。

<void><PF_Source>.setParticlePosition <index>particleIndex <point3>position

インデックスで指定されたパーティクルの位置を、指定された Point3 型の値に設定します。

<void><PF_Source>.setParticlePositionByID <index>particleID <point3>position

ID で指定されたパーティクルの位置を、指定された Point3 型の値に設定します。

<point3><PF_Source>.getParticleSpeed <index>particleIndex

インデックスで指定されたパーティクルの速度を Point3 型の値として返します。

<point3><PF_Source>.getParticleSpeedByID <index>particleID

ID で指定されたパーティクルの速度を Point3 型の値として返します。

<void><PF_Source>.setParticleSpeed <index>particleIndex <point3>speed

インデックスで指定されたパーティクルの速度を、指定された Point3 型の値に設定します。

<void><PF_Source>.setParticleSpeedByID <index>particleID <point3>speed

ID で指定されたパーティクルの速度を、指定された Point3 型の値に設定します。

<point3><PF_Source>.getParticleOrientation <index>particleIndex

インデックスで指定されたパーティクルの方向を Point3 型の値として返します。

<point3><PF_Source>.getParticleOrientationByID <index>particleID

ID で指定されたパーティクルの方向を Point3 型の値として返します。

<void><PF_Source>.setParticleOrientation <index>particleIndex <point3>orientation

インデックスで指定されたパーティクルの方向を、指定された Point3 型の値に設定します。

<void><PF_Source>.setParticleOrientationByID <index>particleID <point3>orientation

ID で指定されたパーティクルの方向を、指定された Point3 型の値に設定します。

<angleAxis><PF_Source>.getParticleSpin <index>particleIndex

インデックスで指定されたパーティクルのスピンを angleAxis 値として返します。

<angleAxis><PF_Source>.getParticleSpinByID <index>particleID

ID で指定されたパーティクルのスピンを angleAxis 値として返します。

<void><PF_Source>.setParticleSpin <index>particleIndex <angleAxis>spin

インデックスで指定されたパーティクルのスピンを、指定した AngleAxis 値に設定します。

<void><PF_Source>.setParticleSpinByID <index>particleID <angleAxis>spin

ID によって指定されたパーティクルのスピンを、指定した angleAxis 値に設定します。

<float><PF_Source>.getParticleScale <index>particleIndex

インデックスで指定されたパーティクルのサイズを浮動小数点の値として返します。

<float><PF_Source>.getParticleScaleByID <index>particleID

ID で指定されたパーティクルのサイズを浮動小数点の値として返します。

<void><PF_Source>.setParticleScale <index>particleIndex <float>scale

インデックスで指定されたパーティクルのサイズを、指定した浮動小数点の値に設定します。

<void><PF_Source>.setParticleScaleByID <index>particleID <float>scale

ID によって指定されたパーティクルのサイズを、指定した浮動小数点の値に設定します。

<point3><PF_Source>.getParticleScaleXYZ <index>particleIndex

インデックスで指定されたパーティクルのスケールを Point3 型の値として返します。

<point3><PF_Source>.getParticleScaleXYZByID <index>particleID

ID で指定されたパーティクルのスケールを Point3 型の値として返します。

<void><PF_Source>.setParticleScaleXYZ <index>particleIndex <point3>scaleXYZ

インデックスで指定されたパーティクルのスケールを、指定された Point3 型の値に設定します。

<void><PF_Source>.setParticleScaleXYZByID <index>particleID <point3>scaleXYZ

ID で指定されたパーティクルのスケールを、指定された Point3 型の値に設定します。

<matrix3><PF_Source>.getParticleTM <index>particleIndex

インデックスで指定されたパーティクルの変換行列を返します。

<matrix3><PF_Source>.getParticleTMByID <index>particleID

ID によって指定されたパーティクルの変換行列を返します。

<void><PF_Source>.setParticleTM <index>particleIndex <matrix3>TM

インデックスで指定されたパーティクルの変換行列を設定します。

<void><PF_Source>.setParticleTMByID <index>particleID <matrix3>TM

ID によって指定されたパーティクルの変換行列を設定します。

<boolean><PF_Source>.getParticleSelected <index>particleIndex

インデックスで指定されたパーティクルの選択された状態を返します。

<boolean><PF_Source>.getParticleSelectedByID <index>particleID

ID によって指定されたパーティクルの選択された状態を返します。

<void><PF_Source>.setParticleSelected <index>particleIndex <boolean>selected

インデックスで指定されたパーティクルの選択された状態を設定します。

<void><PF_Source>.setParticleSelectedByID <index>particleID <boolean>selected

ID によって指定されたパーティクルの選択された状態を設定します。

<mesh><PF_Source>.getParticleShape <index>particleIndex

インデックスで指定されたパーティクルのシェイプをメッシュ値として返します。

<mesh><PF_Source>.getParticleShapeByID <index>particleID

ID で指定されたパーティクルのシェイプをメッシュ値として返します。

<void><PF_Source>.setParticleShape <index>particleIndex <mesh>shape

インデックスで指定されたパーティクルのシェイプを、指定したメッシュ値に設定します。

<void><PF_Source>.setParticleShapeByID <index>particleID <mesh>shape

ID によって指定されたパーティクルのパーティクルのシェイプを、指定したメッシュ値に設定します。

<void><PF_Source>.setShapeForAllParticles <mesh>shape

すべてのパーティクルのシェイプを、指定されたメッシュ値に設定します。

例と結果:

    --Create a new Particle Flow Source in the Viewport,
    --then get it by name from the scene
    pf = $'PF Source 001'
    --> $PF_Source:PF Source 01 @ [2.536594,-48.031052,0.000000]
    --Set the scene time to frame 10
    sliderTime = 10
    --> 10
    --Update the particles at time 10
    pf.updateParticles pf 10f
    --> OK
    --Get total number of particles at current time
    pf.numParticles()
    --> 34
    --Get the total number of particles generated up to the current time
    pf.numParticlesGenerated()
    --> 34
    --Get the particles update time
    pf.getUpdateTime()
    --> 10f
    --Initialize two user variables to 0
    ts = te = 0
    --> 0
    --Set scene time to frame 10
    sliderTime = 10f
    --> 10f
    --Get the update interval into the variables passed by reference
    pf.getUpdateInterval &ts &te
    --> OK
    --Check the start time
    ts
    --> 9f
    --Check the end time
    te
    --> 10f
    pf.getParticleID 34--Get the particle ID of the 34th particle
    --> 34
    --Try to get the 35th particle.
    --There are only 34 particles, so ID is 0
    pf.getParticleID 35
    --> 0
    --Initialize a variable to pass by reference
    idx = 0
    --> 0
    --Check if there is particle with ID 34 -
    --Yes, there is one
    pf.hasParticleID 34 &idx
    --> true
    --and its index is 34
    idx
    --> 34
    --Check the same about particle ID 35 -
    --no, there is none
    pf.hasParticleID 35 &idx
    --> false
    --Get the Particle Group node
    pf.getParticleGroup 2
    --> $Particle_Group:PF Source 01->Event 01 @ [0.000000,0.000000,0.000000]
    --Get the index of particle 34
    pf.getParticleIndex 34
    --> 34
    --Get the index of particle 35
    --No such particle ID, index is 0
    pf.getParticleIndex 35
    --> 0
    --Get the particle age of particle 2
    pf.getParticleAge 2
    --> 9.7f
    --Get the particle age of particle ID 2 -
    --It is the same particle!
    pf.getParticleAgeByID 2
    --> 9.7f
    --Get the particle age of particle 34
    --It was born later, age is smaller
    pf.getParticleAge 34
    --> 9f
    --Set age of particle 2 to 5 frames
    pf.setParticleAge 2 5f
    --> OK
    --Check to see if it worked - It did!
    pf.getParticleAge 2
    --> 5f
    --Get the life span of particle 2
    --Who wants to live forever? This one!
    pf.getParticleLifeSpan 2
    --> 1.34218e+007f
    --Change the life span of particle 2
    pf.setParticleLifeSpan 2 10f
    --> OK
    --Check again - it changed!
    pf.getParticleLifeSpan 2
    --> 10f
    --Get the Group Time of Particle 2
    pf.getParticleGroupTime 2
    --> 0f
    --Set the Particle Group Time to 10
    pf.setParticleGroupTime 2 10f
    --> OK
    --Get the time again - it was set!
    pf.getParticleGroupTime 2
    --> 10f
    --Let’s change the mesh of particle 2 to a Geosphere
    gs = (geosphere radius:5).mesh
    --> TriMesh
    --Change the Display to Geometry
    pf.Event_001.Display_001.Type = 6
    --> 6
    --Set the particle mesh
    --One particle should become a Geosphere!
    pf.setParticleShape 2 gs
    --> OK
    --Get the mesh of a teapot
    tp = (teapot radius:5).mesh
    --> TriMesh
    --and assign to all particles - they should turn into teapots!
    --IT’S TEA TIME!
    pf.setShapeForAllParticles tp
    --> OK

このインタフェースは下記で使用できます。

PF_Source : GeometryClass

ParticleGroup : GeometryClass