Browse Source

reset_prev_transform legal in sub-thread

David Rose 20 years ago
parent
commit
1f11a05ff7

+ 1 - 1
panda/src/pgraph/nodePath.cxx

@@ -320,7 +320,7 @@ reparent_to(const NodePath &other, int sort) {
   nassertv_always(!is_empty());
   nassertv_always(!is_empty());
   nassertv(other._error_type == ET_ok);
   nassertv(other._error_type == ET_ok);
 
 
-  // Reparenting implicitly resents the delta vector.
+  // Reparenting implicitly resets the delta vector.
   node()->reset_prev_transform();
   node()->reset_prev_transform();
 
 
   bool reparented = PandaNode::reparent(other._head, _head, sort, false);
   bool reparented = PandaNode::reparent(other._head, _head, sort, false);

+ 0 - 15
panda/src/pgraph/pandaNode.I

@@ -570,21 +570,6 @@ get_prev_transform() const {
   return cdata->_prev_transform;
   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
 //     Function: PandaNode::get_tag
 //       Access: Published
 //       Access: Published

+ 18 - 0
panda/src/pgraph/pandaNode.cxx

@@ -1472,6 +1472,24 @@ set_prev_transform(const TransformState *transform) {
   CLOSE_ITERATE_CURRENT_AND_UPSTREAM(_cycler);
   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
 //     Function: PandaNode::set_tag
 //       Access: Published
 //       Access: Published

+ 1 - 1
panda/src/pgraph/pandaNode.h

@@ -163,7 +163,7 @@ PUBLISHED:
 
 
   void set_prev_transform(const TransformState *transform);
   void set_prev_transform(const TransformState *transform);
   INLINE const TransformState *get_prev_transform() const;
   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);
   void set_tag(const string &key, const string &value);
   INLINE string get_tag(const string &key) const;
   INLINE string get_tag(const string &key) const;