The following constructors are applicable to any value that is derived from a Node.
<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, and so on.
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 the 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 $baz001, $baz002, $baz003, 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 that can be used as an alternative way to set the node's complete transform matrix in one go.
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 to 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.