Instancing a Referenced Object
You can instance a referenced object after it is loaded into MotionBuilder, or upon load. You need to specify the number of instances. This is useful in some cases, for example, when a layout artist wants to populate a set with many identical objects.
The following script creates a couple of cloned reference objects using the names in the lNameList
. The second parameter of the function DuplicateFileRef
is set to True
to apply the reference edit that the original reference object has after the instancing is done.
lNameList = FBStringList()
lNameList.Add( "NS_CLONE" )
lFileReference.DuplicateFileRef( lNameList, True )
The following code snippet demonstrates how to instance multiple objects on load. This is helpful if you want to bring in many of the same objects and share the same geometry.
FBSystem().Scene.NamespaceImport( "NS~NS2~NS3", "abc.fbx", True )
# Reference three instances of the same file.