Node Parent / Child Relationships

Nodes in 3ds Max can be linked to one another to form parent / child hierarchies. This is also called node linking. The 3ds Max SDK 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.

Developers can manipulate the hierarchy using methods INode::AttachChild(), INode::Detach(), and INode::GetParentNode(). One can check if a node is linked using INode::GetParentNode(). If the returned node is the root node (i.e. the function INode::IsRootNode() returns true) then the first node is not linked. The following sample function shows how to check this:

bool IsNodeLinked(INode* node) 
{
    return node->GetParentNode()  != NULL  && !node->GetParentNode()->IsRootNode();
}

See Also