Motionbuilder Pyside2 UI

I’m trying to create a basic UI in Motionbuilder using Pyside2. I have used Pyside2 in Maya for my UI’s. But I’m having problems trying to wrap the UI to FBWidgetHolder. Any basic examples of parenting the ui in MB would really help.

Thanks :slightly_smiling_face:

So this works. Shows a single widget button.

from pyfbsdk import *
from pyfbsdk_additions import *

from PySide2 import QtWidgets
from shiboken2 import wrapInstance, getCppPointer
 

class NativeWidgetHolder(FBWidgetHolder):

    def WidgetCreate(self, pWidgetParent):

        self.mNativeQtWidget = QtWidgets.QPushButton("Push Button", wrapInstance(pWidgetParent, QtWidgets.QWidget))

        return getCppPointer(self.mNativeQtWidget)[0]


        
class NativeQtWidgetTool(FBTool):
    def BuildLayout(self):
        x = FBAddRegionParam(0,FBAttachType.kFBAttachLeft,"")
        y = FBAddRegionParam(0,FBAttachType.kFBAttachTop,"")
        w = FBAddRegionParam(0,FBAttachType.kFBAttachRight,"")
        h = FBAddRegionParam(0,FBAttachType.kFBAttachBottom,"")
        self.AddRegion("main","main", x, y, w, h)
        self.SetControl("main", self.mNativeWidgetHolder)
                
    def __init__(self, name):
        FBTool.__init__(self, name)
        self.mNativeWidgetHolder = NativeWidgetHolder();
        self.BuildLayout()
        self.StartSizeX = 600
        self.StartSizeY = 400   
        
gToolName = "NativeQtWidgetTool"
 
#Development? - need to recreate each time!!
gDEVELOPMENT = True
 
if gDEVELOPMENT:
    FBDestroyToolByName(gToolName)
 
if gToolName in FBToolList:
    tool = FBToolList[gToolName]
    ShowTool(tool)
else:
    tool=NativeQtWidgetTool(gToolName)
    FBAddTool(tool)
    if gDEVELOPMENT:
        ShowTool(tool)

How do I get a QVBoxLayout to work with 2 buttons and a QListWidget to load? I’m guessing I create a class for the QVBoxLayout , QListWidget and buttons. Then run that class in NativeWidgetHolder in place of QtWidgets.QPushButton. But it seems to fail. Any help would be great. Thanks