From c37f62fd9ad7a78d9d3e3c9e60022b90db2abef6 Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 22 Jul 2003 01:49:23 +0000 Subject: [PATCH] add find_child --- panda/src/egg/eggGroupNode.cxx | 19 +++++++++++++++++++ panda/src/egg/eggGroupNode.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/panda/src/egg/eggGroupNode.cxx b/panda/src/egg/eggGroupNode.cxx index bfed304d74..03d1e5c0c5 100644 --- a/panda/src/egg/eggGroupNode.cxx +++ b/panda/src/egg/eggGroupNode.cxx @@ -289,6 +289,25 @@ steal_children(EggGroupNode &other) { _children.splice(_children.end(), other._children); } +//////////////////////////////////////////////////////////////////// +// Function: EggGroupNode::find_child +// Access: Public +// Description: Returns the child of this node whose name is the +// indicated string, or NULL if there is no child of +// this node by that name. Does not search recursively. +//////////////////////////////////////////////////////////////////// +EggNode *EggGroupNode:: +find_child(const string &name) const { + Children::const_iterator ci; + for (ci = _children.begin(); ci != _children.end(); ++ci) { + EggNode *child = (*ci); + if (child->get_name() == name) { + return child; + } + } + + return NULL; +} //////////////////////////////////////////////////////////////////// // Function: EggGroupNode::resolve_filenames diff --git a/panda/src/egg/eggGroupNode.h b/panda/src/egg/eggGroupNode.h index 053e9ab311..d6e401b6c9 100644 --- a/panda/src/egg/eggGroupNode.h +++ b/panda/src/egg/eggGroupNode.h @@ -109,6 +109,8 @@ public: PT(EggNode) remove_child(PT(EggNode) node); void steal_children(EggGroupNode &other); + EggNode *find_child(const string &name) const; + void resolve_filenames(const DSearchPath &searchpath); void reverse_vertex_ordering();