Parent-Child Hierarchy

3DS Max Plug-In SDK

Parent-Child Hierarchy

See Also: Class INode.

Overview

In 3ds max nodes in the scene may be linked together to form a hierarchy. 3ds max provides a developer with methods to work with this hierarchy via the INode class.

A node that is linked to another node is referred to as a child node. A node that has children is referred to as a parent node. A node may have several children, but only a single parent. 3ds max provides access to the children of a node using an array mechanism.

Methods

The INode method NumberOfChildren() may be used to retrieve the number of children a node has. To retrieve any of the children, use the method GetChildNode(int i). This returns an INode pointer to the 'i-th' child. To retrieve the parent of a node use the method GetParentNode(). This returns an INode pointer to the parent node.

To attach a node to another node, use the method AttachChild(INode* node, int keepPos=1). This method attaches the specified node to the calling node. To detach a child node use Detach(TimeValue t, int keepPos=1). Both these methods allow the original position of the node prior to the hierarchy change to be maintained.

The method IsRootNode() determines if this node is a root node (does not have a parent node other than the world).

Note the following regarding cycles in hierarchical links:

Cycles with both hierarchical links and references can be legal or illegal, depending on the nature of the references. If a node's transform controller depends on one of the node's child nodes (or on any of its descendent nodes) this is illegal. However there is some special case code so that if a node's *object depends on any of the node's descendent nodes, it is not considered a cycle, and is legal.

To review the full details on these methods see the reference section Class INode.