From 1f11a05ff7ac94af9fda9491364f011420920235 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 10 Feb 2006 17:23:34 +0000 Subject: [PATCH] reset_prev_transform legal in sub-thread --- panda/src/pgraph/nodePath.cxx | 2 +- panda/src/pgraph/pandaNode.I | 15 --------------- panda/src/pgraph/pandaNode.cxx | 18 ++++++++++++++++++ panda/src/pgraph/pandaNode.h | 2 +- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/panda/src/pgraph/nodePath.cxx b/panda/src/pgraph/nodePath.cxx index 0ff6df95d8..288e3d09e7 100644 --- a/panda/src/pgraph/nodePath.cxx +++ b/panda/src/pgraph/nodePath.cxx @@ -320,7 +320,7 @@ reparent_to(const NodePath &other, int sort) { nassertv_always(!is_empty()); nassertv(other._error_type == ET_ok); - // Reparenting implicitly resents the delta vector. + // Reparenting implicitly resets the delta vector. node()->reset_prev_transform(); bool reparented = PandaNode::reparent(other._head, _head, sort, false); diff --git a/panda/src/pgraph/pandaNode.I b/panda/src/pgraph/pandaNode.I index 140dac42fb..04f8ef6454 100644 --- a/panda/src/pgraph/pandaNode.I +++ b/panda/src/pgraph/pandaNode.I @@ -570,21 +570,6 @@ get_prev_transform() const { return cdata->_prev_transform; } -//////////////////////////////////////////////////////////////////// -// Function: PandaNode::reset_prev_transform -// Access: Published -// Description: Resets the "previous" transform on this node to be -// the same as the current transform. This is not the -// same as clearing it to identity. -//////////////////////////////////////////////////////////////////// -INLINE void PandaNode:: -reset_prev_transform() { - nassertv(Thread::get_current_pipeline_stage() == 0); - - CDWriter cdata(_cycler); - cdata->_prev_transform = cdata->_transform; -} - //////////////////////////////////////////////////////////////////// // Function: PandaNode::get_tag // Access: Published diff --git a/panda/src/pgraph/pandaNode.cxx b/panda/src/pgraph/pandaNode.cxx index 89e90243ae..58bfbc2ebe 100644 --- a/panda/src/pgraph/pandaNode.cxx +++ b/panda/src/pgraph/pandaNode.cxx @@ -1472,6 +1472,24 @@ set_prev_transform(const TransformState *transform) { CLOSE_ITERATE_CURRENT_AND_UPSTREAM(_cycler); } +//////////////////////////////////////////////////////////////////// +// Function: PandaNode::reset_prev_transform +// Access: Published +// Description: Resets the "previous" transform on this node to be +// the same as the current transform. This is not the +// same as clearing it to identity. +//////////////////////////////////////////////////////////////////// +void PandaNode:: +reset_prev_transform() { + // Apply this operation to the current stage as well as to all + // upstream stages. + OPEN_ITERATE_CURRENT_AND_UPSTREAM(_cycler) { + CDStageWriter cdata(_cycler, pipeline_stage); + cdata->_prev_transform = cdata->_transform; + } + CLOSE_ITERATE_CURRENT_AND_UPSTREAM(_cycler); +} + //////////////////////////////////////////////////////////////////// // Function: PandaNode::set_tag // Access: Published diff --git a/panda/src/pgraph/pandaNode.h b/panda/src/pgraph/pandaNode.h index 6295629b10..b94e312baa 100644 --- a/panda/src/pgraph/pandaNode.h +++ b/panda/src/pgraph/pandaNode.h @@ -163,7 +163,7 @@ PUBLISHED: void set_prev_transform(const TransformState *transform); INLINE const TransformState *get_prev_transform() const; - INLINE void reset_prev_transform(); + void reset_prev_transform(); void set_tag(const string &key, const string &value); INLINE string get_tag(const string &key) const;