MAXScript Language Reference > 3ds Max Objects > Node : MAXWrapper > Node Common Properties, Operators, and Methods >

# Node Common Properties, Operators, and Methods

Value > MAXWrapper > Node

The following properties and methods are applicable to any value that is derived from Node.

Topic Navigation: |
--- | ---
Constructors Methods Render-Related Methods Group-Related Methods Node Viewport State Methods Node Selection Methods Modifier Stack Related Methods Node Modifier Transform Context Methods | Node Deformable Methods Node Bounding Box Methods Node Conversion Methods Node Utility Methods Node User Properties Methods Node Inverse Kinematics Methods Miscellaneous Node Methods

Constructors:

| Back To Topic Navigation

    <non_wild_card_pathname>

identifies a unique node in the scene

    <objectset>[<integer>]
    <wild_card_pathname>[<integer>]

n'th scene object in collection

    <node_constructor> [name: <string> ] \
    [ prefix: <string> ] \
    [ material: <material> ] \
    [ target: <node> ] \
    [ pos: <point3> ] \-- default [0,0,0]
    [ position: <point3> ] \-- synonym for pos
    [ rotation: <quat> ] \-- default 0 rotation
    [ scale: <point3> ] \-- default 100% scale
    [ pivot: <point3> ] \-- default normal node pivot location
    [ transform: <matrix3> ] \-- default identity
    [ isSelected: <boolean> ] \-- default false
    [ dir: <point3> ]-- set local z direction

The position and rotation values are relative to the current active grid if'coordsys grid'is the current working coordinate system.

A <node_constructor> is one of the scene node classes listed in Node Subclasses, such as box, sphere, quadPatch, splineShape, etc.

FOR EXAMPLE:
    b = box name:"foo" position:[10,10,10] height:20

All of the node constructors can take the above optional keyword arguments, along with any of general node properties or any of the properties for the particular node class as keyword arguments.

The name keyword can be used to specify the name for the created node. 3ds Max allows the same name to be used for more than one node.

The prefix keyword can be used in place of the name keyword argument to specify the start of the node name from which 3ds Max will generate a unique name by adding a series of digits, as it does when creating objects interactively.

FOR EXAMPLE:
    for i in 1 to 100 do sphere prefix:"baz"
    --creates 100 spheres, giving each a unique name
    --beginning with "baz", such as $baz01, $baz02, $baz03, etc.

The material keyword can be used to apply the specified material to the created node.

The target keyword can be used to automatically apply a LookAt controller to the node's transform track, and set the specified node as the LookAt target.

The transformation arguments, pos , scale , rotation , and pivot , are applied to the new object in the order they are specified in the constructor call, so you can control transform order. The pos , scale , and rotation arguments are mutually exclusive with the transform argument which can be used as an alternative way to set the node's complete transform matrix in one go.

Note

Exercise care if you specify the target keyword. When you specify a target object, 3ds Max stores with the target object the last object it was assigned as a target of. If you delete the target object, the behavior of 3ds Max is to also delete the object looking at it. If the target object is a targetobject class object, deleting an object looking at it will also delete the target object, even if another object is also looking at it.

The performance of iterating and indexing the 'selection' and '$' object sets has been substantially improved in 3ds Max 4. In versions prior 3ds Max 4, the whole scene was traversed looking for selected nodes when indexing, iterating or snapshotting into an array, causing big delays in large scenes. Now, the 'selection' object set uses direct access to the SDK explicit current selection set.

Properties

See General Node Properties and Node Transform Properties for details about the properties accessible on scene nodes.

Methods

| Back To Topic Navigation

Most node methods are automatically mapped over node collections.

    IsValidNode <var>

Returns true if <var> is a node value, and the node has not been deleted. Otherwise, it returns false .

    move <node> <point3> -- mapped
    scale <node> <point3> -- mapped
    rotate <node> <angle> <axis_point3> -- mapped -- angle in degrees
    rotate <node> <quat> -- mapped
    rotate <node> <eulerangles> -- mapped

all the transform operations operate in the current working coordinate system. See Context Expressions.

    copy <node> -- mapped
    reference<node> -- mapped
    instance<node> -- mapped

All the clone operations can take any of the standard node creation optional keyword arguments which are applied after the node has been copied.

These functions clone all the original node's transform controllers and keys and the visibility controller and its keys if a visibility track has been assigned.

Note maxOps.cloneNodes is the preferred way to copy, instance, or reference nodes. Node interdependencies are retained, and more of the node properties are copied across.

    snapshot <node> -- mapped

This function provides functionality similar to the SnapShot tool in 3ds Max. It generates a new node that contains a copy of the world-state mesh of the source <node> at the time that the snapshot is made. Any existing modifiers are collapsed out of the new node and the mesh snapshot accounts for any space warps currently applied. As with the clone methods (copy, reference and instance,) you can add any of the standard node creation keyword arguments, such as pos: , name: , etc.

The following example achieves an animation-based snapshot similar to the SnapShot tool in 3ds Max:

FOR EXAMPLE:
    for t in 0 to 100 do at time t snapshot $foo

    delete <node> -- mapped

Deletes the specified node(s).

    instanceReplace <dest_node> <src_node> -- mapped
    referenceReplace <dest_node> <src_node> -- mapped

Lets you turn existing nodes into instances and references to other nodes. You can use these, for example, to replace the geometry of one node with another, perhaps for implementing custom level-of-detail tools.

The <dest_node> is turned into an instance or reference to the <src_node> . As a new instance, existing geometry and modifiers are removed and replaced by the <src_node> 's, but all the node-related properties are kept, such as material, transform, visibility, name, etc. As a new reference, the base object for the <dest_node> becomes the world-state of the <src_node> , such that any changes to the src_node will affect the <dest_node> , but changes to the <dest_node> are local to it.

It is possible to develop a custom scripted version of the File/Replace function with these functions and the mergeMAXFile() function by temporarily changing the name of a node in the current scene, merging in that named node from another, making the first node an instance of the newly merged node with instanceReplace() , deleting the newly merged node and renaming the old node back again.

Both these functions are collection mapped, so you can make a selection of objects all instance or reference the same object,

FOR EXAMPLE:
    instanceReplace $foo* $baz
    --makes all the foo* objects be instances of baz's geometry
    --and modifier stack.

    areNodesInstances <node> <node>

Returns true if the two nodes are instances.

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

FOR EXAMPLE:
    InstanceMgr.GetInstances $ &rptInstances
    trueInstances = for n in rptInstances where\
    (areNodesInstances $ n) collect n

    attachObjects <node1> <node2> [move:<boolean> ]

Makes <node2> a child of <node1> . Resets the current location of <node2> to the location of <node1> unless move:false is specified.

    getTMController <node>

Returns the transform controller for the node.

    bindSpaceWarp <node> <spacewarp_node>

Binds the scene node to the space warp object scene node. Space warp bindings show up in the modifier stack and can be accessed like any other modifier. Use the deleteModifier()function to unbind objects from space warps. See Modifier and SpacewarpModifierfor more information about working with the modifier stack.

    getPolygonCount <node>

Returns a 2 element array containing the current number of faces for the node in the first element, and the current number of vertices for the node in the second element. The number of faces and vertices returned are the number that would be present if the node was converted to a mesh object.

    isShapeObject <node>

Returns true if the node is a shape object, false otherwise

    numSurfaces <node>

Returns the number of parametric surfaces in the object. At the current time, Loft objects are the only objects where more than one surface is present (ie. loft of a donut).

    isSurfaceUVClosed <node> <surface_index_integer>

Returns a 2 element array indicating if the parametric surface is closed in the U and V dimensions (ie. a torus is closed in both U and V). Note that not all objects have this method implemented, and will return a default value of #(true, true) .

    getTransformAxis (<node>|undefined) <index>

Returns the transform axis of the indexed axis system of the node as a<matrix3>value. Normally a node just has 1 transform axis. In some cases (like being in the Local Reference Coordinate System, in object SO mode, and having multiple SO selected), multiple transform axes exist. If index > the number of transform axis, the transform for the first transform axis is returned.

If the firstargument is the value'undefined'(instead of a node), the viewport common axis is returned instead. If the Coordinate System Center (getCoordCenter()) is #local or the Reference Coordinate System (getRefCoordSys()) is #local, #parent, or #gimbal, the last calculated common axis is returned.

The transform returned by this method can be used in an "in coordsys" context and an "about" context to move, rotate, or scale an object about the current 3ds Max UI Reference Coordinate System and Center.

FOR EXAMPLE:
    fn axisRotate obj rotation =
    (
    local axis
    local objA =if classof obj == objectSet or classof obj == array then obj else #(obj)
    if getCoordCenter() != #local then
    (
    axis = getTransformAxis objA[1] 0
    for obj1 in objA do in coordsys axis about axis rotate obj1 rotation
    )
    else
    (
    for obj1 inobjA do
    (
    axis = getTransformAxis obj1 0
    in coordsys axis about axis rotate obj1 rotation
    )
    )
    )

    invalidateTM <node> -- mapped

Invalidates the node's transformation matrix cache.

    invalidateTreeTM <node> -- mapped

Invalidates the node's transformation matrix cache and notify the node's subtree that the transformation matrix has changed.

The following MAXScript function can be used to force an update of an object whose transform is partially controlled by a scripted controller (such as a script controller on the position track):

FOR EXAMPLE:
    mapped fn TMInvalidate obj =
     ( attime(currenttime-1) obj.transform
     nodeInvalRect obj
     invalidateTreeTM obj
     redrawViews()
     )

    getNodeTM {<node> | <rootnode>}

Returnsthetransformation matrixofthe givennode or rootnode as a Matrix3value. The rootnode may be the root node of an XRef Scene object.Available in 3ds Max 2008 and higher. Previously available in the Avguard Extensions.

    invalidateWS <node> -- mapped

Invalidates the node's world space cache.

    getNodeByName <string> exact:<bool> ignoreCase:<bool> all:<bool>

Returns first node with the specified name. If exact is false(default), the normal MAXScript node name comparisons are performed.

ignoreCase specifies whether the comparisons should be case sensitiveor not.When set to true, non-case-sensitive comparison will be performed.

If all is true, an array of nodes with the specified name is returned.

Default is exact:false ignoreCase:true all:false

NoteWhen Fast Node Name Lookup is on, case sensitive comparisons are done first, case insensitive comparisons (if enabled) are done second, and then inexact matching (if enabled). If Fast Node Name Lookup is off, the first node found that matches the conditions is returned. So if you have 2 nodes called "AA" and "aa", and you say: 'getnodebyname "AA"', if Fast Node Name Lookup is on you will always get node AA back. If Fast Node Name Lookup is off, you can get either node back because both nodes match the conditions.

EXAMPLE:
    --If you have a scene with 3 nodes: "AA", "aa", and "B B":

    $AA
    $Box:AA @ [...]
    $aa
    $Teapot:aa @ [...]
    $bb
    Sphere:B B @ [...]

    getnodebyname "AA" exact:true
    $Box:AA @ [...]
    getnodebyname "AA" exact:false
    $Box:AA @ [...]
    getnodebyname "AA" ignoreCase:true
    $Box:AA @ [...]
    getnodebyname "AA" ignoreCase:false
    $Box:AA @ [...]

    getnodebyname "Aa" exact:true
    $Box:AA @ [...]
    getnodebyname "Aa" exact:false
    $Box:AA @ [...]
    getnodebyname "Aa" ignoreCase:true
    $Box:AA @ [...]
    getnodebyname "Aa" ignoreCase:false
    undefined

    getnodebyname "aa" exact:true
    $Teapot:aa @ [...]
    getnodebyname "aa" exact:false
    $Teapot:aa @ [...]

    getnodebyname "B B" exact:true
    $Sphere:B B @ [...]
    getnodebyname "B_B" exact:true
    undefined
    getnodebyname "BB" exact:true
    undefined
    getnodebyname "B_B" exact:false
    $Sphere:B B @ [...]
    getnodebyname "BB" exact:false
    $Sphere:B B @ [...]

    getnodebyname "AA" all:true
    #($Teapot:aa @ [...], $Box:AA @ [...])

    snapshotAsMesh <node>

Returns world state of node as a <mesh> value.

    getInheritanceFlags <node>
    setInheritanceFlags <node> (#all|#none| <bitarray>) keepPos:<boolean>-- mapped

Get and set the inheritance flags for the specified node as an<bitarray>.

If a bit is on, the corresponding inheritance is turned on. The order of the bits is:#{POS_X,POS_Y,POS_Z,ROT_X,ROT_Y,ROT_Z,SCALE_X,SCALE_Y,SCALE_Z}

If keepPos:false is specified, the node may move when an inheritance is turned on or off.

    getTransformLockFlags <node> -- mapped
    setTransformLockFlags <node> (#all|#none| <bitarray>)-- mapped

Set and set the transform lock flags for the specified node as an<bitarray>.

If a bit is on, the corresponding transform lock is turned on. The order of the bits is:#{POS_X,POS_Y,POS_Z,ROT_X,ROT_Y,ROT_Z,SCALE_X,SCALE_Y,SCALE_Z}.

If #all is specified instead, all locks will be checked.

If #none is specified, all locks will be unchecked.

See How To ... Develop A Transform Lock Script for an example.

## Render-Related Methods

| Back To Topic Navigation

    getVisController <node>

Returns an instance of the node's visibility controller. Returns undefined if the node does not have a visibility track.

    getInheritVisibility <node>

Returns true if the node inherits the visibility of its parent object (if any), false if not.

    setInheritVisibility <node> <boolean>

Sets whether the node inherits the visibility of its parent object (if any). If < boolean> is true , node inherits visibility. If <boolean> is false the node does not inherit visibility.

    getImageBlurMultController <node>

Returns the node's Image Motion Blur Multiplier controller. Returns undefined if not Image Motion Blur Multiplier controller has been assigned to the node.

    setImageBlurMultiplier <node> <time> <number>

Sets the node's Image Motion Blur Multiplier value at the specified time to the specified value.

    setImageBlurMultController <node> <controller>

Sets the node's Image Motion Blur Multiplier controller to the specified controller.

    setMotBlur <node> <integer>

Sets which type of motion blur to use for node. If <integer> = 1, None. If <integer> = 2, Object Motion Blur. If <integer> = 3, Image Motion Blur.

    setRenderable <node> <boolean>

Sets whether the node is renderable. If <boolean> is true , node is renderable. If <boolean> is false the node is not renderable.

    getRenderID <node>

Returns the RenderID of the node. A value of 65535 is returned if the scene has not yet been rendered, or the node is not renderable. The RenderIDs of the nodes are output to the NODE_RENDER_ID g-buffer channel by the renderer.

    setRenderID <node> <integer>

Sets the RenderID of the node to the specified value. This value is not "sticky" - it is not saved with the scene, and it will be replaced by the renderer when the next render occurs.

## Group-Related Methods

| Back To Topic Navigation

    group <node_collection> [name:<string> ] [prefix:<string> ] [select:<boolean> ]

Makes a group of the given nodes and returns the group node. You can optionally specify the group name or group name prefix. Not specifying a name or specifying a group name prefix ensures that the group name assigned is unique. Specifying select:true selects the group after it is made.

FOR EXAMPLE:
    group $box* name:"boxes"--makes a group of all box*'s named "boxes".
    group selection--groups current selection.

    ungroup <group_head_node> -- mapped

Ungroups one level of a group node.

FOR EXAMPLE:
    ungroup $group01--ungroups group $group01

    explodeGroup <group_head_node> -- mapped

Ungroups all levels in a group node.

    attachNodesToGroup <node_collection> <targetNode>

Attaches a node collection to an existing group. Nodes that are already members of a group cannot be attached to another group.

<node_collection> is an array of nodes to be attached to the group of targetNode.

<targetNode> must be a group member or a group head node and cannot be a member of <nodeCollection>.

Available in 3ds Max 2010 and higher.

    detachNodesFromGroup <node_collection>

Detaches the specified nodes from the groups they belong to.

<node_collection> is an array of nodes that should be detached from their group heads. All members of <nodeCollection> must be open group members.

Available in 3ds Max 2010 and higher.

    isGroupHead <node>

Returns true if node is group head, false otherwise.

    isOpenGroupHead <node>

Returns true if <node> is the head of a group, and that group is open.

    isGroupMember <node>

Returns true if node is in a group, false otherwise.

    isOpenGroupMember <node>

Returns true if <node> is a member of a group, and that group is open.

    setGroupOpen <group_head_node> <boolean>

Sets whether the group is set as open or closed. If <boolean> is true , the group is set as open. If <boolean> is false the group is closed.

WARNING!
Use the following methods with care! You can place nodes in states that are impossible to accomplish using the 3ds Max user interface.

    setGroupMember <node> <boolean>

Sets whether the node is a group member or not. If <boolean> is true , node is set as a group member. If <boolean> is false , and the node is a group member, the node is set as not being a group member and is unlinked from the group head.

Note

If you set a node to be a group member using this method, you need to set the node to be a child of a group head. Otherwise, the node name is not shown in the Select By Name dialog.

FOR EXAMPLE:
    setGroupHead $dummy01 true
    append $group03.children $dummy01

    setGroupHead <node> <boolean>

Sets whether the node is flagged as a group head or not. If <boolean> is true , node is flagged as a group head. If <boolean> is false , the node is set as not being a group head.

Note

If you flag a node as a group head using this method, the node's mesh will not be displayed in the viewports, and its properties will not be shown in the Modify panel. If you flag a group head node as not being a group head using this method, you will not be able to Open or Explode the group via the Group menu command.

FOR EXAMPLE:
    -- create a set of spheres, group them, and test group head and member of group
    mySpheres=for i = 1 to 5 collectsphere pos:(random [-100,-100,0] [100,100,0])
    group MySpheres name:"MyGroup"
    isGroupHead $MyGroup-- returns true
    isGroupMember $sphere01-- returns true
    -- check to see if group is open. Open group and test member of group
    isOpenGroupHead $MyGroup-- returns false
    setGroupOpen $MyGroup true
    isOpenGroupMember $sphere01-- returns false
    -- create a new set of spheres, append the group to the set, and then group them all
    NewSpheres=for i= 1 to 3 collectsphere pos:(random [-100,-100,0] [100,100,0])
    append NewSpheres $MyGroup
    group NewSpheres name:"BiggerGroup"
    -- open the group head, test member of group, and then close the groups.
    setGroupOpen $BiggerGroup true
    isOpenGroupMember $MyGroup
    setGroupOpen $MyGroup false
    setGroupOpen $BiggerGroup false

## Node Viewport State Methods

| Back To Topic Navigation

    hide <node> -- mapped

Hides the specified node or node collection.

    unhide <node> [doLayer:<boolean>] -- mapped

Unhides the specified node or node collection.

If the optional doLayer keyword is set to true and the node is in a layer that is hidden, the entire layer is unhidden. When false (the default), just the node is unhidden.

    freeze <node> -- mapped

Freezes the specified node or node collection.

    unfreeze <node> [doLayer:<boolean>] -- mapped

Unfreezes the specified node or node collection.

If the optional doLayer keyword is set to true and the node is in a layer that is frozen, the entire layer is unfrozen. When false (the default), just the node is unfrozen.

    flagForeground <node> <boolean> -- mapped

Controls the disposition of scene nodes in the viewport foreground/background planes, so you can influence interactive performance on a node. Nodes placed in the foreground plane are redrawn individually and so interactive changes to them through spinners in scripted rollout panels are much faster.

The boolean argument puts the scene node(s) into the foreground plane if true , or into the background plane if false . You should be judicious in putting nodes in the foreground plane, because putting too many objects in the foreground plane reduces the foreground plane's effectiveness. Remember to unflag objects when you don't need to interactively control them any more.

    getTrajectoryOn <node>

Returns true if Trajectory is shown for the node, false otherwise.

    setTrajectoryOn <node> <boolean>

Sets whether Trajectory is shown for the node. If <boolean> is true , Trajectory is shown. If <boolean> is false , Trajectory is not shown.

    isBoneOnly <node>

Returns true if the node's showLinksOnly property is true .

    getCVertMode <node>

Returns true if node is displayed using vertex colors in shaded viewports, false otherwise.

    setCVertMode <node> <boolean>

Sets whether to display the effect of assigned vertex colors for the node in shaded viewports. If <boolean> is true , node is displayed using vertex colors. If <boolean> is false , node is displayed using the material or wireframe color.

    getShadeCVerts <node>

Returns true if the vertex color display for the node is shaded in the viewports, false otherwise.

    setShadeCVerts <node> <boolean>

Sets whether the vertex color display for the node is shaded in the viewports. When true , the colors are unshaded and appear in their pure RGB values. When false , the colors appear like any other assigned color in the viewports.

## Node Selection Methods

| Back To Topic Navigation

    select <node> -- mapped

Deselects any currently selected objects and then selects the node(s) you specified.

    selectMore <node> -- mapped

Adds the node(s) to the set of selected objects. If you want to build a set of selected objects from scratch in a loop, you can use clearSelection() to clear the selection before entering the loop, and use selectMore() in the loop to add objects to the set of selected objects.

    clearSelection() clearNodeSelection [redraw:<boolean> ]

Deselects all currently selected scene nodes. Scene is redrawn unless redraw:false is specified.

    deselect <node>-- mapped

Deselects the given node(s).

FOR EXAMPLE:
    deselect $box*--deselects all items whose names start with "box".

    deselectNode <node>

Deselects a single node.

## Modifier Stack Related Methods

| Back To Topic Navigation

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

Tests whether a particular modifier or modifier class may 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, etc. to be applied to lights and cameras, space warp objects, etc., as well as geometry types like box, sphere, etc., 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 because 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.

Also see Modifier and SpacewarpModifier for more details.

    deleteModifier <node> <modifier_or_index> -- mapped

Lets you delete modifiers from the modifier stack. Takes either a modifier value which 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 resultanteditable base object corresponding to the classof 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() .

## Node Modifier Transform Context Methods

| Back To Topic Navigation

    getModContextTM <node> <modifier>

Returns a Matrix3 value giving the modifier's context transform for the local coordinates used in modifier sub-object gizmos.

Accessing the transform properties of a modifier sub-object such as a gizmo or a center in MAXScript yields values that are relative to that modifier's context transform, equivalent to the values shown in track view for those properties. If the modifier is not operating on a sub-object selection, such as a face or vertex selection, or if the modifier was interactively applied to an object selection, this context TM is the local coordinate space of the object itself. However, if the modifier is operating on either an object selection set or a sub-object selection, the context transform gives the position and orientation of that selection, and so you can use the getModContextTM() function to get the world-space transform properties of any of its sub-objects.

    setModContextTM <node> <modifier> <matrix3>

Sets the modifier context transformation matrix of the specified modifier on the given node.

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

    getModContextBBoxMin <node> <modifier>
    getModContextBBoxMax <node> <modifier>

These functions complement the getModContextTM() function and can be used to derive the world-space coordinates of the bounding box of the modifier context. This can be used, for example, to determine the bounds of a modifier operating on a sub-selection or the bounds of an FFD lattice. This is particularly useful for scripting FFD control point placement, since these control points live in a 0-to-1 lattice space—the mod context bounding box gives the world space bounds of this lattice space allowing you to compute scaled lattice space coordinates from world coordinates. The functions return Point3 values for the minimum and maximum extents of the bounding box.

    setModContextBBox <node> <modifier> <point3 min> <point3 max>

Sets the modifier context bounding box of the modifier on the given node to the specified minimum and maximum values.

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

See Modifier Sub-Object Transform Properties for examples of using the above methods.

## Node Deformable Methods

| Back To Topic Navigation

    isDeformable <node>

Returns true if the node's object is deformable. Available in 3ds Max 2008 and higher.

Previously available in the Avguard Extensions.

WHAT ARE DEFORMABLE OBJECTS?
A deformable object is an object with points that can be modified. Internally, these points can be stored in any form the object wants. They are accessed through a virtual array interface with methods to get and set the 'i-th' point. This abstraction layer allows 3ds Max to apply the same modifiers to the various Geometry classes like Editable Meshes, Editable Poly, Splines, Patches and Nurbs without specific knowledge of the internal structures of these classes. The modifier simply operates on points provided by the object via the virtual array interface methods, but these points could be vertices, Bezier spline knots and tangents, Patch knots and tangents and so on. See the simpleMod Scripted Plugin for a scripted modifier that can operate on points in this manner by implementing the 'on map <index> <point> do' handler.

Note

While isDeformable might return true for some nodes, this does not necessarily mean that they can be deformed. For example, all legacy particle systems like Snow, Superspray and Blizzard return true but are not being affected by deformations, while all geometry primitives return false but can be deformed.

The method simply wraps the SDK method and returns the value provided by the object when asked wether it is deformable or not.

FOR EXAMPLE:
    for g in geometryClass.classes do
    (
     try
     (
     o = execute (gasstring +"()")
     if isDeformable o then
     format "% is Deformable.\n" g
     else
     format "% is NOT Deformable.\n" g
     )catch(format "Failed To Create %\n" g)
    )

    numPoints <node>

Returns the number of deformable points for the node's object.Available in 3ds Max 2008 and higher. Previously available in the Avguard Extensions.

    getPointPos <node> <index>

Returns the position of the indexed point for the node's object. Position is returned in current coordinate system.Available in 3ds Max 2008 and higher. Previously available in the Avguard Extensions.

## Node Bounding Box Methods

| Back To Topic Navigation

    nodeGetBoundingBox <node> <matrix3>

Returns a 2 element array containing the min and max points of the node's bounding box in coordinate system matrix3 as point3 values. Positions returned are always in the specified matrix3 coordinate system.

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

FOR EXAMPLE:
    --Create a teapot and a camera (turn on Orthographic Projection). Run:
    bb= nodeGetBoundingBox $teapot01 $camera01.transform
    in coordsys$camera01 point pos:bb[1]
    in coordsys$camera01 point pos:bb[2]
    --Note that this does not correct for the camera's FOV.

    nodeLocalBoundingBox <node>

Returns a 2 element array containing the min and max points of the node's local bounding box. Positions returned are in the current coordinate system.

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

FOR EXAMPLE:
    --Create a teapot. Run:
    bb= nodeLocalBoundingBox $teapot01
    point pos:bb[1]
    point pos:bb[2]

## Node Conversion Methods

| Back To Topic Navigation

    convertToMesh <node> -- mapped

This function converts appropriate scene object types into Editable Meshes. It is similar to collapseStack() in that it will remove all modifiers present, but unlike collapseStack() it will always replace the base object with an editable mesh version, even if there are no modifiers present.

convertToMesh() can be applied to any object that an Edit Mesh modifier can work on, such as geometry and shapes, but not helpers, space warps, lights, etc. If the object cannot be converted, the function returns undefined .

    convertToSplineShape <node> -- mapped

Converts the given scene node to a SplineShape object. If the object cannot be converted (typically, if it is not a shape), the function returns undefined . Any modifiers present will be collapsed. The collapseStack() function can also be used as can the collapse button in the modifier stack dialog in 3ds Max; both generate a SplineShape, but will only do so if there is at least one modifier present.

    canConvertTo <node> <class>

Allows you to test whether a given node is convertible into a given class. Returns true or false .

FOR EXAMPLE:
    if canConvertTo $foo NURBSSurface then...

The kinds of classes you can convert objects to are the generic editable forms including Mesh, SplineShape, NURBSCurve, NURBSSurface, etc.

    convertTo <node> <class> -- mapped

This function is a general form of the existing specific conversion functions such as convertToMesh() , convertToSplineShape() , etc.

convertToSplineShape() can be writtenas:

FOR EXAMPLE:
    convertTo $circle01 SplineShape

If the conversion is not supported, the function returns the value undefined.

    convertToNURBSSurface <node> -- mapped
    convertToNURBSCurve <node> -- mapped

These functions work on those primitive geometry and shape classes that support conversion to NURBS (such as boxes, spheres, circles, lines, etc.). If an object does not support conversion, the function returns undefined.

## Node Utility Methods

Topic Navigation

    isDeleted <MAXWrapper_object>

This function yields the result true if the object has been deleted and false if it still exists in the scene. Using the function only makes sense in situations where references to 3ds Max objects are held in variables or arrays or passed as parameters and you want to determine whether the object has been deleted from the scene. Performing an operation on a deleted 3ds Max object referenced in a variable or array otherwise generates an exception. Any kind of 3ds Max object can be tested in this way, scene objects, modifiers, controllers, materials, etc.

FOR EXAMPLE:
    sel = selection as array-- snapshot selection
    ...
    -- <one or more objects in the selection are deleted,
    -- by the user or other scripts>
    ...
    for obj in sel
    where not isDeleted objdo
    move obj [10,0,0]

When a node has been deleted,

<node> == undefined returns false

<node> != undefined returns true,

FOR EXAMPLE:
    if mynode != undefined and not isdeleted myNode do...

    distance <node> <node>

Computes the distance between the pivot points of the two specified nodes.

    intersectRay <node> <ray>

Computes the closest intersection of the ray and the surface of the given node. Returns another Ray which defines the position of intersection in 3D space and the surface normal direction vector at that point. The intersection test respects the face normals of the node, i.e. if a face's normal points away from the ray's source, an intersection test is not performed on that face . intersectRay() works if the world state of the node (the state of the node at the top of the node's stack) has a surface, such as an editable mesh, a Standard, Extended, or Compound Primitive, or a Patch or NURBS surface object. Splines and NURBS curves do not have a surface. Returns undefined if the ray doesn't intersect the node, the faces it does intersect point away from the ray's position, or the node does not have a surface.

    intersectRayEx <node> <ray>

Takes a ray and computes the closest intersection to the surface of the given node. It returns an array with the following three elements.

1. A Ray defining the position of intersection in 3-space and the surface normal direction vector at the point.

2. The index of the face the ray intersects with

3. The barycentric coordinates of the face that was hit.

This method only works if the world state of the node is a mesh, either because it started as an editable mesh or because it has modifiers applied that convert the node to a mesh. Unlike intersectRay() , this method will not work if the node is a Standard or Extended Primitive - the node's stack must evaluate to a mesh. The intersection test respects the face normals of the node, i.e. if a face's normal points away from the ray's source, an intersection test is not performed on that face. Returns undefined if the ray doesn't intersect the node, the faces it does intersect point away from the ray's position, or the node isn't a mesh.

WHAT ARE BARYCENTRIC COORDINATES?
Barycentric coordinates are the coordinates relative to the triangular face. The barycentric coordinates of a point p relative to a triangle describe that point as a weighted sum of the vertices of the triangle. If the barycentric coordinates are b0 , b1 , and b2 , then
    p = b0*p0 + b1*p1 + b2*p2
where p0 , p1 , and p2 are the positions of the vertices of the triangle. The Point3 returned by this method has the barycentric coordinate stored in its three component values. The coordinate is relative to the triangular face that was intersected. Barycentric coordinates can also be used to interpolate any quantity whose value is known at the vertices of the triangle.

Following is an example of finding the UV coordinates at the intersection point:

FOR EXAMPLE:
    s = sphere material:(standardMaterial diffuseMap:(checker()))
    showTextureMap s.material s.material.diffuseMap on
    --
    -- Add a normal modifier to make the sphere into a mesh
    addModifier s (normalModifier())
    r = ray [-100,5,0] (s.center-[-100,5,0])
    --
    -- Get the Intersection details
    arr = (intersectRayEx s r)
    --
    -- Create a dummy at the point of intersection
    dummy pos:(arr[1]).pos
    --
    -- Get the texture face
    tf = getTVFace s arr[2]
    --
    -- Get the UVW verts of the face
    tv1 = getTVert s tf.x
    tv2 = getTVert s tf.y
    tv3 = getTVert s tf.z
    --
    -- Calculate the texture vertices at point of intersection from
    -- the barycentric coordinates
    tv = tv1*arr[3].x + tv2*arr[3].y + tv3*arr[3].z
    --
    -- Delete the modifier
    deleteModifier s 1

    intersectRayScene <ray>

Performs intersectRay on all nodes in the scene.

Returns an array of results, one entry per node hit, where each entry is a 2 element array containing the node and the intersectRay result for that node.

The intersection is performed for all geometry objects, including hidden ones.

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

FOR EXAMPLE
    (
    localr = ray [0,0,0] [1,0,0]--define a ray along X
    for i = 0 to 4 do--loop 5 times
    (
     box pos:[i * 30, 0,0]--create a box
    )
    localhits = intersectRayScene r--intersect withscene
    print hits --Misses box 1 because ray originates inside the box
    )

    #($Box:Box02 @ [30.000000,0.000000,0.000000], (ray [17.5,0,0] [-1,0,0]))
    #($Box:Box03 @ [60.000000,0.000000,0.000000], (ray [47.5,0,0] [-1,0,0]))
    #($Box:Box04 @ [90.000000,0.000000,0.000000], (ray [77.5,0,0] [-1,0,0]))
    #($Box:Box05 @ [120.000000,0.000000,0.000000], (ray [107.5,0,0] [-1,0,0]))
    OK

    intersects <node> <node>

Returns true if the bounding boxes of the two specified nodes overlap, or fals e if they do not overlap.

    printStack <node>

Prints a representation of the current modifier stack for the given node.

## Node User Properties Methods

| Back To Topic Navigation

    getUserProp <node> <key_string>

Retrieves the node's user property with the given key as a string . <key_string> is either a String or a Name value. If the key does not exist, a value of undefined is returned.

    setUserProp <node> <key_string> <value>

Sets the node's user property with the given key to the given value.

    getUserPropBuffer <node>

Retrieves the entire user property buffer as a string containing all the user property settings. This is effectively the contents of the User Defined Properties box in the 3ds Max Object Properties dialog.

    setUserPropBuffer <node> <string>

Sets the user property buffer to the given string.

See Node User-Defined Properties and Methods for more information on these methods.

## Node Inverse Kinematics Methods

| Back To Topic Navigation

The following methods get and set the node's IK values as seen in the Hierarchy panel, Object Parameters rollout.

    getRotTaskWeight <node>

Returns the rotation binding weight for the node.

    setRotTaskWeight <node> <float>

Sets the rotation binding weight for the node.

    getPosTaskWeight <node>

Returns the position binding weight for the node.

    setPosTaskWeight <node> <float>

Sets the position binding weight for the node.

    getTaskAxisState <node> <pos_or_rot_integer> <axis_integer>

Returns true or false to indicate if the specified axis is turned on for position or rotation binding. If an axis is turned off, the specified axis is no longer influenced by the follow object or the IK Controller Position end effector . <pos_or_rot_integer> sets whether the method returns the position state or the rotation state: 0 specifies position; 1 specifies rotation . <axis_integer> sets the axis to check: 0 specifies X, 1 specifies Y, 2 specifies Z.

    setTaskAxisState <node> <pos_or_rot_integer> <axis_integer> <boolean>

Sets the axis state for position or rotation binding to the specified boolean value. See getTaskAxisState() for a description of the parameters.

    mirrorIKConstraints <node> <axis_integer> <pos_or_rot_integer>

Mirrors the specified IK constraints on the specified node's transform controller about the specified axis . <axis_integer> specifies the axis of reflection: 0 for X, 1 for Y, 2 for Z . <pos_or_rot_integer> specifies which type of constraints are being mirrored: 0 for position, 1 for rotation.

    nodeIKParamsChanged <node>

Call this method when one of the node level IK parameters has been changed.

    OKToBindToNode <ik_node> <node>

Returns true if the <ik_node> can be bound to the <node> as a follow object, false otherwise. If the <ik_node> is not part of an IK system, this method always returns true . This method tests <node> to see if its transform is in any way already dependent on the IK system, and returns false if it is.

## Miscellaneous Node Methods

| Back To Topic Navigation

    classOf <node>

Returns the class of the world state of the node (the state of the node at the top of its stack). If no modifiers are applied to the base object, the class returned is the class of the base object. If modifiers are applied to the base object, the class returned is the class of the node as it exits the last modifier. For example, if you apply a Bend modifier to a Box, the Bend modifier converts the incoming Box primitive to a mesh, and the class returned by classOf is Editable_Mesh. You can get the class of the base object in all cases by using classOf <node>.baseObject .

    isPointSelected <node> <point_index>

Returns true if the specified point is selected, false if not.

The definition of a 'point' varies depending on the object type.

For meshes, it is the mesh vertex.

For NURBS objects, it is the vertex or control point.

For a spline, it is the knot and its In and Out bezier handles. The spline will appear to have 3 times more knots and if a knot is selected, its bezier handles will also be considered selected. Thus, the <point_index> must be multiplied by 3 to query the correct knot value. For example, if in an Editable Spline knot 1 is selected and knot 2 is not, indices 1, 2 and 3 will all return True, indices 4, 5 and 6 will return False.

    pointSelection <node> <point_index>

Returns a floating point weighted point selection if the object supports soft selections. Most object types just return 1.0 if the point is selected and 0.0 if not. Only NURBS,Editable Meshand Editable Polyobjects currently support weighted point selection.

    nodeInvalRect <node>

Invalidates the rectangle in the viewports that the node is occupying. Rectangles flagged as invalid will be update on the next screen redraw.

    stopCreating <node>

This method stops the creation of the current object, if any. This method is primarily used to ensure that a NURBS objects is fully created, which it until the creation is stopped. This method will also deactivated any activated object create buttons in the Create panel.

Associated Methods

    uniqueName <prefix> [numDigits:<integer>]

Generates a unique scene node name from a prefix string by adding a series of digits, in the same manner the 3ds Max does as you create objects in the scene. This name is only guaranteed to be unique until the next scene node creation.

The numDigits: optional keyword argument available since 3ds Max 2011 controls the number of digits to be used.

When not supplied, it defaults to 3 digits in 3ds Max 2011 and higher.

In releases prior to 3ds Max 2011 the number of digits was 2.

FOR EXAMPLE
    $Box01.name = uniqueName "MyRenamedBox"
    -->"MyRenamedBox001"

| Back To Topic Navigation

#### See Also

- MAXWrapper Common Properties, Operators, and Methods

- Value Common Properties, Operators, and Methods

- General Node Properties

- Node Transform Properties

- Node User-Defined Properties and Methods

- Nested Object Properties

- Class and Object Inspector Functions

- Dynamic Properties

- Node Subclasses

- NURBS Node Properties and Methods