Interface: LayerManager

Interfaces > Core Interfaces > LayerManager

 

   

Core Interfaces - Quick Navigation

This Core Interface exposes the Layer Manager to MAXScript.

   

Properties:

LayerManager.count : integer : Read 	 

Get the number of layers in the scene

   

LayerManager.current : Interface : Read   

Returns a LayerProperties MixinInterface to the current layer.

   

Methods:

<Interface>LayerManager.getLayer <integer>which 

Returns a LayerProperties MixinInterface to the indexed layer.

The index is 0-based.

   

<Interface>LayerManager.newLayer() 

Creates a new Layer and returns a LayerProperties MixinInterface to it.

   

<Interface>LayerManager.getLayerFromName <string>name 

Returns a LayerProperties MixinInterface to the layer with the given name.

   

<Interface>LayerManager.newLayerFromName <string>name 

Creates a new layer with the given name and returns a LayerProperties MixinInterface to it.

   

<void>LayerManager.editLayerByName <string>name 

Enters editing mode for the layer with the given name.

   

<boolean>LayerManager.deleteLayerByName <string>name 

Deletes the layer with the given name.

Returns True if layer deleted, false otherwise.

A layer can only be deleted if no nodes are in the layer and the layer is not the currently active layer.

   

<void>LayerManager.closeDialog() 

Closes the Layer Manager dialog.

   

<boolean>LayerManager.isDialogOpen() 

Returns true if the Layer Manager dialog is open, false otherwise.

   

<void>LayerManager.layerPropDialog <&maxObject array>layerList 
       layerList is In and Out parameter

Opens the Layer Property Dialogs of the LayerProperties MixinInterfaces passed in a by-reference array.

Available in 3ds Max 2015 and higher.

   

<ReferenceTarget>LayerManager.getLayerObject {<integer layer_index>|<string layer_name>} 

Returns the specified layer as a ReferenceTarget.

layer_index is 0-based, layer_name is case-insensitive.

Available in 3ds Max 2008 and higher. Previously available in the Avguard Extensions.

NOTE:

Deprecated.

Use the LayerProperties interface's .layerAsRefTarg property instead.

Provided for backwards compatibility with scripts written using the Avguard Extension in previous versions of 3ds Max.

   

<bool>LayerManager.doesLayerHierarchyContainNodes <string>name

Returns True if the Layer Hierarchy of the specified Layer Name contains nodes.

Returns False if the Layer Hierarchy of the specified Layer Name does not contain nodes, or if the specified Layer Name does not exist.

Available in 3ds Max 2016 and higher.

   

<bool>LayerManager.deleteLayerHierarchy <string>name forceDelete:<bool>
forceDelete default value: false

Deletes the Layer Hierarchy of the specified Layer Name. If the Active layer was deleted, the default "0" layer will become the Active layer. When the optional keyword forceDelete: is set to False or is not supplied, only deletes empty layers.

When the optional keyword forceDelete: is set to True, layers with nodes will be deleted and the nodes will be moved to the default "0" layer.

Returns True if the deleting was successful.

Returns False if the deleting failed because the hierarchy contained nodes while forceDelete: was set to False or not specified, or if the specified Layer Name does not exist.

Available in 3ds Max 2016 and higher.

   

<bool>LayerManager.getDuplicateLayerWithoutSameHierarchyOnMerge()

Returns the state of the option controlling whether to duplicate a layer when merging if a layer to be merged has the same name but different hierarchy as an existing layer in the scene.

When set to True, a duplicate layer will be created.

When set to False, no duplicate will be created.

Available in 3ds Max 2016 and higher.

   

<void>LayerManager.setDuplicateLayerWithoutSameHierarchyOnMerge <bool>duplicateLayerWithoutSameHierarchyOnMerge persist:<bool>
persist default value: true

Sets the state of the option controlling whether to duplicate a layer when merging if a layer to be merged has the same name, but different hierarchy as an existing layer in the scene.

When set to True, a duplicate layer will be created.

When set to False, no duplicate will be created.

When the persist: optional argument is set to True or omitted, the setting will persist between sessions.

When the persist: option is set to False, the setting will affect only the current session.

Available in 3ds Max 2016 and higher.

   

EXAMPLE

for i = 0 to layerManager.count-1 do
(
  ilayer = layerManager.getLayer i
  layerName = ilayer.name
  layer = ILayerManager.getLayerObject i
  layerNodes = refs.dependents layer
  format "Layer: %; nodes: %\n" layerName layerNodes
)

LayerManager Interfaces:

Interface: LayerProperties

Interface: LayerProperties

See Also