There is not real referencing, but by having a node in your scene that holds a reference to all objects in the scene, you can sort of get the behaviour of referencing. I might actually do a post on this in the future, if there is an interest.

I wrote about the same script a year or two ago (figuring out the node type deleting order and such). However I quickly realized that while deleting a character from a one character scene would take about 40 seconds, deleting a character out of a cinema scene with 3 characters (with custom face rigging) and some background geo, the "delete" process was still running 40 minutes later (for 1 character!)…

I talked to subscription about this and the answer was: “deleting objects with the SDK is currently a challenge”. This was on MotionBuilder 2011 advantage pack, so this might have changed for the newer versions. However unless you have already done this, I would torture test this before committing to it as a long term solution.

Wanting “referencing” is obvious, especially if you have a Maya background. But most old hand MotionBuilder people I have met have a “scene re-building” workflow, meaning they save out all animation, then re-build the scene with fresh assets and apply the animation. I heard one of the Crytek studios have scripts for doing exactly this for their cinemas (you might know?). So that might be an alternative solution.

I would love to know if the solution scales well for large scene, or if that’s still an issue?

I tested this with a few characters in a scene and it worked fine, Ill give this a test run with a lot more characters soon. Btw, in 2013 you have a function called NamespaceDelete() which was supposed to fix this, but I still have to use my own function to do that

Actually it does support characters, but in all fairness, not very gracefully. There r still some limitations and I haven't been as involved in the beta testing as I had initially hoped. Anyway, the "work around" (ever heard that word used? *sarcasm*) is to reference a file that only contains the skinned mesh & the skeleton (no rig or characterization) into a file that contains a duplicate of the same hierarchy which IS characterized. Parent constrain each joint to its correlating joint of each hierarchy (like a slave skeleton). Proper namespacing of each skeletal hierarchy is your friend. Any updates to the mesh will be reflected, updated & remain current. There are some caveats regarding changes to the hierarchy of the referenced skeleton & mesh, contrary to the documentation when dealing with hierarchies of the complexity, but still gets the job done.

I'm happy to report that removing a character from a dense scene with your code, is down from "Not going to happen" to around 3 minutes - still in MoBu 2011. I'm assuming it's the specific order that things are removed in that makes the difference. Now I just need to get rid of those pesky pop-ups related to relation constraint macros.