I think the setDrivenKeyframe command in mel is a bit flexible like that -
there are arguments for attribute but it also lets you pass the whole
node+attribute as an object to the command. The python command might be a
little less flexible? while I doubt it, I know for a fact that the following
form works. In script, I also tend to avoid using commands like rotate as
they get a bit redundant when you can pass appropriate values to the
commands you want without modifying your scene.

cube = mc.polyCube()[0]
circle = mc.circle()[0]
mc.addAttr(circle,ln='Roll',at='double',min=0,max=10,dv=0,k=1) #note the
k=1, makes the next setAttr line redundant.
mc.setDrivenKeyframe(cube,at='rotateX',cd=circle+'.Roll',dv=0,v=0) #by
specifying 'driverValue' and 'value' we dont need to modify/
mc.setDrivenKeyframe(cube,at='rotateX',cd=circle+'.Roll',dv=10,v=90) #the
objects' attributes the way you would in the GUI.

2009/12/17 Vitor Lôbo Ramos <[email protected]>

> Good night
> I'm having trouble making a setdriven key in python.
> Well out, what I'm wanting is something very much like this:
>
>
> addAttr -ln "Roll"  -at double  -min 0 -max 10 -dv 0 |nurbsCircle1;
> setAttr -e-keyable true |nurbsCircle1.Roll;
> setDrivenKeyframe -currentDriver nurbsCircle1.Roll pCube1.rotateX;
> setAttr "nurbsCircle1.Roll" 10;
> rotate -r -os 90 ;
> setDrivenKeyframe -currentDriver nurbsCircle1.Roll pCube1.rotateX;
>
> python would that be?
>
> Are 2 objects. A circle and a cube.
> In the circle, I create an attribute value to float default 0, min 0,
> max 10. Therefore, I create a key Setdriven between the circle and the
> cube. where the value 10, the cube rotates in the X axis 90 degrees.
>
> I'm having a little difficulty in building the code.
>
>
>
>
> --
> http://groups.google.com/group/python_inside_maya

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to