Home Technical Talk

Speeding up animation baking when using bakeResults command

salik
null
Offline / Send Message
salik null

Hi all,

 

I am using Maya 2017, scripting up a code that will perform mass animation baking via from a list of controllers.

The process is as follows:

  • Perform a parentConstraint towards all controllers/ selections from the Rig that I want to constraint to
  • Use `cmds.bakeResults()` to bake out the constraints' values
  • Delete those constraints.

This is the code portion for my `bakeResults` command (Only targetting at translate and rotation channels):

cmds.bakeResults(
        (selAttrs if attr_names else selection), # This will returns <controller name>.translateX etc.
        hierarchy='both',
        preserveOutsideKeys=True,
        simulation=True,
        time=(frame_range[0], frame_range[1]),
    )

My selections amounts to about 165 controllers, each with varying visible attributes (translate, rotate, or custom attributes) and it takes about 20 seconds in the baking process.

 

I have tried using the following:

current_eval_mode = cmds.evaluationManager(query=True, mode=True)[0]
if not current_eval_mode == "off":
    cmds.evaluationManager(mode="off")
cmds.refresh(suspend=True)

panelFocus = cmds.getPanel(withFocus=True)
visPanels = cmds.getPanel(visiblePanels=True)
modelPanels = cmds.getPanel(type="modelPanel")
if modelPanels:
    for pan in modelPanels:
        finder = pan in visPanels
        if finder:
            activePanel = pan
    cmds.setFocus(activePanel)
    cmds.scriptedPanel("referenceEditorPanel1", edit=True, replacePanel=activePanel)


In which it does not seems to have help much in any speed gain.

Wondering if anyone has any other tricks on their sleeves for me to try out with? Or is this the supposed Maya action

Sign In or Register to comment.