Access Bake Objects (Timeline) or Bake Animation to Curves



  • Hi,

    I'm trying bake my animation into curves, currently, they are either driven by procedural animation (e.g. vibrate tag) or by a PSR tag.

    However, I don't see any details about the baking option in the documentation. It's either BakeTexture or BakeWeights. Same goes with the topics here in the forum.

    There is a thread about baking curves here. I appreciate the recreation of the code for the baking procedure, but I just need to just access the bake texture dialog box, so I can save myself from debugging.

    You can see what I am trying to access here:
    https://www.dropbox.com/s/yn0fb49p290veut/c4d126_access_bake_object_python.png?dl=0

    Is there a way around this?

    Thank you for looking at my problem.



  • Hi @bentraje,

    The thread about baking curves is still the right way to go if you want to be exact and want to bake other properties than PSR.

    However, if you're just interested in baking only your PSR, you can use doc.Record(), this works on all selected Objects since R19. You can take a look at the following example for baking Cubes with a Vibrate-Tag for example...:

    import c4d
    
    #https://developers.maxon.net/docs/Cinema4DPythonSDK/html/modules/c4d.documents/BaseDocument/index.html?highlight=executepasses#BaseDocument.ExecutePasses
    def SetCurrentTime(currentTime, doc):
        doc.SetTime(currentTime)
        doc.ExecutePasses(None, True, True, False, 0)    
    
    def main():
        minTime = doc[c4d.DOCUMENT_MINTIME]
        maxTime = doc[c4d.DOCUMENT_MAXTIME]
        fps = doc.GetFps()
        
        if minTime != maxTime:
            currentTime = minTime
            while (currentTime <= maxTime): 
                SetCurrentTime(currentTime, doc)
                print "Baking: Frame: %s" %(currentTime.GetFrame(fps))
                
                #New since version R19.
                #Records the active objects in the document.
                doc.Record()
                
                currentTime += c4d.BaseTime(1, fps)
    
    if __name__=='__main__':
        main()
    

    Oh, and accessing the "Bake Objects..." Dialog via Python is not possible!



  • Hi @bentraje,

    Actually, this is not possible as @lasselauch demonstrate you, the only way is to do it manually.

    Cheers,
    Maxime.



  • @lasselauch

    I guess I need to revisit the script in the link above when I need to bake user data. Anyway, your script will do at the moment. It's readable enough for my newbie eyes :) It works as I expected!

    Thanks for the handy script.

    @m_adam

    Thanks for the confirmation!


Log in to reply