I don't think this is pretty, but this works:

cmds.keyframe(time=(50,(cmds.findKeyframe(which='last'))), relative=1,
timeChange=1, option="over")

This could look a little better:

def endKey():
    return cmds.findKeyframe(which='last')
def firstKey():
    return cmds.findKeyframe(which='first')

cmds.keyframe(time=(50,endKey()), relative=1, timeChange=1, option="over")

cmds.keyframe(time=(firstKey(),50), relative=1, timeChange=1, option="over")



On Mon, Jun 8, 2009 at 8:02 PM, chadrik <[email protected]> wrote:

> if that's the best we can do, then i definitely consider this a bug.  one
> or both of these two should be made to work:
>
> cmds.keyframe(time=(50,), relative=1, timeChange=1, option="over")
> cmds.keyframe(time=(50,None), relative=1, timeChange=1, option="over")
>
>
> and perhaps even:
>
> cmds.keyframe(time=slice(50), relative=1, timeChange=1, option="over")
>
>
>
> -chad
>
>
> On Jun 8, 2009, at 4:58 PM, John Creson wrote:
>
> Checked out the docs, it's looking for a tuple, the tricky bit is working
> out how to give it a number that means "till the end of time"
>
> cmds.keyframe(time=(50,10000), relative=1, timeChange=1,option="over")
>
>
>
> On Mon, Jun 8, 2009 at 6:34 PM, Chadrik <[email protected]> wrote:
>
>>
>> i saw this post over at cgtalk and was surprised to find the answer so
>> elusive: http://forums.cgsociety.org/showthread.php?f=89&t=772302
>>
>> here's the post:
>> ---------------------------------------
>> I am trying to convert this mel code to python but I can't get the
>> time attribute working properly.
>> mel:
>>
>>   keyframe -time "50:" -relative -timeChange 1 -option over;
>>
>>
>> I tried this python equivalent:
>>
>>    cmds.keyframe(time=(50:), relative=1, timeChange=1,
>> option="over")
>>    # TypeError: Invalid arguments for flag 'time'. Expected (time,
>> [time]), got int #
>>
>>
>> I also tried with quotes, without quotes, with a comma, without a
>> comma, etc. The only time i get the python equivalent working is if i
>> set a timeRange to time=(startInt,endInt) i would like to specify time=
>> (startInt, *onward*)
>>
>>
>> --------end---------
>>
>> i was very surprised to find that neither of these worked:
>>
>> cmds.keyframe(time=(50,), relative=1, timeChange=1, option="over")
>> cmds.keyframe(time=(50,None), relative=1, timeChange=1, option="over")
>>
>> i tested this in 2009
>>
>> -chad
>>
>>
>>
>>
>
>
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

Reply via email to