Interfaces > Core Interfaces > objXRefMgr |
The objXRefMgr Core Interface provides access to the XRef Manager, and is the preferred way for working with XRefs in MAXScript. Scripts should not use both the methods in this interface and those exposed by XRefObject. The objXrefMgr coordinates all object xref additions and changes in a scene.
Available in 3ds Max 8 and higher.
You may find the following concepts useful when working with XRefs in MAXScript:
objXRefMgr.includeAll : bool : Read|Write
Get/set the state of the "Include All" checkbox.
Available in 3ds Max 2016 and higher.
objXRefMgr.enableUseLocalProxySettings : bool : Read|Write
When set to True, local proxy settings will be used.
Available in 3ds Max 2016 and higher.
Returns the number of Object XRef records.
objXRefMgr.dupObjNameAction : enum : Read|Write dupObjNameAction enums: {#prompt|#xref|#skip|#deleteOld|#autoRename}
Get/set the action to perform when duplicate names have been detected.
objXRefMgr.dupMtlNameAction : enum : Read|Write dupMtlNameAction enums: {#prompt|#useXRefed|#useScene|#autoRename}
Get/set the action to perform when duplicate material names have been detected.
Get/set whether to merge the transformation controllers of the Object XRefs. When set to true, the transform controllers will be merged into the master scene and will lose the live connection to the referenced file. Default is false.
Get/set whether to merge the materials of the Object XRefs. When set to true, the materials of the referenced objects will be merged into the master scene and will lose the live connection to the referenced file. This option must be set before creating the Object XRef. Default is false.
Get/set whether to merge the manipulators of the Object XRefs. When set to true, the manipulators of the referenced objects will be merged into the master scene and will lose the live connection to the referenced file. This option must be set before creating the Object XRef. Default is false.
objXRefMgr.mergeModifiers : enum : Read|Write mergeModifiers enums: {#xrefModifiers|#ignoreModifiers|#mergeModifiers}
Get/set the handling of the modifiers of the Object XRef.
When the #xrefModifiers option is specified, the modifiers will be applied to the XRef Object before it is merged into the master scene and cannot be changed.
When the #ignoreModifiers option is specified, the modifiers from the referenced file will not be applied to the XRef Object.
When the #mergeModifiers option is specified, the modifiers from the referenced file will be merged into the master scene and can be manipulated, but will lose their live connection to the referended file.
This option must be set before creating the Object XRef.
Get/set whether to update the Object XRefs automatically when the referenced source file has been saved.
Returns the indexed record, where index is between 1 and the .recordCount
See IXrefRecordMixinInterface for details on the return value.
Removes the specified record from the scene.
Returns true on success, false on failure.
See IXrefRecord MixinInterface for details on the record argument.
Merges the specified record into the scene.
Returns true on success, false on failure.
See IXrefRecord MixinInterface for details on the record argument.
Sets the source file of the specified record to the given file name.
Returns true on success, false on failure.
See IXrefRecord MixinInterface for details on the record argument.
Updates all records in the scene. Returns true on success, false on failure.
Sets the source item name of the object passed by-reference to the given string.
Returns true on success, false on failure.
<bool>objXRefMgr.SetProxyItemSrcName <&maxObject>xrefItem <string>itemName proxyItem is In parameter
Sets name of the proxy of the object passed by-reference to the given string.
Returns true on success, false on failure.
For Example |
---|
-- Illustrate the use of SetProxyItemSrcName, SetProxyItemSrcFile, and AddXrefItemsFromFile sphereFile = @"mySphereScene.max" teapotFile = @"myTeapotScene.max" -- Create a scene file containing a sphere, this will be the proxy object resetMaxFile #noPrompt s = sphere name:"mySphere" saveMaxFile sphereFile useNewFile:false -- create a scene file containing a teapot, this will be the xref object resetMaxFile #noPrompt -- add a teapot, we'll use the sphere as a proxy t = teapot name:"myTeapot" saveMaxFile teapotFile useNewFile:false -- create our xref and our proxy resetMaxFile #noPrompt xrefRecord = objXrefMgr.AddXrefItemsFromFile teapotFile promptObjNames:false \ xrefOptions:#(#mergeModifiers, #mergeControllers, #mergeManipulators, #mergeMaterials) xrefItem = xrefRecord.getItem 1 #XrefObjectType objXrefMgr.SetProxyItemSrcFile xrefItem @"mySphereScene.max" objXrefMgr.SetProxyItemSrcName xrefItem "mySphere" |
<bool>objXRefMgr.SetXRefItemSrcFile <&maxObject>xrefItem <filename>fileName xrefItem is In parameter
Sets the source item file name of the object passed by-reference to the given filename string.
Returns true on success, false on failure.
<bool>objXRefMgr.SetProxyItemSrcFile <&maxObject>xrefItem <filename>fileName proxyItem is In parameter
Sets the proxy item file name of the object passed by-reference to the given filename string.
Returns true on success, false on failure.
<bool>objXRefMgr.AddXRefItemsToRecord <Interface>record promptObjNames:<bool>objNames:<string array> record Validated by Validator function promptObjNames default value: false objNames default value: #()
Adds XRefs for the array of object names in the scene to the given record.
See IXrefRecord MixinInterface for details on the record argument.
<Interface>objXRefMgr.AddXRefItemsFromFile <filename>fileName promptObjNames:<bool> objNames:<string array> xrefOptions:<&enum array> promptObjNames default value: false objNames default value: #() xrefOptions enums: {#asProxy|#xrefModifiers|#dropModifiers|#mergeModifiers|#mergeManipulators |#selectNodes|#mergeControllers|#mergeMaterials|#xrefControllers|#localControllers} xrefOptions default value: #() xrefOptions is In parameter
Returns an XRef record object (IXRefRecord) that contains the XRefs (as IXRefItem objects) added to the scene from the specified file, of the specified objects.
See IXrefRecord MixinInterface for details on the record argument.
<bool>objXRefMgr.CanCombineRecords <Interface>firstRecord <Interface>secondRecord firstRecord Validated by Validator function secondRecord Validated by Validator function
Returns true if the two records can be combined, false otherwise.
See IXrefRecord MixinInterface for details on the record arguments.
<Interface>objXRefMgr.CombineRecords <&Interface array>records records Validated by Validator function records is In parameter
Combines the records given as by-reference array of interfaces to a single interface.
See IXrefRecord MixinInterface for details on the record argument and return value.
Removes the given XRef Items from the scene.
Returns true on success, false on failure.
Merges the XRef Items specified as an array into the scene.
Returns true on success, false on failure.
<void>objXRefMgr.ApplyXRefMaterialsToXRefObjects <&maxObject array>objectXRefItems objectXRefItems is In parameter
Applies XRef Materials to the specified XRef objects.
If the node is XRef-ed, returns an IXRefItem MixinInterface.
<void>objXRefMgr.ApplyXRefControllersToXRefObjects <&maxObject array>objectXRefItems objectXRefItems is In parameter
Applies XRef controllers to the Object XRef items specified by the by-reference array argument.
<boolean>objXRefMgr.ResetXRefControllersPRSOffset <&maxObject array>xrefItems xrefItems is In parameter
Applies Position/Rotation/Scale offset to the XRef controllers of the Object XRef items specified by the by-reference array argument.
Returns true if Position/Rotation/Scale offset can be applied to the XRef controllers of the Object XRef item specified by the by-reference argument.
Get/Set the state of the Include All checkbox. When set to true, all objects in the record will be included.
Get/Set the state of the Auto Update checkbox. When set to true, changes to the XRef source will be automatically updated in the scene.
Get/Set the state of the Enable checkbox.
Get/Set the whether the record is up to date or outdated.
Contains true if the record is empty, false otherwise.
Contains true if the record is nested, false otherwise.
Contains true if the record is unresolved, false otherwise.
Contains the file name of the source file. This property can be set in 3ds Max 9 and higher, prior to 3ds Max 9 it was read-only.
<IXRefRecord MixinInterface>.xrefOptions : enum by value array : Read xrefOptions enums: {#asProxy|#xrefModifiers|#dropModifiers|#mergeModifiers|#mergeManipulators|#selectNodes|#mergeMaterials}
Contains an array of the XRef Options.
<DWORD><IXRefRecord MixinInterface>.ItemCount <&enum array>types types enums: {#XRefObjectType|#XRefMaterialType|#XRefAtmospheric Type|#XRefAllType} types is In parameter
Returns the number of items in the record that correspond to the types passed by the by-reference array argument.
<maxObject><IXRefRecord MixinInterface>.GetItem <index>index <enum>type type enums: {#XRefObjectType|#XRefMaterialType|#XRefAtmosphericType}
Returns the indexed item of the specified XRef type.
<DWORD><IXRefRecord MixinInterface>.GetItems <&enum array>types <&maxObject array>xrefItems types enums: {#XRefObjectType|#XRefMaterialType|#XRefAtmosphericType|#XRefAllType} types is In and Out parameter xrefItems is In and Out parameter
Returns all items of the types specified by the by-reference array of the first argument into the by-reference array of the second argument.
<DWORD><IXRefRecord MixinInterface>.GetChildRecords <&Interface array>children children is Out parameter
Returns the child records into the by-reference array. See IXrefRecord MixinInterface for details on the array's values type.
<DWORD><IXRefRecord MixinInterface>.GetParentRecords <&Interface array>parents parents is Out parameter
Returns the parent records into the by-reference array. See IXrefRecord MixinInterface for details on the array's values type.
Returns the root records into the by-reference array. See IXrefRecord MixinInterface for details on the array's values type.
Returns true if the source file has changed, false if it has not.
Forces an update of the XRef Record and returns true on success, false on failure.
Contains the file name of the source file.
This property was read-only in versions prior to 3ds Max 9.
Contains the name of the source item.
This property was read-only in versions prior to 3ds Max 9.
Contains the Xref Record's IXRefRecord MixinInterface.
Contains true if the XRef is unresolved, false otherwise.
Contains true if the XRef is nested, false otherwise.
Contains true if the XRef can be retargeted, false otherwise.
<maxObject><IXRefItem MixinInterface>.GetSrcItemresolveNested:<bool> resolveNested default value: false
Returns the source item. If the resolveNested optional keyword is specified and is true, nested XRefs will be resolved to get the source item. If not specified or false, nested XRefs will not be resolved.
<DWORD><IXRefItem MixinInterface>.GetParentItems <&maxObject array>parentItems parentItems is Out parameter
Returns the parent items into the by-reference array argument.
<DWORD><IXRefItem MixinInterface>.GetRootItems <&maxObject array>rootItems rootItems is Out parameter
Returns the root items into the by-reference array argument.
<DWORD><IXRefItem MixinInterface>.GetChildItems <&maxObject array>childItems childItems is Out parameter
Returns the child items into the by-reference array argument.
Returns the XRef nodes into the by-reference array argument.
This property was read-only in versions prior to 3ds Max 9.
This property was read-only in versions prior to 3ds Max 9.
Contains the IXRefRecord Interface of the Proxy.
Get/set whether to display the proxy in the viewports or not.
Contains the active object name.
Contains the IXRefRecord Interface of the Xref Object.
<maxObject><IXRefObject MixinInterface>.GetSourceObject <bool>resolveNestedXRef modifiers:<&maxObject array> modifiers default value: #() modifiers is Out parameter
Returns the Source Object. When the first argument is set to true, nested XRefs will be resolved. The optional modifiers: array parameter will be populated with the modifiers of the object.