Class GenericHierarchy

3DS Max Plug-In SDK

Class GenericHierarchy

See Also: Class HierarchyEntry.

class GenericHierarchy

Description:

This is a utility class for describing hierarchies of shapes. All methods of this class are implemented by the system.

This is used in generating mesh objects from shapes. In order for a mesh object to be generated correctly, nested shapes must be oriented clockwise or counter-clockwise depending on their level of nesting. For example, a donut shape with two circular curves will have the outer shape going counter-clockwise and the inner shape going clockwise. If a third shape was nested inside both of these, its points would be going counter-clockwise.

Methods:

Prototype:

GenericHierarchy()

Remarks:

Constructor. The hierarchy is set as initially empty.

Prototype:

void AddEntry(int data, int parent = -1);

Remarks:

This method adds one entry given its parent.

Parameters:

int data

The polygon index of the entry to add.

int parent = -1

The index of the parent of the entry.

Prototype:

int Entries();

Remarks:

Returns the total number of members in the hierarchy.

Prototype:

HierarchyEntry* GetStart();

Remarks:

Retrieves the first item under the root.

Return Value:

The first HierarchyEntry under the root.

Prototype:

HierarchyEntry* FindEntry(int data, HierarchyEntry* start = NULL);

Remarks:

Finds the specified entry in the hierarchy.

Parameters:

int data

The polygon index of the entry to find.

HierarchyEntry* start = NULL

The entry at which to begin the search. If NULL is specified the search starts at the root.

Return Value:

A pointer to the HierarchyEntry of the found entry. If not found, NULL is returned.

Prototype:

int NumberOfChildren(int data);

Remarks:

Returns the number of children for this item.

Parameters:

int data

The index of the polygon to return the number of children of.

Prototype:

int GetChild(int data, int index);

Remarks:

Returns the specified child of the specified entry.

Parameters:

int data

The index of the polygon whose child is to be returned.

int index

Specifies which child to return.

Return Value:

The specified child of the entry.

Prototype:

void New();

Remarks:

Clear out the hierarchy tree.

Prototype:

void Sort();

Remarks:

Sorts the hierarchy tree by children / siblings. This is used internally as all the sorting is done automatically as the hierarchy is generated.

Prototype:

BOOL IsCompatible(GenericHierarchy& hier);

Remarks:

Determines if this hierarchy and the specified hierarchy are compatible.

Parameters:

GenericHierarchy& hier

The hierarchy to check for compatibility.

Return Value:

TRUE if the hierarchies are compatible; otherwise FALSE.

Prototype:

void Dump(HierarchyEntry* start = NULL);

Remarks:

This method is used internally to DebugPrint() the tree. See Debugging.

Prototype:

TSTR& SortKey();

Remarks:

Returns the sort key for the hierarchy. This is used internally.

Operators:

Prototype:

GenericHierarchy& operator=(GenericHierarchy& from);

Remarks:

Copy operator.

Parameters:

GenericHierarchy& from

The hierarchy to copy from.