View Full Version : Query attribute value...??
futurcraft 09-23-2006, 06:20 AM Hi....
I have another problem.... in my stretchy rig i wanna query the initial distance between two joints & use that for my expression calculations.. but since this initial distance changes when the limb is stretched, I wanna find a way where I can query this initial distance value in my script n use it in my expression before the same distance value changes once the limb is stretched...
I am kinda stuck here... can anybody help out..??
Thanks,
Regards,
Nikhil.
|
|
_stev_
09-23-2006, 06:51 AM
I'm not completely sure what you want here. Are you trying to create an expression with a script? Or are you just wanting to know how to create the expression.
To make the expressions with MEL use the "expression" command.
_stev_
09-23-2006, 06:58 AM
Can you create a custom attribute that stores this inital value? Then query that custom attr.
futurcraft
09-23-2006, 06:58 AM
Hi Stev,
Well I want to call an already created expression (with the -ae flag set to zero initially) in the middle of my script to execute it when one of my rig controls is translated... and I am also having trouble in jus accessing a simple translateX value of my control shape into my "for loop" condition.. I get an error saying invalid use of Maya object.
here is the code..
expression -s "L_A_FootCtrl_1.translateX= 10;" -o L_A_FootCtrl_1 -n "stretchExp" -ae 0 -uc all ;
for (L_A_FootCtrl_1.scaleX> 10)
{
stretchExp;
}
any solution..??
Thanks,
Nikhil.
futurcraft
09-23-2006, 07:02 AM
goin by this script, what i wanna do is.. that when I scale the control beyond a particular value.. I want to then translate it in space... so I need to query the scale attribute... and then change the translate attribute of the same control with the expression
_stev_
09-23-2006, 07:10 AM
I don't think you can use the control attribute like that in a for statement. Try using the getAttr command to assign it to a variable, then use the variable.
float $ctrlScale = `getAttr L_A_FootCtrl_1.sx`;
futurcraft
09-23-2006, 07:32 AM
I modified the expression and changed the for loop into an if condition.. but before me even changing my custom stretch attribute, the expression is executed...
do I have to set the node state of the expression to zero and then enable it within the condition?? and after the execution of the expression maybe again reset the node state back to zero again??
expression -s "L_A_FootCtrl_1.translateX= 10;" -o L_A_FootCtrl_1 -n "stretchExp" -ae 0 -uc all ;
float $ctrlScale = `getAttr L_A_StretchyFootCtrl_1.stretch`;
if ($ctrlScale > 5)
{
stretchExp;
}
_stev_
09-23-2006, 07:47 AM
Maybe you don't need an expression here. You could just manipulate it with the script.
futurcraft
09-23-2006, 07:54 AM
well.. this is jus a sample test expression.. my actual expression is what I am using for the stretchy control of my rig.. where I have an expression driving the scale attributes of my joints based on the output values of the distance between node..
so I actually require an expression to drive the scale.... basically the purpose being... calling an expression to be executed within a script.. I dont want my expression to be executed by default.. but only when called to be executed by the script when a condition is satisfied......
right now.. the expression is gettin executed by default...
is there any way I can control this...??
_stev_
09-23-2006, 07:59 AM
You could put the condition statement in the expression.
futurcraft
09-23-2006, 08:55 AM
Hey Stev..!!
thanks for the trick...! It worked... n by the way.... I saw ur reel... I must say tht u've done an awesome job in rigging those characters... did u use a rigid bind for the dynamic truck in ur reel...?? I mean.. the truck kinda deforms as it crashes... so I presume u used dynamic joint chains to react to the wall which was a rigid body...?
thanks...
tc...
_stev_
09-23-2006, 09:10 AM
Glad you got it working.
Thanks for the nice words about my reel.
The truck's dynamics where all done with rigid bodies. A set for the shocks and for the hood. The mesh of the truck for the hood was bound to joints. And the joints were driven by the rigid bodies for the hood.
Lata,
Stev
futurcraft
09-23-2006, 04:22 PM
Hey Stev..!!
thts a really good way of doin it..! I really loved the way u combined real world physics in tht simulation.. thanks anywayz..
tc,
Nikhil.
CGTalk Moderation
09-23-2006, 04:22 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.