AddTransition

AddTransition

導入

v1.0

詳細

2 つのクリップ間にトランジションを作成します。トランジション カーブはこのトランジションに関連付けられます(デフォルトのカーブはリニアですが、作成後に編集できます)。

スクリプト構文

oReturn = AddTransition( [From], [To], [Type], [Name] );

戻り値

遷移(Transition オブジェクト)を戻します。

パラメータ

パラメータ タイプ 説明
From 文字列 クリップのトランジション元となるソース クリップ。

デフォルト値: Current selection, if empty:pick session

To 文字列 クリップのトランジション先となるターゲット クリップ。

デフォルト値: Current selection, if empty:pick session

Type Integer 作成するトランジションのタイプ。

デフォルト値: 0

指定可能な値:

説明:

0 スタンダード トランジション。
1 カーディナル トランジション。
2 ブリッジ トランジション。
Name 文字列 トランジション名。

VBScript の例

' This example creates a simple 2-bone skeleton and puts it in a model.

' Then it duplicates the model so we can compare Standard versus Cardinal

' transitions.  Next it makes three poses for the first model.  Finally,

' it applies these source clips onto both models and uses Standard

' transitions for the first model and Cardinals for the second.  Cardinal

' transitions require at least four consecutive clips in a row, and they

' give a smoother interpolation than Standard.  It ends by plotting the

' effector position to a curve, to illustrate the difference.

' Create the skeleton for our example.

set oSkelRoot = Create2DSkeleton( 0, 4, 0, 0, 0, 0, , , , , oBone1, oEff )

oBone2 = AppendBone( oEff, 4, 0, 0 )

' Put the skeleton in its own model, pretend it's a "character".

CreateModel oSkelRoot, "Standard", , oModel

' Because AppendBone just returns a string, not the object,

' we prepend the model name onto the front (now that it's inside one).

oBone2 = oModel & "." & oBone2

' Duplicate the model in Branch mode ("B:" indicates branch), rename

' the new model "Cardinal" (the first model is called "Standard").

set oOtherModel = Duplicate( "B:" & oModel, 1 )

SetValue oOtherModel & ".name", "Cardinal"

' The model is the first member of the collection returned by Duplicate.

oOtherModel = oOtherModel(0)

' Take a few "snapshot" poses.  For this example, we translate the

' effector (IK), but capture the values of the bone rotations (FK)

' for later use in the mixer.

rotParams = "/kine.local.rotx,kine.local.roty,kine.local.rotz"

paramStr = oBone1 & "," & oBone2 & rotParams

dim oPoses(5)

posCoords = Array( Array(4,0,0), Array(0,2,0), Array(-1,-3,0), _

			Array(0,-3.5,0), Array(1,-1,0), Array(4,0,0) )

for i = 0 to 5

	SnapshotPose oModel, oEff, oPoses(i), _

			posCoords(i)(0), posCoords(i)(1), posCoords(i)(2), paramStr

next

' Create tracks for the clips (one track in each model).

dim oTracks(1), oClips(5,1)

set oTracks(0) = AddTrack( oModel, , 0 )

set oTracks(1) = AddTrack( oOtherModel, , 0 )

' Now go through and instantiate the sources into single-frame clips on

' the two mixers.  For the first mixer we will add standard transitions

' between each pair of consecutive clips.  For the second one, we

' will add Cardinal transitions.

for i = 0 to 5

	set oClips(i,0) = AddClip( oModel, oPoses((i)), , oTracks(0), i * 19 + 1 )

	set oClips(i,1) = AddClip( oOtherModel, oPoses((i)), , oTracks(1), i * 19 + 1 )

	if i > 0 then

		AddTransition oClips(i-1,0), oClips(i,0), 0	' Standard

		AddTransition oClips(i-1,1), oClips(i,1), 1	' Cardinal

	end if

next

' Just offset the two models so we can see them separately.

SetValue oModel & ".kine.local.posx", -5

SetValue oOtherModel & ".kine.local.posx", 5

' Get the second effector's full name by prepending the

' second model's name to the first effector's "simple" name.

oEff1 = oOtherModel & "." & oEff.name

' Finally, plot the effector positions to compare the paths.

PlotCurve oEff & "," & oEff1, , 1, 96, 1

'==================================================

' Helper method to create a snapshot Action for the chain.

'==================================================

sub SnapshotPose( in_oModel, in_oEff, io_oPose, in_X, in_Y,in_Z, in_paramStr )

	Translate in_oEff, in_X, in_Y, in_Z, siAbsolute, siView, siObj, siXYZ

	Refresh ' needed because StoreAction just looks at current values.

	set io_oPose = StoreAction( in_oModel, in_paramStr, 1, , True, 1, 1 )

end sub

関連項目

AddBridgeTransition Transition