StoreEnvironmentCacheToMixer

StoreEnvironmentCacheToMixer

導入

v4.0

詳細

環境キャッシュを新規アクションとしてミキサに保存します。

スクリプト構文

oReturn = StoreEnvironmentCacheToMixer( EnvironmentCache, [Name], [AddClip] );

戻り値

作成された新しいアクションをActionSourceとして戻します。

パラメータ

パラメータ タイプ 説明
EnvironmentCache ActionSource 使用するキャッシュを指定します。環境を指定しないと、現在の環境が使用されます。現在の環境がない場合には、何も実行されません。
Name 文字列 新しいアクションの名前
AddClip Boolean 新規アクションを保存した後に、アクションをクリップとしてミキサに適用する場合は True です。

デフォルト値: False

VBScript の例

' Create a simple simulation of two spheres falling on a grid

CreatePrim "Sphere", "MeshSurface"

SetValue "sphere.sphere.radius", 1

Translate , -3, 7, 0, siAbsolute, siView, siObj, siXYZ, True, "Views.ViewC.FrontCamera", siXY, , , , , , , 0

Duplicate "sphere", , 2, 1, 1, 0, 0, 1, 0, 1, , , , , , , , , , , 0

Translate , -2, 12, 0, siAbsolute, siView, siObj, siXYZ, True, "Views.ViewC.FrontCamera", siXY, , , , , , , 0

CreatePrim "Grid", "MeshSurface"

SetValue "grid.grid.ulength", 50

SetValue "grid.grid.vlength", 50

' Set the spheres as active rigid bodies and set their collision

' type to bounding sphere

CreateActiveRigidBody "sphere1,sphere"

SetValue "sphere1.RigidBodyProp.colltype,sphere.RigidBodyProp.colltype", Array(1, 1)

' Set the grid as a passive rigid body

CreatePassiveRigidBody "grid"

' Add gravity

CreateForce "Gravity"

' Turn on caching in the environment time control

SetValue "Environments.Environment.simtimectrl.caching", True

' Go to the last frame so that the simulation computes and stores

' into the cache

LastFrame

Refresh

' Copy the cache to the mixer. We pass true as the addclip parameter.

' This means that a clip will also be added in the mixer on a new

' track. Also, having this parameter set to true will mute the 

' simulation so that the mixer animation doesn't feedback back into the 

' simulation.

set oEnvironment = ActiveProject.ActiveScene.ActiveSimulationEnvironment

StoreEnvironmentCacheToMixer oEnvironment.Caches(0), "SimulationRun", True

' Now if you playback. What you will see is the animation played

' from by mixer. You can mute the mixer track, reactivate the

' simulation, tweak some simulation parameters and store another

' cache into the mixer. Once you have a series of such actions,

' review them and chose the one that you prefer.