Export single take via python

Export single take via python

dust_bin
Community Visitor Community Visitor
302 Views
1 Reply
Message 1 of 2

Export single take via python

dust_bin
Community Visitor
Community Visitor

Is there any way to export single take of animation (only selected objects) via Python in Motionbuilder 2025 without hassle?

0 Likes
303 Views
1 Reply
Reply (1)
Message 2 of 2

Ndgt
Enthusiast
Enthusiast

Hi, @dust_bin 

 

You can export a single take of animations for the selected objects using the following script:

"""
Export Single take of animations with selected objects
"""

# Prepare FB components
app = FBApplication()
ex_options = FBMotionFileExportOptions(app.FBXFileName)

# Get current take index
ex_take_count = 0
for take in FBSystem().Scene.Takes:
    if take.Name == FBSystem().CurrentTake.Name:
        break
    ex_take_count += 1

# Configure export options
ex_options.OneTakePerFile = True
ex_options.ModelSelection = FBModelSelection.kFBSelectedModels
ex_options.FileCreation = FBFileCreation.kFBOverwrite

for i in range(ex_options.GetTakeCount()):
    if i == ex_take_index:
        ex_options.SetTakeSelect(i, True)
    else:
        ex_options.SetTakeSelect(i, False)
        
# File Export
app.FileExportWithOptions(ex_options)

 

Before running this script, make sure to select the target take and the models you wish to export.

Please note that the exported animations will be stored in Null objects that share the same names as the original models.

 

Kind Regards,

0 Likes