Xref Objects
 
 
 

Interface: objXRefs

Function published interface for Xref Objects.

Interface: objXRefMgr

XRef Objects Manager Interface. Available in 3ds Max 8 and higher.

XRefObject : Node

XRef ObjectsNode, extended in 3ds Max 8 with new Properties and Interfaces.

XRefAtmosWrapper

XrefAtmospherics Wrapper. Available in 3ds Max 8 and higher.

XRef_Material : Material

XrefMaterial. Available in 3ds Max 8 and higher.

Explicit References prior to 3ds Max 8

A file being xref'd that has a script controller whose script has explicit references ($sphere01, etc.) to objects in the incoming xref file have a potential problem for the script writer. The problem is, the objects in the xref file are invisible to MAXScript, and so a script will fail. This is actually a general problem with xrefs, you cannot have scripts of any kind in the file (scripts controllers, param wires, callback scripts, etc.) that depend on explicit scene object references.

The persistent global solution is the only one that is viablein 3ds Max prior to version 8. There are two general solutions: 1) associate an owning-scene context with controller scripts, etc., when they come in via xref and use that to anchor pathname searches and other scene-relative references, and 2) have an accessible 'evaluation context' for controllers sent as part of the GetValue() call, so we can know what object's parameter the current GetValue() call is being made for and can therefore get rid of many of the uses of explicit pathnames in the scripts.

MAXScript now fully loads any persistent globals in xref'd and merged files, but does NOT make them persistent in the current scene. As an example of a setup showing how this can be used, imagine a file with 3 spheres that will be xref'd. You need to establish persistent globals for all the scene objects to be referrenced in controller scripts, like this: persistent global s1 = $sphere01, s2 = $sphere02, s3 = $sphere03 this has to be run sometime while the to-be-xrefed scene is the currently open scene. Then in the controller scripts, you'd say something like:

globals1, s2
dependsOn s1 s2
(s1.pos + s2.pos) / 2

Notethat this exampleuses 'global'andnot 'persistent global'.You don'thave tomake the variablespersistentfor the "host" scene referencing the XRefs.

Explicit Referencesin 3ds Max 8and higher

The redesigned script and expression controllers in 3ds Max 8 solve the problem described above, since the node references stored in ParamBlock2 can be resolved successfully.

See Also