Evaluate Nodes commands don't work

Evaluate Nodes commands don't work

Anonymous
Not applicable
878 Views
1 Reply
Message 1 of 2

Evaluate Nodes commands don't work

Anonymous
Not applicable

Hello guys!

This is my first post in the forums so please don't be too harsh if I forget to mention something or anything.

 

To my problem:

 

I'm trying to evaluate and not evaluate the IK solver nodes that you usually access via Modify -> Evaluate Nodes -> IK Solvers by coding in MEL. I tried the command doEnableNodeItems false iksolver; but it didn't work, while doEnableNodeItems false all; did work.

 

I don't know why, since the Echo All Commands option in the script editor returns this exact command, while nothing is changing when it's used.

Also sorry if my english isn't perfect, non native here.

 

If anybody has a solution to this I'd be very thankful.

 

Best regards,

Julius

 

PS: I'm using Maya 2017 if that matters.

0 Likes
Accepted solutions (1)
879 Views
1 Reply
Reply (1)
Message 2 of 2

kevin.picott
Alumni
Alumni
Accepted solution

Looks like you found a bug! Here is the script below, which you can find in your Maya installation if you dig long enough so I'm not giving away any secrets here. Notice the bug - when you call doEnableNodeItems with something other than "all", all it does is set the state to the same state it currently has. Fortunately it's a simple function and to work around it you can just implement a new version with the correction.

 

proc enableDisable(int $isOn)
{
	int $isOff = ! $isOn;
	string $name;
	string $names[] = { "constraint", 
						"expression", 
						"fluid",
						"globalstitch", 
						"nCloth",
						"nParticle",
						"nRigid",
						"dynamicConstraint",
						"nucleus",
						"iksolver", 
						"particle", 
						"rigidbody", 
						"snapshot" };
	for( $name in $names )
	{
		if( `menuItem -exists ($name + "OnOff")` ) {
			menuItem -e -cb $isOn ($name + "OnOff");
		}
	}
}

global proc doEnableNodeItems(int $state, string $name)
//
//  Description:
//      Change the checked state of the enable/disable node menu items.
//
//  Input Arguments:
//      $state  - true for enable all, false for disable all
//                ignored for individual items (we toggle them)
//		$name    - the type of node being disabled
//
//  Return Value:
//      None.
//

{
	if( $name == "all" ) {
		setState $name $state;
		enableDisable( $state );
	} else {
		string $whichItem = $name + "OnOff";
		if( `menuItem -exists $whichItem` ) {
			int $newState = `menuItem -q -cb $whichItem`;
********		setState $name $newState;
		}

	}
}


Kevin "Father of the DG" Picott

Senior Principal Engineer
0 Likes