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

Reply via email to