after you defined the function, did you call it?
def foo()
cmds.someJunk()
foo() #<------ call the function
On Dec 21, 2009, at 12:45 AM, Vitor Lôbo Ramos wrote:
> 1 -) There is no error. But there is no action, function.
> 2 -) Noting that "obj" in this case is only a prefix
> 3 -) I tried to use commonly without controler = b1, b2 = obj (but
> does not work) when you create a ref.
>
> The intention here is just create a setdrivenkey between 2 objects.
> Example: Driver and Control, Obj is Driven. I move the Controller
> translateX 20, and move the obj translateX -20. With that, I key.
>
> Exemple:
>
> import maya.cmds as cmds
>
> cmds.setDrivenKeyframe( 'obj.tx', cd='controler.tx', dv=0,v=0 ) # work
> cmds.setDrivenKeyframe( 'obj.tx', cd='controler.tx', dv=20,v=-20 )#
> work
> cmds.setDrivenKeyframe( 'obj.tx', cd='controler.tx', dv=-20,v=20 )
> #work
>
>
> Using a: def rtest ():
>
> cmds.setDrivenKeyframe( 'obj.tx', cd='controler.tx', dv=0,v=0 ) #
> not work
> cmds.setDrivenKeyframe( 'obj.tx', cd='controler.tx', dv=20,v=-20 )
> # not work
> cmds.setDrivenKeyframe( 'obj.tx', cd='controler.tx', dv=-20,v=20 )
> # not work
>
> the above methods also did not work .... what am I doing wrong?
>
> Another method tested:
>
> b1 = controler
> b2 = obj
>
> cmds.setDrivenKeyframe(b2,at='translateX', cd=b1, dv=0,v=0 ) # not
> work
>
>
>
> On Dec 21, 1:47 am, Paul Molodowitch <[email protected]> wrote:
>> Some questions:
>>
>> 1) What's the error you get?
>> 2) Where are controler and obj defined?
>> 3) What's the point of having b1 and b2, anyway? Why not just use controler
>> and obj?
>>
>> - Paul
>>
>> 2009/12/20 Vitor Lôbo Ramos <[email protected]>
>>
>>> Correcting:
>>
>>> cmds.setDrivenKeyframe( 'name1.ty', cd='name2.ty', dv=0,v=0 ) #
>>> functional
>>
>>> # But, with def
>>
>>> .......
>>
>>> When I try to organize in def, no functionality
>>
>>> On Dec 20, 7:03 pm, Vitor Lôbo Ramos <[email protected]>
>>> wrote:
>>>> For some strange reason, yet, not funcina.
>>>> The code below works perfectly without (def name ()).
>>>> Now does not work. Why?
>>
>>>> cmds.setDrivenKeyframe( 'b2.ty', cd='b1.ty', dv=0,v=0 ) # functional
>>
>>>> #But, with def
>>
>>>> def teste():
>>
>>>> b1 = controler
>>>> b2 = obj
>>
>>>> cmds.setDrivenKeyframe( b2 + '.tx', cd=b1+'.tx', dv=0,v=0 ) # not
>>>> work
>>>> cmds.setDrivenKeyframe( '%s.tx' % b2, cd=('%s.tx' % b1), dv=0,v=0 )
>>>> # not work
>>>> cmds.setDrivenKeyframe( 'b2.tx', cd='b1.tx', dv=20,v=-20 ) # not
>>>> work
>>
>>>> On Dec 20, 6:48 pm, Paul Molodowitch <[email protected]> wrote:
>>
>>>>>> def tmirror():
>>
>>>>>> b1 = controler
>>>>>> b2 = obj
>>
>>>>>> cmds.setDrivenKeyframe( 'b2.tx', cd='b1.tx', dv=0,v=0 )
>>>>>> cmds.setDrivenKeyframe( 'b2.tx', cd='b1.tx', dv=20,v=-20 )
>>>>>> cmds.setDrivenKeyframe( 'b2.tx', cd='b1.tx', dv=-20,v=20 )
>>
>>>>> Using the commands as you've given them, maya is looking for objects
>>> whose
>>>>> NAMES are 'b1' and 'b2'. Your variables b1 and b2 are never even used.
>>
>>>>> You'd need to do something like this:
>>
>>>>> cmds.setDrivenKeyframe( b2 + '.tx', cd=b1+'.tx', dv=0,v=0 )
>>
>>>>> or, equivalently:
>>
>>>>> cmds.setDrivenKeyframe( '%s.tx' % b2, cd=('%s.tx' % b1), dv=0,v=0 )
>>
>>>>> (I'm assuming that the rest of your syntax here is correct... I haven't
>>>>> bothered to check it.)
>>
>>>>> - Paul
>>
>>>>>> What am I doing wrong?
>>
>>>>>> I want to create a simple setdrivenkey where the motion controls in
>>>>>> positions x, y, z, and this monitor.
>>
>>>>>> --
>>>>>> http://groups.google.com/group/python_inside_maya
>>
>>> --
>>> http://groups.google.com/group/python_inside_maya
>
> --
> http://groups.google.com/group/python_inside_maya
--
http://groups.google.com/group/python_inside_maya