vrw
vrw

Reputation: 1

How to use timerange in Maya for a single frame?

I am trying to write a python script on Maya and I want to bake only one single frame.

import maya.cmds as cmds

cmds.bakeResults( obj, time=(1,1) ) # want to bake only frame 1

There is an error like this

Error: RuntimeError: Both start time AND end time need to be specified #

Tried these

time=(1,)
time=1
time="1"
time=("1","1")

Still doesn't work. Also, in the Maya bakeResults documentation, it said that See the code examples below on how to format for a single frame or frame ranges. But no code example that includes single frame.

Upvotes: 0

Views: 650

Answers (1)

Trisfae
Trisfae

Reputation: 21

You could bake over a range of 1 and delete the 2nd key that's baked down if you absolutely needed to get rid of the second key. That time flag won't accept anything but a tuple, so you need to provide at least two values, a start and end time that don't equal to each other.

import maya.cmds as cmds
obj = cmds.ls(sl=True)
cmds.bakeResults(obj, time = (1,2))
cmds.cutKey(obj, time = (2,3), clear = True)

Upvotes: 1

Related Questions