- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes

# TreeNode Class Reference

This reference page is linked to from the following overview topics: Mudbox 2013, Mudbox Scenes, Nodes, Scene Graph, Traversing the Scene Graph, Mesh Division.

Search for all occurrences

## Detailed Description

This class is the base of all node types that can be structured in a hierarchy.

Examples:

  MeshDisplace/displacer.h.

Definition at line 18 of file treenode.h.

`#include <treenode.h>`

Inheritance diagram for TreeNode:
[legend]

List of all members.

## Public Member Functions
| TreeNode (void)
| ~TreeNode (void)
virtual void | Serialize (Stream &s)
| Serializes the node.
virtual void | AddChild (TreeNode *pChild, bool bFirst=false) const
| Adds a node/subtree to the list of children. The added node will be removed from the current parent if it has one.
virtual void | RemoveChild (TreeNode *pChild) const
| Removes a node/subtree from the list of children.
virtual TreeNode * | FirstChild (void) const
| Returns the first node from the child list.
virtual TreeNode * | Parent (void) const
| Returns the parent node.
virtual TreeNode * | NextSibling (void) const
| Returns the next linked node with the same parent.
virtual TreeNode * | PrevSibling (void) const
| Returns the previous linked node with the same parent.
virtual void | MoveChild (TreeNode *pChild, TreeNode *pAfter)
| Moves the child after the given node in order.
virtual TreeNode * | ChildByClass (const ClassDesc *pClass, bool bAutoCreate=true) const
| Returns the first child with the specified type. When the bAutoCreate parameter is true and such a child does not exists, it creates it with the preferred descedant type.
template<typename type >
type * | ChildByClass (bool bAutoCreate=true) const
| Same as above, a most confortable version.
virtual TreeNode * | ChildByClass (const ClassDesc *pClass, unsigned int iIndex=0) const
| Returns the first child with the specified type, or returns zero if no child found.
template<typename type >
type * | ChildByClass (unsigned int iIndex=0) const
| Same as above, a most confortable version.
virtual void | DeleteChildByClass (const ClassDesc *pClass)
| Deletes all child which is derived from a specific class.
virtual QString | Info (void) const
| Returns descriptive information about the node.
virtual bool | Visible (void) const
| Returns if the node is visible. Should be overridden in derived classes.
virtual void | SetVisible (bool b)
| Sets the node visibility Should be overridden in derived classes.
virtual bool | Locked (void) const
| Returns if the node is locked. Should be overridden in derived classes.
virtual void | SetLocked (bool b)
| Sets the locking of the node. Should be overridden in derived classes.
virtual void | OnLinked (const TreeNode *pOldParent)
| This function is called then the node is linked to a new parent.
virtual void | CheckValidity (Node::DiagnosticLevel iLevel=dgnLevel2) const
| See the documentation for Node::CheckValidity.
QString | UniqueChildName (const TreeNode *pChild, const QString &sPrefix="") const
| Finds a node name that is unique among the children of this node.
virtual void | SetName (const QString &sName)
| This method does the same thing as Node::SetName, except it ensures the name is unique among this node's siblings.
virtual void | CopyTo (Node *pNode) const
## Public Attributes
| DECLARE_CLASS

## Constructor & Destructor Documentation

TreeNode | ( | void |  | ) |

~TreeNode | ( | void |  | ) |

## Member Function Documentation

virtual void Serialize | ( | Stream & | s | ) | `[virtual]`

Search for all occurrences

Serializes the node.

Override this function in your plug-in to save and load attributes and custom data with the Mudbox file.

Reimplemented from Node.

Reimplemented in CurveBase, MudboxCurve, LayerContainer, NURBSCurve, SelectionSet, and Topology.

virtual void AddChild | ( | TreeNode * | pChild,
|  | bool | bFirst = `false`
| ) |  | const `[virtual]`

Search for all occurrences

Adds a node/subtree to the list of children. The added node will be removed from the current parent if it has one.

virtual void RemoveChild | ( | TreeNode * | pChild | ) | const `[virtual]`

Search for all occurrences

Removes a node/subtree from the list of children.

virtual TreeNode* FirstChild | ( | void |  | ) | const `[virtual]`

Search for all occurrences

Returns the first node from the child list.

virtual TreeNode* Parent | ( | void |  | ) | const `[virtual]`

Search for all occurrences

Returns the parent node.

virtual TreeNode* NextSibling | ( | void |  | ) | const `[virtual]`

Search for all occurrences

Returns the next linked node with the same parent.

virtual TreeNode* PrevSibling | ( | void |  | ) | const `[virtual]`

Search for all occurrences

Returns the previous linked node with the same parent.

virtual void MoveChild | ( | TreeNode * | pChild,
|  | TreeNode * | pAfter
| ) |  | `[virtual]`

Search for all occurrences

Moves the child after the given node in order.

virtual TreeNode* ChildByClass | ( | const ClassDesc * | pClass,
|  | bool | bAutoCreate = `true`
| ) |  | const `[virtual]`

Search for all occurrences

Returns the first child with the specified type. When the bAutoCreate parameter is true and such a child does not exists, it creates it with the preferred descedant type.

Examples:
  PtexExtractor/PtexLayout.cpp, and PtexExtractor/PtexPaintExporter.cpp.

type* ChildByClass | ( | bool | bAutoCreate = `true` | ) | const `[inline]`

Search for all occurrences

Same as above, a most confortable version.

Definition at line 46 of file treenode.h.

    { return dynamic_cast<type *>( ChildByClass( type::StaticClass(), bAutoCreate ) ); };

virtual TreeNode* ChildByClass | ( | const ClassDesc * | pClass,
|  | unsigned int | iIndex = `0`
| ) |  | const `[virtual]`

Search for all occurrences

Returns the first child with the specified type, or returns zero if no child found.

type* ChildByClass | ( | unsigned int | iIndex = `0` | ) | const `[inline]`

Search for all occurrences

Same as above, a most confortable version.

Definition at line 51 of file treenode.h.

    { return dynamic_cast<type *>( ChildByClass( type::StaticClass(), iIndex ) ); };

virtual void DeleteChildByClass | ( | const ClassDesc * | pClass | ) | `[virtual]`

Search for all occurrences

Deletes all child which is derived from a specific class.

virtual QString Info | ( | void |  | ) | const `[virtual]`

Search for all occurrences

Returns descriptive information about the node.

virtual bool Visible | ( | void |  | ) | const `[virtual]`

Search for all occurrences

Returns if the node is visible. Should be overridden in derived classes.

Reimplemented in LayerMeshData.

virtual void SetVisible | ( | bool | b | ) | `[virtual]`

Search for all occurrences

Sets the node visibility Should be overridden in derived classes.

Reimplemented in LayerMeshData, NURBSCurve, SelectionSet, and ViewPortFilter.

virtual bool Locked | ( | void |  | ) | const `[virtual]`

Search for all occurrences

Returns if the node is locked. Should be overridden in derived classes.

virtual void SetLocked | ( | bool | b | ) | `[virtual]`

Search for all occurrences

Sets the locking of the node. Should be overridden in derived classes.

virtual void OnLinked | ( | const TreeNode * | pOldParent | ) | `[virtual]`

Search for all occurrences

This function is called then the node is linked to a new parent.

virtual void CheckValidity | ( | Node::DiagnosticLevel | iLevel = `dgnLevel2` | ) | const `[virtual]`

Search for all occurrences

See the documentation for Node::CheckValidity.

Reimplemented from Node.

Reimplemented in Mesh, SubdivisionLevel, and Topology.

QString UniqueChildName | ( | const TreeNode * | pChild,
|  | const QString & | sPrefix = `""`
| ) |  | const

Search for all occurrences

Finds a node name that is unique among the children of this node.

Parameters:

  [in] | pChild | The node to find a unique name for
  [in] | sPrefix | An optional prefix for the unique name. If none, the name of pChild is used.

virtual void SetName | ( | const QString & | sName | ) | `[virtual]`

Search for all occurrences

This method does the same thing as Node::SetName, except it ensures the name is unique among this node's siblings.

Reimplemented from Node.

Reimplemented in LayerMeshData.

Examples:
  MeshBuilder/MeshBuilder.cpp, PLYImport/Importer.cpp, and PtexImporter/PtexImporter.cpp.

virtual void CopyTo | ( | Node * | pNode | ) | const `[virtual]`

Search for all occurrences

Reimplemented from Node.

Reimplemented in CurveBase, MudboxCurve, Mesh, and Topology.

## Member Data Documentation

DECLARE_CLASS

Search for all occurrences

Reimplemented from Node.

Reimplemented in BrushMask, BrushStamp, BrushStencil, NURBSCurve, SelectionSet, and PtexPainting.

Definition at line 21 of file treenode.h.

The documentation for this class was generated from the following file:

- Mudbox/treenode.h

TreeNode TreeNode TreeNode TreeNode TreeNode TreeNode TreeNode TreeNode TreeNode TreeNode
TreeNode TreeNode TreeNode TreeNode TreeNode TreeNode TreeNode TreeNode TreeNode TreeNode