add get_sort()

This commit is contained in:
David Rose 2003-08-30 22:11:50 +00:00
parent a4129aa412
commit 89659d9e78
2 changed files with 24 additions and 0 deletions

View File

@ -168,6 +168,29 @@ get_stashed_children() const {
return result;
}
////////////////////////////////////////////////////////////////////
// Function: NodePath::get_sort
// Access: Published
// Description: Returns the sort value of the referenced node within
// its parent; that is, the sort number passed on the
// last reparenting operation for this node. This will
// control the position of the node within its parent's
// list of children.
////////////////////////////////////////////////////////////////////
int NodePath::
get_sort() const {
if (!has_parent()) {
return 0;
}
PandaNode *parent = _head->get_next()->get_node();
PandaNode *child = node();
nassertr(parent != (PandaNode *)NULL && child != (PandaNode *)NULL, 0);
int child_index = parent->find_child(child);
nassertr(child_index != -1, 0);
return parent->get_child_sort(child_index);
}
////////////////////////////////////////////////////////////////////
// Function: NodePath::find
// Access: Published

View File

@ -186,6 +186,7 @@ PUBLISHED:
INLINE bool has_parent() const;
INLINE NodePath get_parent() const;
int get_sort() const;
NodePath find(const string &path) const;
NodePath find_path_to(PandaNode *node) const;