diff --git a/panda/src/pgraphnodes/sequenceNode.cxx b/panda/src/pgraphnodes/sequenceNode.cxx index ce9745f025..761f841bfb 100644 --- a/panda/src/pgraphnodes/sequenceNode.cxx +++ b/panda/src/pgraphnodes/sequenceNode.cxx @@ -118,6 +118,21 @@ cull_callback(CullTraverser *, CullTraverserData &) { return true; } +//////////////////////////////////////////////////////////////////// +// Function: SequenceNode::get_first_visible_child +// Access: Public, Virtual +// Description: Returns the index number of the first visible child +// of this node, or a number >= get_num_children() if +// there are no visible children of this node. This is +// called during the cull traversal, but only if +// has_selective_visibility() has already returned true. +// See has_selective_visibility(). +//////////////////////////////////////////////////////////////////// +int SequenceNode:: +get_first_visible_child() const { + return get_frame(); +} + //////////////////////////////////////////////////////////////////// // Function: SequenceNode::has_single_child_visibility // Access: Public, Virtual @@ -139,6 +154,18 @@ has_single_child_visibility() const { return true; } +//////////////////////////////////////////////////////////////////// +// Function: SequenceNode::get_visible_child +// Access: Public, Virtual +// Description: Returns the index number of the currently visible +// child of this node. This is only meaningful if +// has_single_child_visibility() has returned true. +//////////////////////////////////////////////////////////////////// +int SequenceNode:: +get_visible_child() const { + return get_frame(); +} + //////////////////////////////////////////////////////////////////// // Function: SequenceNode::output // Access: Published, Virtual diff --git a/panda/src/pgraphnodes/sequenceNode.h b/panda/src/pgraphnodes/sequenceNode.h index a393cef478..9ec1cd0f14 100644 --- a/panda/src/pgraphnodes/sequenceNode.h +++ b/panda/src/pgraphnodes/sequenceNode.h @@ -43,7 +43,9 @@ public: virtual bool safe_to_combine_children() const; virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data); + virtual int get_first_visible_child() const; virtual bool has_single_child_visibility() const; + virtual int get_visible_child() const; virtual void output(ostream &out) const; diff --git a/panda/src/pgraphnodes/switchNode.cxx b/panda/src/pgraphnodes/switchNode.cxx index 16a681a4bd..a49a9e2467 100644 --- a/panda/src/pgraphnodes/switchNode.cxx +++ b/panda/src/pgraphnodes/switchNode.cxx @@ -136,6 +136,21 @@ cull_callback(CullTraverser *, CullTraverserData &) { return true; } +//////////////////////////////////////////////////////////////////// +// Function: SwitchNode::get_first_visible_child +// Access: Public, Virtual +// Description: Returns the index number of the first visible child +// of this node, or a number >= get_num_children() if +// there are no visible children of this node. This is +// called during the cull traversal, but only if +// has_selective_visibility() has already returned true. +// See has_selective_visibility(). +//////////////////////////////////////////////////////////////////// +int SwitchNode:: +get_first_visible_child() const { + return get_visible_child(); +} + //////////////////////////////////////////////////////////////////// // Function: SwitchNode::has_single_child_visibility // Access: Public, Virtual diff --git a/panda/src/pgraphnodes/switchNode.h b/panda/src/pgraphnodes/switchNode.h index 327dd2f0ee..053dc9bfb2 100644 --- a/panda/src/pgraphnodes/switchNode.h +++ b/panda/src/pgraphnodes/switchNode.h @@ -36,6 +36,7 @@ public: virtual bool safe_to_combine_children() const; virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data); + virtual int get_first_visible_child() const; virtual bool has_single_child_visibility() const; PUBLISHED: