Modifier Stack Related Methods

validModifier [<node> | <objectset> | <group> ] <modifier |modifier_class> 

Tests whether a particular modifier or modifier class might be added the given <node> or to all of the objects in the objectset or group. Returns true if so, false if not.

The validModifier() method operates exactly as does the Modify panel in determining modifier applicability. Any modifier that takes a deformable object will return true for all scene objects except Helpers. This corresponds to the Modify panel's behavior of allowing modifiers such as, Bend, Taper, and so on to be applied to lights and cameras, space warp objects, and others as well as geometry types such as, box, sphere, and so on, but not helpers such as, dummys or bones.

The validModifier() method will return true if an empty <objectset> is specified, or if a <group> is specified and the modifier is valid for all members of the group. In these cases, applying the modifier using the addModifier() method will fail because the <objectset> is empty in the first case or the modifier cannot be applied to the dummy object that is the parent object of the objects in the group. You will need to test for these conditions in your script or use the modPanel.addModToSelection() method described in Modify Panel.

addModifier <node> <modifier> [before:index] -- mapped 

Applies the modifier to all instances of the node(s) to which the function is applied. The optional before: keyword argument can be used to insert the modifier into the node's modifier stack just before the indexed modifier, counting from the top of the stack.

Since 3ds Max 3, addModifier() does not preserve the sub-object selection that might be active in the modifier stack when adding the modifier. If you want to add a modifier and preserve the sub-object selection, use the modPanel.addModToSelection() method described in Modify Panel.

If <node> is a collection, an instance of the modifier is placed on each of the nodes in the collection. Unlike interactively applying a modifier to a selection, the position and size of each modifier instance's gizmo corresponds to position and size of the node the modifier instance is applied to. To apply a modifier to a collection in the same manner that 3ds Max applies modifiers, use the modPanel.addModToSelection() method described in Modify Panel.

Note: This method does not copy any local data, so, for example, using it to copy a modifier on an existing node that has been manipulated to another node will not also copy the changes. See addModifierWithLocalData() below to handle this situation.

Also see Modifier and SpacewarpModifier for more details.

addModifierWithLocalData <destnode> <dest modifier> <srcnode> <src modifier_or_index> [before:index]

This method copies the destination modifier to a destination node. The two modifiers must be of the same type. The local data of the source (if any) is cloned and attached to the destination modifier. If the source modifier has no local data, the destination modifier will contain whatever its default local data is (just as if it had been added by the addModifier() method).

For example:

addModifierWithLocalData destNode srcMmodifier srcNode srcMmodifier -- instance the modifier
addModifierWithLocalData destNode (copy srcMmodifier) srcNode srcMmodifier -- copy the modifier
addModifierWithLocalData destNode ((classof srcMmodifier)()) srcNode srcMmodifier -- new instance of the modifier's class
deleteModifier <node> <modifier_or_index> -- mapped 

Lets you delete modifiers from the modifier stack. Takes either a modifier value that is present on the <node> stack, or an index specifying the index of the modifier to delete, counting from the top of the stack.

collapseStack <node> -- mapped 

Collapses the modifiers out of a stack, leaving a resultant editable base object corresponding to the class of the node(s) on top of their stack. If there are no modifiers in the stack when this is called, no action is taken. If you want to force an object to be an editable mesh, use the function convertToMesh() .