导出完整角色


# 导出当前所选物体

def select_hierarchy(top_model):
    for child_model in top_model.Children:
        select_hierarchy(child_model)

    if pyfbsdk.FBModel.FbxGetObjectSubType(
            top_model) == 'FBModelSkeleton' or pyfbsdk.FBModel.\
            FbxGetObjectSubType(top_model) == 'FBModelRoot':
        top_model.Selected = True
        
take = pyfbsdk.FBSystem().CurrentTake
selectedModels = FBModelList()

topModel = None # Search all models, not just a particular branch
selectionState = True # Return models that are selected, not deselected
sortBySelectOrder = True # The last model in the list was selected most recently
FBGetSelectedModels(selectedModels, topModel, selectionState, sortBySelectOrder)

for model in selectedModels:
    select_hierarchy(select_hierarchy)
    
l_file_options = pyfbsdk.FBFbxOptions(False)
l_file_options.SaveSelectedModelsOnly = True
l_file_options.ShowFileDialog = False
l_file_options.ShowOptionsDialog = False
l_file_options.UpdateRecentFiles = False


for index in range(l_file_options.GetTakeCount()):  
    if l_file_options.GetTakeName(index) == take.Name:
        l_file_options.SetTakeSelect(index, True)
    else:
        l_file_options.SetTakeSelect(index, False)
base_file = r'C:\Users\wb.zhangying18\Desktop\export\CineCameraActor_2_Shot01.fbx'
pyfbsdk.FBApplication().FileSave(base_file, l_file_options)




评论
  目录