Functionality is exposed to Python via a wrapper around the actual MotionBuilder object. For example b = FBButton()
creates:
Once the two objects are created, the following states can arise:
unbind.UnbindWrapperError
is thrown. See PropertyDrop.py for an example showing how the Tool.OnUnbindSDK event can register a callback that unregisters the tool from the scene as soon as the tool becomes unbound.FBGetModelByName
.You can register a callback on an object to be notified if it ever becomes unbound.
For an example of unbinding, see Unbind_example.py. It creates a tool and adds a label to it. It then calls DestroyTool
, which deletes all the UI controls in the tool. But the Python wrappers (for the tool and label) are still accessible, and if you access the label caption property an exception is thrown.
You can also see the unbind error as follows:
myCube = FBModelCube("Cube0")
myCube.Name
, this works because the cube persists in the undo system..myCube.Name
will throw an UnboundWrapperError.