def _save_as_session():
    """
    Save the current session to the supplied path.
    """

    # Save the file using a dialog box.
    saveDialog = FBFilePopup()
    saveDialog.Style = FBFilePopupStyle.kFBFilePopupSave
    saveDialog.Filter = '*'

    saveDialog.Caption = 'Save As'
    saveDialog.FileName = _session_path()

    if saveDialog.Execute():
        mb_app.FileSave(saveDialog.FullFilename)
Exemplo n.º 2
0
def loadBVH():
    lFp = FBFilePopup()
    lFp.Caption = "Select a BVH File to be Retargeted"
    lFp.Style = FBFilePopupStyle.kFBFilePopupOpen

    lFp.Filter = "*"

    # Set the default path.
    lFp.Path = r"C:\Users"
    # Get the GUI to show.
    lRes = lFp.Execute()
    # If we select files, show them, otherwise indicate that the selection was canceled
    if lRes:
        return lFp.Path + "/" + lFp.FileName
    else:
        FBMessageBox("Invalid selection", "Selection canceled", "OK", None, None)
Exemplo n.º 3
0
def fbxPopup():
    from pyfbsdk import FBFilePopup, FBFilePopupStyle, FBMessageBox

    lFp2 = FBFilePopup()
    fbxName = None
    lFp2.Caption = "Select an FBX File for the Retargeting"
    lFp2.Style = FBFilePopupStyle.kFBFilePopupOpen
    lFp2.Filter = "*"
    # Set the default path.
    lFp2.Path = GetMotionBuilderInstallationDirectory()+"Tutorials"
    # Get the GUI to show.
    lRes = lFp2.Execute()
    # If we select files, show them, otherwise indicate that the selection was canceled
    if lRes:
        fbxName = lFp2.Path + "/" + lFp2.FileName
    else:
        FBMessageBox( "Invalid selection", "Selection canceled", "OK", None, None )
    # Cleanup.
    del( lFp2, lRes, FBFilePopup, FBFilePopupStyle, FBMessageBox )
    return fbxName
Exemplo n.º 4
0
def saveResponse(control, event):
    # Save the file using a dialog box.
    saveDialog = FBFilePopup()
    saveDialog.Style = FBFilePopupStyle.kFBFilePopupSave
    saveDialog.Filter = '*'
    saveDialog.Caption = 'Save the Current FBX'
    # Set the path to the current user's My Documents.
    saveDialog.Path = os.path.expanduser('~') + '\Documents'
    saveDialog.FileName = 'Characterized.fbx'

    #Save the file
    if saveDialog.Execute():
        app.FileSave(saveDialog.FullFilename)
Exemplo n.º 5
0
def _save_as_session():
    """
    Save the current session to the supplied path.
    """

    # Save the file using a dialog box.
    saveDialog = FBFilePopup()
    saveDialog.Style = FBFilePopupStyle.kFBFilePopupSave
    saveDialog.Filter = '*'

    saveDialog.Caption = 'Save As'
    saveDialog.FileName = _session_path()

    if saveDialog.Execute():
        mb_app.FileSave(saveDialog.FullFilename)
Exemplo n.º 6
0
def saveResponse(control, event):
    # Save the file using a dialog box.
    saveDialog = FBFilePopup()
    saveDialog.Style = FBFilePopupStyle.kFBFilePopupSave
    saveDialog.Filter = '*'
    saveDialog.Caption = 'Save the Current FBX'
    # Set the path to the current user's My Documents.
    saveDialog.Path = os.path.expanduser('~') + '\Documents'
    saveDialog.FileName = 'Characterized.fbx'

    #Save the file
    if saveDialog.Execute():
        app.FileSave(saveDialog.FullFilename)
Exemplo n.º 7
0
def saveResponse(control, event):
    # Save the file using a dialog box.
    saveDialog = FBFilePopup()
    saveDialog.Style = FBFilePopupStyle.kFBFilePopupSave
    saveDialog.Filter = "*"

    saveDialog.Caption = "Save the Current FBX"
    # Set the path to the current user's My Documents.
    saveDialog.Path = os.path.expanduser("~") + "\Documents"
    saveDialog.FileName = "Retarget.fbx"

    if saveDialog.Execute():
        app.FileSave(saveDialog.FullFilename)
Exemplo n.º 8
0
def loadBVH():
    lFp = FBFilePopup()
    lFp.Caption = "Select a BVH File to be Retargeted"
    lFp.Style = FBFilePopupStyle.kFBFilePopupOpen

    lFp.Filter = "*"

    # Set the default path.
    lFp.Path = r"C:\Users"
    # Get the GUI to show.
    lRes = lFp.Execute()
    # If we select files, show them, otherwise indicate that the selection was canceled
    if lRes:
        return lFp.Path + "/" + lFp.FileName
    else:
        FBMessageBox("Invalid selection", "Selection canceled", "OK", None,
                     None)
    def export_callback(control, event):
        takes = []
        for button in TAKE_BUTTONS:
            if button.State:
                for t in SCENE.Takes:
                    if t.Name == button.Caption:
                        takes.append(t)

        config = takes[0].Name
        path = get_config_value(config + "\\export_path")

        popup = FBFilePopup()
        popup.Caption = "Export takes to"
        popup.Filter = "*.bsi"
        popup.FileName = config + ".bsi"
        if path:
            popup.Path = os.path.dirname(path)
        popup.Style = FBFilePopupStyle.kFBFilePopupSave
        if popup.Execute():
            for t in takes:
                set_config_value(t.Name + "\\export_path", popup.FullFilename)
            dir = os.path.dirname(popup.FullFilename)
            export_takes(dir, takes)
Exemplo n.º 10
0
def fbxPopup():
    from pyfbsdk import FBFilePopup, FBFilePopupStyle, FBMessageBox

    lFp2 = FBFilePopup()
    fbxName = None
    lFp2.Caption = "Select an FBX File for the Retargeting"
    lFp2.Style = FBFilePopupStyle.kFBFilePopupOpen
    lFp2.Filter = "*"
    # Set the default path.
    lFp2.Path = GetMotionBuilderInstallationDirectory()+"Tutorials"
    # Get the GUI to show.
    lRes = lFp2.Execute()
    # If we select files, show them, otherwise indicate that the selection was canceled
    if lRes:
        fbxName = lFp2.Path + "/" + lFp2.FileName
    else:
        FBMessageBox( "Invalid selection", "Selection canceled", "OK", None, None )
    # Cleanup.
    del( lFp2, lRes, FBFilePopup, FBFilePopupStyle, FBMessageBox )
    return fbxName
Exemplo n.º 11
0
def main():
    # Create the popup and set necessary initial values.
    lFp = FBFilePopup()
    lFp.Caption = "Select T-Pose"
    lFp.Style = FBFilePopupStyle.kFBFilePopupOpen

    # BUG: If we do not set the filter, we will have an exception.
    lFp.Filter = "*.trc"

    # Set the default path.
    lFp.Path = r"Z:\wanghuan\mocap"

    # Get the GUI to show.
    lRes = lFp.Execute()

    if not lRes:
        return

    gAPPLICATION.FileNew()
    res = gAPPLICATION.FileImport(lFp.FullFilename)
    if not res:
        return

    create_actor_from_opticals.main()
    map_opticals_to_actor.main()

    dirname = os.path.dirname(lFp.FullFilename)
    files = os.listdir(dirname)
    for f in files:
        if not f.endswith('.trc'):
            continue

        if 'Unnamed' in f:
            continue

        path = os.path.join(dirname, f)
        createTake(os.path.splitext(f)[0])
        gAPPLICATION.FileImport(path, True)
Exemplo n.º 12
0
StartList = FBModelList()
StartListNames = list()
FBGetSelectedModels (StartList, None, False)
for model in StartList:
                StartListNames.append(model.Name)

# Now we need to assign animation plot options

pOpt = FBPlotOptions()
pOpt.UseConstantKeyReducer = False
pOpt.PlotAllTakes = True

#Filter needs to be set, otherwise it will crash

FileOpen = FBFilePopup()
FileOpen.Filter = '*.fbx'
FileOpen.Caption = "Select the animation to Retarget"
FileOpen.Style = FBFilePopupStyle.kFBFilePopupOpen
FileOpen.Path = r'J:\temp'

if FileOpen.Execute():
    File = FileOpen.FullFilename
    LoadAndRetAnim (File, pOpt)
else:
    print 'CANCEL'
    
#Get rid of imported trash

for name in StartListNames:
  FBFindModelByName(name).Selected = True