移動先: 概要 戻り値 フラグ. Python 例.
choice(
[objects]
, [attribute=string], [controlPoints=boolean], [index=uint], [name=string], [selector=name], [shape=boolean], [sourceAttribute=name], [time=time])
注意: オブジェクト名や引数を表す文字列はカンマで区切ります。これは概要には示されていません。
choice は 「元に戻す」が可能、「照会」が可能、「編集」が可能 です。
choice コマンドは、入力を特定の基準(通常は時間ベース)に基づいたアトリビュートに変更するメカニズムを提供します。
たとえば、オブジェクトをフレーム 1 から 30 までモーション パスでアニメートし、フレーム 30 から 50 までキーフレーム アニメーションに追従させ、フレーム 50 の後はモーション パスに戻します。または、リボルブ サーフェスであれば、トランスフォームの回転値の一部に従って Input カーブを変更することもできます。
choice コマンドは選択したオブジェクトの指定したアトリビュートすべてに choice ノード(まだない場合)を作成します。
アトリビュートがすでに何かにコネクトされている場合、コネクトされた側は次に choice ノードの入力の i 番目のインデックス(または、-in/index フラグが指定されていない場合、次に使用可能な入力)に再度コネクトされます。
ソース アトリビュートが指定されている場合、そのアトリビュートは choice ノードの i 番目の入力にコネクトされます。
choice ノードは、その Selector アトリビュートの値で操作し、出力を通してどの入力アトリビュートを渡すかを定義します。
入力アトリビュートはどのタイプにもできます。たとえば、Selector アトリビュートが(1,1)、(30,2)と(50,1)のキーフレームが設定されたアニメーション カーブでコネクトされている場合、choice ノードは、time1 から 30 と time50 より後では input[1] から、time30 から 50 では input[2] からデータを渡すといることです。
このコマンドは、作成または変更された choice ノードの名前を返します。アニメーション カーブにキーフレームが追加されている場合、インデックス(またはアニメーション カーブの値)が指定されます。
string[] | セレクタ キーフレームが作成されたアトリビュートの、新しく作成/変更された choice ノードです。
例:
choice1.input[3] choice2.input[3] |
戻り値の型は照会モードでは照会フラグが基になります。
attribute, controlPoints, index, name, selector, shape, sourceAttribute, time
: コマンドの作成モードで使用可能なフラグ
|
: コマンドの編集モードで使用可能なフラグ
|
: コマンドの照会モードで使用可能なフラグ
|
: タプルまたはリストとして渡された複数の引数を持てるフラグ
|
import maya.cmds as cmds
# This example animates an object airplane along a motion path
# from frames 1 to 30, then continues with keyframe animation until
# frame 50, then returns to the motion path at frame 50.
path = cmds.curve(d=3,p=[(-10, 0, 0),(-6, 0, 10),(-3, 0, -10),(10, 0, 0)],k=[0, 0, 0, 1, 1, 1])
cmds.polyPlane()
cmds.pathAnimation('pPlane1',c=path,stu=1,etu=100)
# Set a choice node on the path animation, ensuring that the choice
# selects path animation from 1 to 30, and then returns at 50.
cmds.choice( 'pPlane1', at='ty', t=[1,30,50] )
# Start a new kind of choice at time 31
cmds.choice( 'pPlane1', at='ty', t=31 )
# Create some keyframe animation between times 31 and 49
cmds.currentTime( 31 )
cmds.setKeyframe( 'pPlane1', at="ty" )
cmds.move( 1, 2, 3, r=True )
cmds.setKeyframe( 'pPlane1', at="ty", t=40 )
cmds.move( 4, 5, 6, r=True )
cmds.setKeyframe( 'pPlane1', at="ty", t=49 )
# Note that the -at/attribute and -t/time flags are not
# queryable in themselves, but they can be used to
# modify the choice nodes to query.
# What is the attribute that is connected to the pPlane1.ty choice node's
# selector attribute?
cmds.choice( 'pPlane1', at='ty', query=True, sl=True)
# Which indices will be evaluated for the choice node to pPlane1.ty
# at the given times?
cmds.choice( 'pPlane1', at='ty', t=[1,30,50], query=True, index=True)