Maya - bakeResults() - not baking as well as the menu "Bake Simulation" command

Heya all,

So this may seem like a silly question but I have been going round the bend with a trivial issue. I have a bakeResults command built into an animation export tool and it works… except it will skip bones that don’t necissarily have any motion/keys on them. This would usually be a great thing - less key-frames the better… but I sort of need all of the passed bones/transforms to have some keys on them. Unity tends to give bad results with top level transforms, or transforms without children (weapon or props parents) that don’t have a key in at least translation (I have found - any suggestions from you guys would be great on this topic also).
However… if I select some transform channels on the same set of bones in Maya and then do the Edit->Keys->Bake Simulation and set the same kind of flags as I am in code, then it will actually work as intended, putting a key on all channels that I have selected for the duration of the timeline.

Here is the code snippet (very trivial and straight forward):

def BakeBakeBones(bones=None):
    """
    @summary: Bake the passed bone list. We are only interested in baking transform and rotation values, no scale values will be baked
    Args:
    @keyword bones: (list of PyNode Maya transform) = Any transform that object that can have values baked in tx, ty, tz, rx, ry, rz channels
    @return: None
    """
    
    if bones is not None:
        pmc.general.refresh(suspend=True)
        pmc.bakeResults(bones, t=(pmc.playbackOptions(animationStartTime=True, query=True), pmc.playbackOptions(animationEndTime=True, query=True)), at=['tx', 'ty', 'tz', 'rx', 'ry', 'rz'], simulation=True, smart=False, disableImplicitControl=True, preserveOutsideKeys=False, sparseAnimCurveBake=False, removeBakedAttributeFromLayer=False, removeBakedAnimFromLayer=False, bakeOnOverrideLayer=False, minimizeRotation=True, sampleBy=1.0)
        pmc.general.refresh(suspend=False)

don’t laugh at the name of the procedure :slight_smile: … was a typo that just stuck and it makes me smile.

Sheepishly tucks head into chest…

So I found the issue - sorry to waste peoples reading time. Apparently someone (who will remain nameless) used delete([bones], staticChannels=True) and buried it deep in the rest of the tool.
My bad… very sorry.
In German they have a term for this kind of screw-up - “Close the Lid, the monkey is dead”

Enjoy your day.
D.