Copying envelope weights


Simple brute force example that copies the envelope weights between two shoes.

I read on the XSI list that the Blur Tools have a skinpanel tool that can copy/paste weights.

var oRShoe = Dictionary.GetObject( "Man.RShoe" );
var oLShoe = Dictionary.GetObject( "Man.LShoe" );

var oEnvelope = oRShoe.Envelopes(0);
oDeformerEnum = new Enumerator( oEnvelope.Deformers ) ;
for (;!oDeformerEnum.atEnd();oDeformerEnum.moveNext() )
{
	var oDeformer = oDeformerEnum.item() ;
	
	var vba = new VBArray( oEnvelope.GetDeformerWeights( oDeformer ) );
	var jsa = vba.toArray();

	var targetDeformer = oLShoe.Envelopes(0).Deformers( oDeformer.name.replace("R","L") );
	LogMessage( "Copy Env weights: "+ oDeformer.fullname + " -> " + targetDeformer );
	oLShoe.Envelopes(0).SetDeformerWeights( targetDeformer, jsa );
}

// INFO : Copy Env weights: Biped_Rig.RShin -> Biped_Rig.LShin
// INFO : Copy Env weights: Biped_Rig.RFootBone1 -> Biped_Rig.LFootBone1
// INFO : Copy Env weights: Biped_Rig.RFootBone2 -> Biped_Rig.LFootBone2
// INFO : Copy Env weights: Biped_Rig.RlegEff -> Biped_Rig.LlegEff
// INFO : Copy Env weights: Biped_Rig.RFootEff -> Biped_Rig.LFootEff

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s