[Maya-Python] relative atribute ( getAttr ) in Set driven key value

218 views
Skip to first unread message

Vitor Lôbo Ramos

unread,
Apr 21, 2010, 1:09:32 AM4/21/10
to python_inside_maya, vitaumm...@gmail.com
Hi Guys!

So, my debout is ...how to apply a relative value (getAttr ) to SDK ?
( set driven key )

Exemple:

rhandc = "r_arm_control"
rix3 = "r_index3"

cmds.addAttr(rhandc,ln='index',at='double',min=0,max=0,dv=0,k=1)
cmds.setAttr('r_arm_control.index',lock= True)
cmds.addAttr(rhandc,ln='index3',at='double',min=-90,max=90,dv=0,k=1)
cmds.setDrivenKeyframe(rix3,at='rotateZ',cd=rhandc+'.index3',dv=0,v=0)
cmds.setDrivenKeyframe(rix3,at='rotateZ',cd=rhandc
+'.index3',dv=90,v=-90)
cmds.setDrivenKeyframe(rix3,at='rotateZ',cd=rhandc
+'.index3',dv=-90,v=90)

With this configuration, if one joint is driven with a different value
of dv = 0, the Code is implemented, the joint returns to zero.
How to make the value dv = 0 on? If my joint is in a starting position
for example, (dv = 90), and my SDK is dv = 0, how to stay on the SDK
at a value relative?

------------------------------------------------------------------------------------------------------------------------------------------------------------------
I tested the following example:

rhandc = "r_arm_control"
rix3 = "r_index3"

cmds.addAttr(rhandc,ln='index',at='double',min=0,max=0,dv=0,k=1)
cmds.setAttr('r_arm_control.index',lock= True)
cmds.addAttr(rhandc,ln='index3',at='double',min=-90,max=90,dv=0,k=1)
defaultRotateZ = cmds.getAttr(handc+'.index3')
cmds.setDrivenKeyframe(rix3,at='rotateZ',cd=rhandc
+'.index3',dv=0,v=defaultRotateZ)
cmds.setDrivenKeyframe(rix3,at='rotateZ',cd=rhandc
+'.index3',dv=90,v=defaultRotateZ-90)
cmds.setDrivenKeyframe(rix3,at='rotateZ',cd=rhandc
+'.index3',dv=-90,v=defaultRotateZ+90)

But, DV value remains zero. So if you are in my Joint dv = 90, How
applied the code to make it stay at 90?

----------------------------------------------------------------------------------------------------------------------------------------------------------

--
http://groups.google.com/group/python_inside_maya
Reply all
Reply to author
Forward
0 new messages