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

new.gif XRef Objects Node, extended in 3ds Max 8 with new Properties and Interfaces.

XRefAtmosWrapper

Xref Atmospherics Wrapper. Available in 3ds Max 8 and higher.

XRef_Material : Material

Xref Material. 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 viable in 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:

global s1, s2

dependsOn s1 s2

(s1.pos + s2.pos) / 2


Note
that this example uses 'global' and not 'persistent global'. You don't have to make the variables persistent for the "host" scene referencing the XRefs.

Explicit References in 3ds Max 8

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

XRef Files

XRefScene Values

 

XRefObject : Node

XRef_Material : Material

XRefAtmosWrapper

Interface: objXRefMgr

Interface: objXRefs

 

xrefs const StructDef

xrefPaths const StructDef