Hi,
Couple of things you will need....
- SetTakeDestinationName - to change the take name using "As Take..." - I know, I though it would be "SetTakeName", but this changes the name in the "Takes" column?!?!
- OnFileMerge - This allows you to perform operations in the Merge Options UI, basically pauses the Merge operation while you change the setting in the window
- Index of the take name you want to change. If there's only one take in the file, use 0 (zero)
So something like this should do what you want...providing you only have one take in the file and want to change that take name.
from pyfbsdk import *
def merge_file(file_path, as_take_name):
def _set_take_destination_name(pCaller, pEvent):
'''
pCaller: In this example, it will be the FBApplication object.
pEvent: An instance of the FBEvent triggered.
'''
# Change Take Destination Name using index
merge_options.SetTakeDestinationName(0, as_take_name)
# Remove the callback function when file merge is complete.
pCaller.OnFileMerge.RemoveAll()
merge_options = FBFbxOptions(True)
# Turn off Merge File window
merge_options.ShowOptionsDialog = False
# Merge all Elements. Merge All Animation
merge_options.SetAll(FBElementAction.kFBElementActionMerge, True)
## --------------------------- Open File ---------------------------
# Create callback function on the OnFileMerge event.
FBApplication().OnFileMerge.Add(_set_take_destination_name)
# Merge File
FBApplication().FileMerge(file_path, False, merge_options)
merge_file_path = FULL_PATH_TO_FILE
merge_file(merge_file_path, "NEW TAKE NAME")
Hope this helps,