autoLegSetup halt!

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  12 December 2007
autoLegSetup halt!

umm, so I searched and searched and im finally aggravated enough to post and ask for help.
this is probably a stupid question, as im learning mel and this is my first macro.
Im writing an automatic leg setup that has ik/fk switch, no flip knee (cgtk style), reverse foot, and stretchyness. This is where im getting stopped:

////////////////////////////////////		  No Flip Knee		  /////////////////////////////////////////////////////////	  
					
					
		//Create Ik handles 
		select -r ("Ankle.rotatePivot") ;
		select -add ("Ball.rotatePivot") ;
		ikHandle -n ("BallIk") -sol ikSCsolver -s 0;
		
		select -r ("Ball.rotatePivot") ;
		select -add ("Toe.rotatePivot") ;
		ikHandle -n ("ToeIk") -sol ikSCsolver -s 0;
		
		select -r ("Hip.rotatePivot") ;
		select -add ("Ankle.rotatePivot") ;
		ikHandle -n ("LegIk") -sol ikRPsolver -s 0;
		setAttr ("LegIk.stickiness") 1;
		setAttr ("LegIk.poleVectorX") .1;
		setAttr ("LegIk.poleVectorY") 0;
		setAttr ("LegIk.poleVectorZ") 0;
		setAttr ("LegIk.twist") 90;

		//Create plus/minus average node 
		shadingNode -asUtility plusMinusAverage;

		//connect knee attr to +/- input 1D[0]
		select -r ("footControl")
	 
		connectAttr -force ("footControl.knee") ("plusMinusAverage1.input1D[0]");
		
		//connect offset attr to +/- input 1D[1]
		connectAttr -force ("footControl.offset") (" plusMinusAverage1.input1D[1]");
		
		//connect output 1D to IK twist attr
		connectAttr -force ("plusMinusAverage1.output1D") ("LegIk.twist") 
	 
		//change offset to 90, lock and hide
		setAttr ("footControl.offset") 90;
		setAttr -lock true -keyable false ("footControl.offset");
		
		//parent Constrain IK's to foot control
		
		select -r ("footControl") ;
		select -tgl ("LegIk") ;
		parentConstraint -mo -weight 1;

		select -r ("footControl") ;
		select -tgl ("BallIk") ;
		parentConstraint -mo -weight 1;

		select -r ("footControl") ;
		select -tgl ("ToeIk") ;
		parentConstraint -mo -weight 1;
	  



Instead of being helpful, maya selects the plusMinusAverage node and spits out
// Error: No object matches name: connectAttr
Maybe that is helpful, i ain't gettin' it.
__________________
3drosekrans.net

It is our duty to transcend words and images in order to encounter REALITY
 
  12 December 2007
////////////////////////////////////		  No Flip Knee		  /////////////////////////////////////////////////////////	  
   					
   					
   		//Create Ik handles 
   		select -r ("Ankle.rotatePivot") ;
   		select -add ("Ball.rotatePivot") ;
   		ikHandle -n ("BallIk") -sol ikSCsolver -s 0;
   		
   		select -r ("Ball.rotatePivot") ;
   		select -add ("Toe.rotatePivot") ;
   		ikHandle -n ("ToeIk") -sol ikSCsolver -s 0;
   		
   		select -r ("Hip.rotatePivot") ;
   		select -add ("Ankle.rotatePivot") ;
   		ikHandle -n ("LegIk") -sol ikRPsolver -s 0;
   		setAttr ("LegIk.stickiness") 1;
   		setAttr ("LegIk.poleVectorX") .1;
   		setAttr ("LegIk.poleVectorY") 0;
   		setAttr ("LegIk.poleVectorZ") 0;
   		setAttr ("LegIk.twist") 90;
   
   		//Create plus/minus average node 
   		shadingNode -asUtility plusMinusAverage;
   
   		//connect knee attr to +/- input 1D[0]
   		select -r ("footControl") ;
   	 
   		connectAttr -force ("footControl.knee") ("plusMinusAverage1.input1D[0]");
   		
   		//connect offset attr to +/- input 1D[1]
   		connectAttr -force ("footControl.offset") (" plusMinusAverage1.input1D[1]");
   		
   		//connect output 1D to IK twist attr
   	    connectAttr -force ("plusMinusAverage1.output1D") ("LegIk.twist") ;
   	 
   		//change offset to 90, lock and hide
   		setAttr ("footControl.offset") 90;
   		setAttr -lock true -keyable false ("footControl.offset");
   		
   		//parent Constrain IK's to foot control
   		
   		select -r ("footControl") ;
   		select -tgl ("LegIk") ;
   		parentConstraint -mo -weight 1;
   
   		select -r ("footControl") ;
   		select -tgl ("BallIk") ;
   		parentConstraint -mo -weight 1;
   
   		select -r ("footControl") ;
   		select -tgl ("ToeIk") ;
   		parentConstraint -mo -weight 1;
   	  



i think that's simply some syntax errors. from my experience, if maya said "No object matches name: blablabla", it's usually because i forgot to put ';' after a statement or '$' in front of a variable.

Last edited by r4inm4ker : 12 December 2007 at 06:16 AM.
 
  12 December 2007
I know how much writing an auto rgging script can be frustrating. One of the problems is trying to come up with all the senarios you may run into and try to accomodate it.

Just a few suggestions that may help you in building your script.
Q: How can I figure out which side I'm working on and name my controls accordingly
A: Based off what is selected, determine which world X axis are you on. If you are on the neg side then you are on the characters "Left" and so on for the right. Simple way to test for this and prefix your controls with either "L_"or "R_". This could also affect settings you have (maybe twist values?).

You don't need to have your script select a control to connect it.
So here is something you can do:

  string $side = "L_";
  string $control = "footControl";
  $control = ($side + $control);
  //Create this based off of what side and control you are using and pass that 
  //variable around
  string $plusMinus = `shading -asUtility plusMinusAverage ($control + "_PM)`;
  connectAttr -f ($control + " .knee") ($plusMinus + ".input1D[0]");
  

So by passing the variables around it makes it more modular, cleaner and less hard-coded elements that make it hard to expand your code for anything else down the line you may want to add in the mix.

Keep it up and happy holidays

-Sean
__________________
===============
snolan.net

 
  12 December 2007
maya doesn't really help you with those error messages. when i can't find the problem i often outcomment: /* ... */ some parts where i assume the problem and run the script. if the error disappears i reactivate some of the outcommented parts and again try the script until the error occurs. with this i can find the error quite quickly
 
  12 December 2007
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 08:55 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.