I have a locator constrained to a controller in which the constrained channels are mainly the translate and rotate.
Initially, I tried to bake out these channels over a frame range as follows:
frames = range(1,10)
for frame in sorted(frames):
# this loops through frame range and sets existing keys from original control
cmds.currentTime(frame)
for locator in locators:
cmds.setKeyframe(locator, attribute = 'translate', time = (frame, ) )
cmds.setKeyframe(locator, attribute = 'rotate', time = (frame, ) )
for loc_constraint in locator_constraints:
cmds.delete(loc_constraint)
However the above method would cause the timeline to always be transversing should I have more than 1 locators.
Then I chanced upon `cmds.bakeResults` in which this allows me to bypass the tranversing.
for locator in locators:
cmds.bakeResults(locator, time=(start_frame, end_frame))
for loc_constraint in locator_constraints:
cmds.delete(loc_constraint)
While the latter method seems to works very well for me, where it seems to bake out only the constrained values (eg. scale channels are not part of the baking), is this a 'safe' approach? I was given the impression that if you not specify the attributes, it will baked all the attributes?
If not, should I make it as a good practice to make use of the `attribute`flag within `bakeResults` and explicitly specify the channels?
I asked this as I am not sure of `bakeResults` behavior.