MOBU - can't fully delete with python

I don’t know if it’s a known issue but I’m hoping someone have either a workaround or a fix for this.

So the problem started with an animator using cube in his scene and we somehow noticed we had trouble accessing this cube through our tools. After a quick investigation we noticed that the animator created and delete several cube… and if you delete a cube manually it won’t really be deleted and mobu will keep a FBMesh in the components of the scene…

cube = FBModelCube('Cube')

def getBrokenCube():
    for n in FBSystem().Scene.Components:
        if n.Name == 'Cube':
            print n
            return n
    print 'nothing found'

theCube = getBrokenCube()

This will return a FBModel , now if you manually delete it in the scene and re-run the getBrokenCube you will get a FBMesh…

This behaviour only seems to occur with Cube… and happens in both mobu 2017 and 2015 ( havent tested other versions)

I tried getting the FBMesh and then do a FBDelete() but the object remains… Any way to get rid of this mesh and fix the “corrupted scene” ?


After looking into this, it unfortunately seems that I cannot get that FBMesh to get deleted as well. Its an interesting problem, and maybe someone else has insight on how to do it from the MotionBuilder UI.

You can delete child objects of the root model by looking it up in Python by label name. Heres a quick pyside UI to illustrate.

# Built in

# Third Party
from pyfbsdk import FBSystem, FBFindModelByLabelName
from PySide.QtGui import (

# Custom

class MainWin(QDialog):
    """ Main window of the app """
    def __init__(self, parent=None):
        """ Initialization """
        super(MainWin, self).__init__(parent)
        self.setWindowTitle('Model Recursive Delete')
        self.main_layout = QVBoxLayout()
        self.model_list = QListWidget()
        self.refresh_button = QPushButton('Refresh list')
        self.del_button = QPushButton('Delete model')
    def populate_list(self):
        """ Populates the list widget with the scene root models. """
        for model in FBSystem().Scene.RootModel.Children:
            item = QListWidgetItem(model.Name)
    def recursive_del(self):
        """ Deletes a top model and children. """
        models_selected = self.model_list.selectedItems()
        for model in models_selected:
    def delete_obj(self, obj):
        """ Recursively performs the delete op.
            obj (FBType): FB model. May be child.
        while len(obj.Children) > 0:

app = MainWin(parent=QApplication.activeWindow())

I can’t repro your issue in 2016 (sp1hf7) or 2018.

FBDelete method works fine. Are you sure there’s nothing else that may prevent deletion, like a FBPlug callback? If you have custom tools installed, try running without them and try again.

Hello, I also have such a problem at present, so I would like to ask if you have found a solution? If you find it, can you share it with me? Looking forward to your reply^^~

We fixed it by telling animator that cube are little evil fuckers. Alternatively autodesk sent us a patched version so we didn’t really had to push the investigation.


ok,I’ve learned,thank you~