Documentation - Maxscript

Documentation about the maxscript commands of SmartRefs.

You can use the maxscript interface smartrefs to access several commands and properties of the SmartRefs plugin, having the following commands:


Methods

smartrefs.addSmartRef <filename_string> [proxyFileName:<string>] [load:<boolean>] [active:<boolean>] [proxyViewport:<boolean>] [proxyRender:<boolean>]

Adds a new SmartRef to the scene with the specified file name, the SmartRef is returned as value. If load:<string> is specified as false, the reference is not loaded until the user request it. Use the reload() method to load the reference.


smartrefs.addSmartRefDialog()

Prompts the Add SmartRef Dialog Box.


smartrefs.numSmartRefs()

Returns the total number of top-level SmartRefs in the scene.


smartrefs.getSmartRef <index>

Returns the SmartRef corresponding to the indexed SmartRef in the SmartRefs dialog.


smartrefs.getAllSmartRefs()

Returns an array with all the SmartRefs in the scene.


smartrefs.removeAllSmartRefs()

Removes all the SmartRefs in the scene.


smartrefs.reloadSmartRefs <index array>

Reloads the SmartRefs specified in the index array.


smartrefs.removeSmartRefs <index array>

Removes the SmartRefs specified in the index array and all of their objects from the scene.


smartrefs.resetSmartRefs <index array>

Resets the SmartRefs specified in the index array. That means all the modifications made to the objects of those references in the master scene are dismissed and the references are reloaded.


smartrefs.duplicateSmartRefs <index array>

Duplicates the SmartRefs specified in the index array, all the modifications made in the objects of the references will be preserved. If several references are going to be duplicated it's better to do so at the same time with only one call to this function, so that connections between the objects of different references can be preserved.


smartrefs.mergeSmartRefs <index array>

Merges the SmartRefs specified in the index array. That means all the nodes of the references become normal nodes and are not referenced anymore.


smartrefs.advancedReset [selection:<integer>] [category:<bitArray>] [parameters:<bitArray>] [references:<index array>] [nodes:<node array>]

Available in 1.01.00 and higher.

Executes the advanced reset with the data provided.

selection: Can use one of the following values:
1 - Reset Selected References.
2 - Reset Selected Nodes.

category: Specify with a bitArray the categories to be reset :
1 - Geometry.
2 - Shapes.
3 - Lights.
4 - Cameras.
5 - Helpers.
6 - Space Warps.
7 - Particle Systems.
8 - Bone Objects.

parameters: Specify with a bitArray the parameters to be reset :
1 - Base Object.
2 - Modifiers.
3 - Transform.
4 - Material.
5 - Object Properties.
6 - Parenting.
7 - Name.
8 - Layer.
9 - Deleted Nodes.

references: Specify with an array of indices the references to be reset (selection and nodes parameters will be ignored)

nodes: Specify with an array of nodes the nodes to be reset (selection parameter will be ignored)


FOR EXAMPLE

smartrefs.advancedReset selection:1 categories:#{3,4} parameters:#{1,3,6}

In the example above the base object, transform and parenting overrides of the lights and cameras of the selected references will be reset.


smartrefs.openManager()

Opens the SmartRefs manager dialog box.


smartrefs.closeManager()

Closes the SmartRefs manager dialog box.


smartrefs.isManagerOpen()

Returns true if the SmartRefs manager dialog box is open, returns false otherwise.



Properties

smartrefs.showDuplicatedNamesWarnings Boolean default: true

If true everytime a file with nodes with duplicated names is referenced a warning message will be prompted.


smartrefs.saveSmartRefsAsMerged Boolean default: false

If true all the references will be saved as merged everytime the master scene is saved.



Methods by individual SmartRef

Use the method smartrefs.getSmartRef to get the individual reference in order to use the following methods and properties.


<smartref>.reload()

Reloads the SmartRef.


<smartref>.unload()

Unloads the SmartRef and all of its objects.


<smartref>.merge()

Merges the SmartRef. That means all the nodes of the reference become normal nodes and are not referenced anymore.


<smartref>.reset()

Resets the SmartRef. That means all the modifications made to the objects of that reference in the master scene are dismissed and the reference is reloaded.


<smartref>.dismiss()

The same as reset, but in this case the reference is not reloaded, it's just unloaded.


<smartref>.overwrite()

Available in 1.01.00 and higher.

Overwrites the SmartRef. That means the reference with all the modifications made in the master scene is saved over the source file of the reference.


<smartref>.saveAs <filename_string>

Available in 1.01.00 and higher.

Saves the SmartRef with the specified filename. The reference with all the modifications made in the master scene is saved in the specified file name.


<smartref>.getNodes()

Returns an array with all the nodes loaded by this reference.


<smartref>.showDupNames()

Displays the duplicated names dialog box if the reference has duplicated names.



Properties by individual SmartRef

<smartref>.active Boolean default: true

If false the reference won't be loaded in the scene.


<smartref>.fileName Filename

The file name of the SmartRef. If this property is changed the reference will be reloaded with the specified file.


<smartref>.proxyFileName Filename

The file name of the proxy of the SmartRef. If this property is changed and useProxyInViewport is on the reference will be reloaded with the specified file.


<smartref>.useProxyInViewport Boolean default: false

If true the proxy file will be loaded instead of the main file in the viewport.


<smartref>.useProxyInRender Boolean default: false

If true the proxy file will be loaded instead of the main file at render time.


<smartref>.useNamePrefix Boolean default: false

If true all the names of the referenced nodes, materials and layers will have the name of the reference as prefix.


<smartref>.persistRef Boolean default: false

If true the reference will be persisted in the scene. That means all the data of the current loaded nodes will be saved in the scene, and the references will load the next time the master scene is loaded even if the referenced file is not present. This makes the master scene bigger and slower to save.


<smartref>.persistReloadType Integer default: 1

With this property you can select how the reference is reloaded at Scene Load. This takes effect only if persistRef is on. It can be one of the following values:

0 - Reload Always
1 - Reload if file has changed
2 - Reload Manually


<smartref>.overlay Boolean default: false

If true the reference wont load when nested.