bakeResults not actually baking

I’m attempting to bake a key per frame on a hierarchy in Maya 2017 using pymel. The process is lengthy (this was specifically requested) and involves,

  1. duplicating the hierarchy
  2. constraining duplicate to the original referenced hierarchy
  3. baking the duplicate
  4. deleting parentConstraints

When I reach the baking part I can’t seem to bake a key per frame. I get sparse keyframes. It’s important to note that if I do this step manually I do get the proper result (a keyframe per frame).

Here’s the command being used:

pm.bakeResults(srcRoot, t=startEndRange, hierarchy='below', at=channels,
                   simulation=True, smart=False,
                   disableImplicitControl=True, preserveOutsideKeys=False, sparseAnimCurveBake=False,
                   removeBakedAttributeFromLayer=False, removeBakedAnimFromLayer=False, bakeOnOverrideLayer=False,
                   minimizeRotation=True, sampleBy=1.0)

Also to note is that I’m duplicating a bind skeleton, which is being driven by a control rig - both included in the reference.

I’m relatively new to pymel. I thought sparseAnimCurveBake flag was meant for frame by frame baking…

Your setup sounds exactly like ours.
These are the flags we pass to bakeResults, it’s always worked well for us.

pm.bakeResults(channels,
               hierarchy='none',
               time=(pm.env.minTime, pm.env.maxTime),
               sampleBy=1,
               disableImplicitControl=True,
               bakeOnOverrideLayer=False,
               removeBakedAttributeFromLayer=False,
               sparseAnimCurveBake=False,
               preserveOutsideKeys=True,
               simulation=True,
               )

After comparing with working versions and testing each flag, turns out that if you include the smart flag, regardless of whether true or false, it will not bake correctly.

Well that is downright freaky.

And also not very smart.