I’m trying to use FBFilePopupStyle.kFBFilePopupOpen so the user can select multiple fbx files for merging. It appears you can only select one file at a time. Any help would be awesome! Here is an example of the code:
if saveDialog.Execute():
# Once file has closed get chosen file add path details and
# use them to FileOpen
file_chosen = saveDialog.FileName
path_chosen = saveDialog.Path
file_path = f"{path_chosen}{file_chosen}"
app.FileMerge(file_path)
One way is to use FBFolderPopup() instead, collect the files in a directory (with your filter) to a listbox in your UI, then add multi-select functionality to the listbox. From there you can select the ones you need to process.
So I use the FBFolderPopup() to choose a directory but how do I use a listbox within my popup UI. This is my only UI I’m using. I don’t have a lot of UI experience in Motionbuilder. I cant believe how hard it is to use compared to Maya’s UI.
The plan was to use the popup to choose animation files which I could iterate into the MB scene . This would be merged animations into a MB scene that has the Character. Any help would be amazing.
Ok, so in what I’ve described you’d launch the pop up from a button on a separate tool’s UI. If there is no tool as such and your just going straight to the popup, then you could just grab all the files in the chosen folder to a list and work directly with that to import / merge them, but this is kind of limiting as you’d have to process all files in the folder (you could filter to make sure they were the correct type still).
However you eventually merge your animations, you’ll likely need to set up an FBFbxOptions object to specify which elements / takes you want to merge in from each fbx file.
It’s a pretty obvious question, but have you stepped through manually what it is you’re trying to achieve? Are you trying to load different anims onto different characters (with different namespaces); or multiple anims as multiple takes on a single character; or something else?
I’m writing a MB tool (connected to FBMenuManager() button ) so animators can select (some files) multiple animation files within a directory. These will be merge into an MB scene. The MB scene will already have a Character present. The benefit of this tool will have a the popup open to the directory file location they need to start browsing from. This will be a great way to access animations for male and female and also load rigs into there MB scene without any major browsing for files.
I found an easier way to use a popup UI multi file selection. Since I’m using MotionBuilder 2022 that supports PySide2. I decided to ditch MB UI and use PySide2 Qt widgets. So much easier to get the UI I want. Here is a snippet of modified code to show as an example and help others wanting easier UI.
from pyfbsdk import *
from PySide2 import QtWidgets
import shiboken2
app = FBApplication()
open_defaultpath = “C:/Users”
Below creates a Qt brower pop up that returns a string list of path and animation file names.
Yeah, PySide2 makes some of it easier for sure (and is my go to for UI in Maya / Mobu these days). You’ll need to subclass FBWidgetHolder if you end up wanting to use it to create a UI in Mobu, but you’ve probably already found the example in the Mobu python API reference that shows how to do this as and when you might need it.
Glad you’re sorted anyway.