ジャンプ先: 概要. 戻り値. 関連項目. フラグ. Python 例.

概要

parentConstraint( [target ...] [object] , [createCache=[float, float]], [deleteCache=boolean], [layer=string], [maintainOffset=boolean], [name=string], [remove=boolean], [skipRotate=string], [skipTranslate=string], [targetList=boolean], [weight=float], [weightAliasList=boolean])

注意: オブジェクト名や引数を表す文字列はカンマで区切ります。これは概要には示されていません。

parentConstraint は 「元に戻す」が可能、「照会」が可能、「編集」が可能 です。

オブジェクトの位置および回転をコンストレインし、オブジェクトをあたかもターゲット オブジェクトの子のように動作させます。ターゲットが複数の場合、コンストレインされたオブジェクトの全体的な位置および回転は、そのオブジェクトの位置および回転に対する各ターゲットの寄与度の加重平均となります。 parentConstraint は、1 つの「コンストレイン オブジェクト」DAG トランスフォーム ノードを配置および回転する、1 つ以上の「ターゲット」DAG トランスフォーム ノードを入力として取ります。parentConstraint は、ワールド座標空間上の位置、回転角度およびスケール ターゲット オブジェクトの加重平均で、コンストレインされたオブジェクトを配置および回転します。

戻り値

string[] 作成されたコンストレイン ノード名

戻り値の型は照会モードでは照会フラグが基になります。

関連項目

aimConstraint, geometryConstraint, normalConstraint, orientConstraint, pointConstraint, poleVectorConstraint, scaleConstraint, tangentConstraint

フラグ

createCache, deleteCache, layer, maintainOffset, name, remove, skipRotate, skipTranslate, targetList, weight, weightAliasList
ロング ネーム(ショート ネーム) 引数型 プロパティ
name(n) string createqueryedit
コンストレイン ノードの名前を指定した名前に設定します。デフォルト名は constrainedObjectName_constraintType です。
weight(w) float createqueryedit
指定したターゲットのウェイト値を設定します。 作成時に指定していない場合は、デフォルト値の 1.0 が使用されます。
remove(rm) boolean edit
リストされたターゲットをコンストレインから削除します。
targetList(tl) boolean query
ターゲット オブジェクトのリストを返します。
weightAliasList(wal) boolean query
ターゲット オブジェクトのウェイトをコントロールする、アトリビュートの名前を返します。targetList フラグで返されるターゲットと同じ順序で、エイリアスを返します。
layer(l) string createedit
コンストレインを追加するアニメーション レイヤの名前を指定します。
skipTranslate(st) string createmultiuse
移動コンストレインの際、指定した軸を省略します。有効な引数は「x」、「y」、「z」、および「none」です。
skipRotate(sr) string createmultiuse
回転コンストレインの際、指定した軸を省略します。有効な引数は「x」、「y」、「z」、および「none」です。
maintainOffset(mo) boolean create
このフラグが指定されると、コンストレインされたオブジェクトの位置および回転は維持されます。
createCache(cc) [float, float] edit
このフラグを使用して、コンストレインのキャッシュとして機能するアニメーション カーブを生成します。2 つの引数は開始フレームと終了フレームを定義します。
コンストレインが複数のターゲットを持ち、コンストレインの補間タイプの設定が「no flip」である場合は、キャッシュが便利です。「no flip」モードでは、再生時のフリップが回避されますが、結果はすぐ前のフレームに依存します。したがって、特定のフレームで継続的に同じ結果を得るには、キャッシュを生成する必要があります。このフラグは、キャッシュを作成し、コンストレインの補間タイプを「キャッシュ」に設定します。すでにキャッシュが存在する場合、このキャッシュが削除されて新しいキャッシュに置き換えられます。
deleteCache(dc) boolean edit
既存の補間キャッシュを削除します。

: コマンドの作成モードで使用可能なフラグ : コマンドの編集モードで使用可能なフラグ
: コマンドの照会モードで使用可能なフラグ : タプルまたはリストとして渡された複数の引数を持てるフラグ

Python 例

import maya.cmds as cmds

# Position cube1 at the location of cone1
# Rotate cube1 to the rotation of cone1
cmds.parentConstraint( 'cone1', 'cube1' )


# Position cube1 at the average of the locations of cone1 and surf2
# Rotate cube1 to the average of the rotations of cone1 and surf2
cmds.parentConstraint( 'cone1', 'surf2', 'cube2', w=.1 )

# Sets the weight for cone1's effect on cube2 to 10.
cmds.parentConstraint( 'cone1', 'cube2', e=True, w=10.0 )

# Removes surf2 from cube2's parentConstraint
cmds.parentConstraint( 'surf2', 'cube2', e=True, rm=True )

# Adds surf3 to cube2's parentConstraint with the default weight
cmds.parentConstraint( 'surf3', 'cube2' )

# Constrain position only in the y-axis with rotation
# constraining in all axes
cmds.parentConstraint( 'cone2', 'cube2', st=["x","z"] )