PDA

View Full Version : Forcing deformation order


heroinchicmodel
02-06-2006, 01:09 AM
Hi,

I'm trying to write a MEL script that allows the user to create a blendshape on a weighted mesh on one click. In order for this to work, the deformation order of the new blendshape being made must be at the bottom, but for some reason I cant get MEL to automate this. What I mean to say is the "-before" flag for the blendShape command is useless when I try it.

I would think that this flag would set the new blendShape node at the bottom of deformation order, but it never works.

I have to manually place the new blendshape on the bottom every time. If anyone can help with a way to automatically force the new blendshape node at the bottom with MEL, i'd be interested.

Some code of what I have so far:

global proc Knight_makeNewBlendShape () {


// THIS VARIABLE IS THE NAME OF THE MSH THAT DOES BLENDSHAPES

global string $facemesh = "Knight";

// THIS VARIABLE IS THE NAME OF THE BlendSHape node ASSOCIATED WITH ABOVED MESH

global string $facemeshBSnode = "KnightDefault";

string $ShapeName;
int $targetShapeNum = `getAttr -size ($facemeshBSnode + ".weight")`;

string $result = `promptDialog
-title "New Blendshape"
-message "Enter Name:"
-button "OK" -button "Cancel"
-defaultButton "OK" -cancelButton "Cancel"
-dismissString "Cancel"`;

if ($result == "OK") {

string $tempmesh[] = `duplicate $facemesh`;

$ShapeName = `promptDialog -query -text`;
rename $tempmesh[0] $ShapeName;
blendShape -n $ShapeName -before $ShapeName $facemesh;
hide $ShapeName;
reorderDeformers "TSM2_skinCluster" $ShapeName $facemesh;

//The last line is only a temporary solution
//If I want to put another custom BS node, it'll go on top of the last custom one.

}

plunq
02-06-2006, 05:47 PM
Hi heroinchicmodel,

what about using the -frontOfChain (-foc) flag instead of the -before flag?

CGTalk Moderation
02-06-2006, 05:47 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.