in python time is required as a start and end time keyt = (keytimes[0], keytimes[0]) cmds.keyframe('nurbsSphere1_translateX', time = keyt, query = True, valueChange = True)
On Tue, Apr 10, 2012 at 11:15 AM, Besjan Xhika <mayan...@gmail.com> wrote: > Hi, I'm studying Maya programming.. > and got around this error while trying to convert a MEL script to a Python > script.. > > MEL > > float $keytimes[]; > $keytimes = `keyframe -query -timeChange nurbsSphere1_translateX`; > // Result: 1 48 // > $keyt = $keytimes[0]; > // Result: 1 // > keyframe -time $keyt -query -valueChange nurbsSphere1_translateX; > // Result: -5.321007 // > > nurbsSphere1_translateX is an animation curve.. > // Result: 1 48 // are two frames that have keys.. > > In MEL works OK. > ************************************************** > Python > > keytimes = cmds.keyframe('nurbsSphere1_translateX', query = True, > timeChange = True) > > # Result: [1.0, 48.0] # > > keyt = keytimes[0] > > # Result: 1.0 # > > cmds.keyframe('nurbsSphere1_translateX', time = keyt, query = True, > valueChange = True) > > # Error: TypeError: file <maya console> line 1: Invalid arguments for flag > 'time'. Expected (time, [time]), got float # > > > In Python doesn't work.. > > So $keyt = 1 and keyt = 1.0 should be the same (floats).. > > While in MEL is accepting a float for time (maybe is being converted > automatically, or something..), in Python is not.. > > Anyone got any idea? > > -- > view archives: http://groups.google.com/group/python_inside_maya > change your subscription settings: > http://groups.google.com/group/python_inside_maya/subscribe > -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe