Nodes

3DS Max Plug-In SDK

Nodes

See Also: Class INode, The Node and Object Offset Transformations.

Overview

This section presents information on nodes. This includes what they are, their function within MAX, the main class for working with nodes, an overview of their reference structure, and a section on instancing nodes.

What are Nodes?

Nodes are the items in the 3ds max that have a one to one correspondence with objects in the scene. Every procedural object, light, camera, helper object, etc. that appears in the viewports has an associated node. The node stores many properties that allow the item associated with the node to relate to the scene. These are properties such as a transform controller, a material used for rendering, a visibility controller, hidden/unhidden sate, frozen/thawed state, wireframe color, and many more.

Class INode

The methods available to work with nodes are from Class INode. These methods provide the functions such as evaluating the geometry pipeline for the node, getting and setting the node name, working with parent/child hierarchies, accessing display attributes of the node, providing access to controllers, etc.

Node Grouping

A 3ds max user can take a node in the scene and make it part of a group. Groups allow the user to select all the nodes in the group as one element without having to select each piece. Groups can be included in other groups so nesting can occur. There is a method in INode that indicates if a node is included in a group. This is IsGroupMember(). It returns TRUE if the node is in a group and FALSE if not.

The group is constructed by creating an invisible dummy object and linking the group members to this dummy. The dummy node is called the group head. The INode method IsGroupHead() tells if the node is one of the dummy nodes that heads a group. It returns TRUE if the node is a group head dummy and FALSE if not. Note that if the group was nested, that is it's a member of another group, it may have its IsGroupMember() boolean set as well.

If you have a member of a group and want to get a pointer to the group head use GetParentNode(). If you go through the children of the head (and all their children), and all the member booleans are set, the nodes are still part of the same group.

Groups may be opened allowing the user to edit the individual components (without otherwise breaking up the group). The method IsOpenGroupMember() returns TRUE if the node is a member of an open group and FALSE if not. Heads can check if they are open by calling IsOpenGroupHead().

Nodes and References

A node maintains six references (see the Advacned Topics section References for more details) that allow it to get notified when items that affect it change. These references are listed and defined below:

Reference 0: The Transform Controller.

This is a reference to the node's transform controller. This controller governs the position, rotation and scaling of the node in the scene. Developers can get and set the transform controller used by the node using INode:: GetTMController() and SetTMController(). Most nodes use the Position/Rotation/Scale transform controller (for example mesh objects). Other items (such as target spotlights and cameras) use the Look At transform controller.

Reference 1: The Object Reference.

Each node maintains a pointer to an object. This is a pointer to the base procedural object (mesh, light, camera) or a derived object (see the section Geometry Pipeline System for details on derived objects). The path that follows between object references are what make up a geometry pipeline in MAX. The node's object reference is where the pipeline starts.

Reference 2: The Pin Node for IK.

This reference is a pointer to the pin node for Inverse Kinematics. This reference is not assigned by default and is thus NULL initially.

Reference 3: The Material Reference.

Materials in 3ds max are assigned at the node level. There is a single material assigned per node. This reference is a pointer to the material for the node. A developer can get and set the material using the methods INode::GetMtl() and SetMtl(). If a material is assigned, this reference tracks it. This reference is not assigned by default and is thus NULL initially.

Reference 4: The Visibility Controller.

In Track View the user can assign this visibility controller using the 'Add Visibility Track' icon. When this controller is assigned this reference points to the controller managing the node visibility. This reference is not assigned by default and is thus NULL initially.

Reference 5: The Image Blur Controller.

This reference is not assigned by default and is thus NULL initially.

Node Hierarchies -- Parent / Child and Groups

Nodes in 3ds max can be linked to one another to form parent / child hierarchies.

When a node is linked it receive the reference message REFMSG_NODE_LINK. When it is unlinked it receives this same message. Developers can manipulate the hierarchy using methods INode::AttachChild(), Detach(), and GetParentNode(). One can check if a node is linked using GetParentNode(). If the pointer returned from that method is the same as that returned from IsRootNode() then the node is not linked.

Nodes and Transformations

There are two transformation that affect all nodes. These are the node transformation and the object-offset transformation. For details on these see the Advanced Topic Section Node and Object Offset Transformations.

Nodes and Instancing

Nodes cannot be instanced. However, a developer can achieve functionally the same thing by instancing everything that the node points to. So, given two difference nodes, if you instance the controllers, objects, and materials of all the child nodes then the hierarchies will behave as instances.