Using the keyframe command doesn't seem too verbose or less code friendly
to me. It feels like you have a lot of control over what you are changing,
versus having to format a string in setAttr:

timeVar = 2
crv = 'pSphere1_translateX'
mc.keyframe(crv, e=True, index=(0,), o="over", tc=timeVar)

​
Does this not work for your needs?


On Mon, Apr 6, 2015 at 4:03 AM Eduardo Grana <[email protected]>
wrote:

> Hello Guys,
>
> Just a simple question.
> I'm trying to set the time for a keyframe with
> setAttr since i'm exporting and importing some curva data,
> and with keyframe is a little more verbose and less code friendly
> (for example keyframe -option over -index 0 -absolute -timeChange 2
> pSphere1_translateX ;)
>
> So I'm running into this error when i do
> timeVar = 0
> crv = 'pSphere1_translateX'
> mc.setAttr(crv+'.keyTimeValue[0].keyTime', timeVar)
> # RuntimeError: Maya command error #
>
> and maybe you guys can give me some tip about whats going on.
> Here is the simple code for you to test:
>
> http://pastebin.com/uyasZfmg
>
> Thanks is advance.
> Cheers!
>
> --
> Eduardo Graña
> www.eduardograna.com.ar
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/CACt6GrkG_Eupz%3DAoi5%3Dp5a90jQF1pxXZmS9hZAa42qtSwK%3DnnA%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CACt6GrkG_Eupz%3DAoi5%3Dp5a90jQF1pxXZmS9hZAa42qtSwK%3DnnA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2EEKsfj2G9Fvf%3Dpb2jWfyVYrcOkHQeaK0fTyB-fKKkAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to