Hey Justin, Thanks for the reply. Yes, I ended up doing some command call like that, but i was very curious about what was the 'Maya command error' about, and how to set that 'time' attribute.
Another thing that i noticed, is that you get different data depending how you query, for example import maya.cmds as mc # createa a sphere and set a keyframe sphere = mc.polySphere()[0] mc.setAttr(sphere+'.r', 17,17,17) mc.setKeyframe() # get animation curve crv = mc.listConnections(sphere+'.ry')[0] # rotation curve this time # query values for key 0 time0, value0 = mc.getAttr(crv+'.keyTimeValue[0]')[0] value1 = mc.getAttr(crv+'.keyTimeValue[0].keyValue') # same keyframe as before print value0, value1, value0 == value1 # value0 is in radians and value1 is in degrees >>> 0.296705972839 17.0 False So if you want the values that you see in the graph editor, you have to be careful how you query. Cheers! Eduardo On Mon, Apr 6, 2015 at 9:05 PM, Justin Israel <[email protected]> wrote: > 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 > <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2EEKsfj2G9Fvf%3Dpb2jWfyVYrcOkHQeaK0fTyB-fKKkAg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CACt6Grkh-RvXUZDeZFyrWQ13BOidxZUNb6hszHgxRJO%3DtF2sKg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
