Question on bakeResults

38 views
Skip to first unread message

kiteh

unread,
Oct 16, 2019, 6:43:43 PM10/16/19
to Python Programming for Autodesk Maya
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.

Marcus Ottosson

unread,
Oct 17, 2019, 1:34:12 AM10/17/19
to python_in...@googlegroups.com
Not sure what the question is, but here is the documentation for [cmds.bakeResults](http://help.autodesk.com/cloudhelp/2018/ENU/Maya-Tech-Docs/CommandsPython/bakeResults.html)

--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/64e3741c-3375-4eac-8721-6a07e9eebb80%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages