from panda3d.egg import EggNameUniquifier
This is a handy class for guaranteeing unique node names in an egg hierarchy. It is an abstract class; to use it you must subclass off of it. See the comment above.
clear() → None¶
Empties the table of used named and prepares the Uniquifier for a new tree.
uniquify(node: EggNode) → None¶
Begins the traversal from the indicated node.
getNode(category: str, name: str) → EggNode¶
Returns the node associated with the given category and name, or NULL if the name has not been used.
- Return type
hasName(category: str, name: str) → bool¶
Returns true if the name has been used for the indicated category already, false otherwise.
addName(category: str, name: str, node: EggNode) → bool¶
Adds the name to the indicated category. This name will not be used for any other egg node within this category. Returns true if the name was added, or false if it was already in use for the category.
getCategory(node: EggNode) → str¶
filterName(node: EggNode) → str¶
Returns the name of the given node, or at least the name it should be. This provides a hook to adjust the name before attempting to uniquify it, if desired, for instance to remove invalid characters.
generateName(node: EggNode, category: str, index: int) → str¶
Generates a new name for the given node when its existing name clashes with some other node. This function will be called repeatedly, if necessary, until it returns a name that actually is unique.
The category is the string returned by
getCategory(), and index is a uniquely-generated number that may be useful for synthesizing the name.