LockEnvelopeWeights

LockEnvelopeWeights

導入

v5.0

詳細

ポイント デフォーマのペアに対するエンベロープ ウェイトの修正を禁止します。

エンベロープ デフォーメーションのエフェクトはウェイト マッピングにより制御されます。 これらのエンベロープ ウェイトは、ペイントやスムージングなどのさまざまな編集ツールで修正できます。 このコマンドは、直接的な操作または(正規化などの)間接的な操作によりデフォーマのウェイトが修正されないようにします。

このコマンドには 2 つの配列が必要です。 これら 2 つの配列は、ロックする(ポイント、デフォーマの)ペアを定義します。 たとえば、(2、62、93)のポイント配列と(1、12、16)のデフォーマ配列がわたされる場合は、1 番目のデフォーマと 2 番目のポイントの間のウェイト、12 番目のデフォーマと 62 番目のポイントの間のウェイト、および 16 番目のデフォーマと 93 番目のポイントの間にあるウェイトがロックされます。 このため、2 つの配列のサイズを等しくする必要があります。 デフォーマ インデックスはエンベロープ プロパティに接続されます。

スクリプト構文

oReturn = LockEnvelopeWeights( PropObj, Points, Deformers, [Locked] );

戻り値

ロックを適用する新しいオペレータを含むXSICollection を戻します。

パラメータ

パラメータ タイプ 説明
PropObj 文字列 ウェイトをロックするエンベロープ ウェイト プロパティ。
Points XSICollection ロックするポイント インデックスの配列。
Deformers 文字列 ロックするデフォーマ インデックスの配列。
Locked Boolean これらのデフォーマはロックしてください(それ以外の場合はロック解除されます)。

デフォルト値: True

JScript の例

/*

	This example illustrates how you can control the normalization process

	when setting envelope weights by using weight locking. Normalization

	automatically enforces that the sum of the weights for a given point

	is always maintained to 100% when modifying weights numerically,

	by painting or through any of the other weight editing commands.

*/

// We start with a simple cylinder enveloped to a 6 bone chain

NewScene( null, false );

var oCyl = CreatePrim( "Cylinder", "MeshSurface" );

SetValue( "cylinder.cylinder.height", 10 );

SetValue( "cylinder.polymsh.geom.subdivv", 20 );

SetValue( "cylinder.polymsh.geom.subdivu", 16 );

Create2DSkeleton( 1.97818728045807E-02, 5.04656031338284, 0, 0.81105678498785, 3.66123003127775, 0, 0, 0, 0, 4 );

AppendBone( "eff", 0.890184276206176, 1.91967196234563, 0 );

AppendBone( "eff", 0.969311767424504, 0.257275623819517, 0 );

AppendBone( "eff", 1.00887551303367, -1.76134850153362, 0 );

AppendBone( "eff", 0.969311767424504, -3.18625964884171, 0 );

AppendBone( "eff", 1.97818728045807E-02, -4.96739858297683, 0 );

SelectObj( "cylinder", null, true );

ApplyFlexEnv( "cylinder;bone,bone1,bone2,bone3,bone4,bone5,eff", false, 0 );

// Say that for a given set of points you want to set the

// envelope weight assignment so that the points are weighted

// 50% to "bone1", 25% to "bone" and 25% to "bone2"

// You can first set the weight for these points to 50% to "bone1"

SIModifyFlexEnvWght( "cylinder.polymsh.cls.EnvelopWeightCls.Envelope_Weights", "bone1", 

	"cylinder.pnt[18,19,41,42,64,65,87,88,110,111,133,134,156,157,179,180,202,203,225,226,248,249,271,272,294,295,317,318,340,341,363,364]", 0, 50 );

// Get the list of deformers to use as input to the LockEnvelopeDeformerWeights command

var oDefs = new ActiveXObject( "XSI.Collection" );

oDefs.SetAsText( "bone1" );

// Tip - Alternatively, you could use "oDefs.Add oCyl.Envelopes(0).Deformers(0)" to populate the Deformers collection

// Now to avoid that normalization affects the new 50%

// assignment, we can lock the weights for deformer "bone1" as follows:

LockEnvelopeDeformerWeights( "cylinder.polymsh.cls.EnvelopWeightCls.Envelope_Weights", oDefs, true );

// Now we can assign the two other bones to 25% without having normalization

// affect the "bone1" values.

SIModifyFlexEnvWght( "cylinder.polymsh.cls.EnvelopWeightCls.Envelope_Weights", "bone", 

	"cylinder.pnt[18,19,41,42,64,65,87,88,110,111,133,134,156,157,179,180,202,203,225,226,248,249,271,272,294,295,317,318,340,341,363,364]", 0, 25 );

SIModifyFlexEnvWght( "cylinder.polymsh.cls.EnvelopWeightCls.Envelope_Weights", "bone2", 

	"cylinder.pnt[18,19,41,42,64,65,87,88,110,111,133,134,156,157,179,180,202,203,225,226,248,249,271,272,294,295,317,318,340,341,363,364]", 0, 25 );

// Now once we're done we can unlock the weights for that

// deformer in the same way:

LockEnvelopeDeformerWeights( "cylinder.polymsh.cls.EnvelopWeightCls.Envelope_Weights", oDefs, false );

// We could have also simply cleared all weight locks as follows:

ClearEnvelopeWeightLocks( "cylinder.polymsh.cls.EnvelopWeightCls.Envelope_Weights" );

// Now weights don't need to be locked on a per deformer basis.

// One could have locked individual point/deformer weight pairs as follows:

LockEnvelopeWeights( "cylinder.polymsh.cls.EnvelopWeightCls.Envelope_Weights", new Array(41,42,64,65), new Array(1,1,2,2), true );

// This last command locks the weight for points 41 and 42 for deformer 1 (the

// second deformer since indices start at zero) and points 64 and 65 for deformer 2.

関連項目

SIApplyFlexEnv LockEnvelopeDeformerWeights LockEnvelopePointWeights ClearEnvelopeWeightLocks SIModifyFlexEnvWght Envelope