Browse Source

fix interplay with set_color() and animate_vertices()

David Rose 20 years ago
parent
commit
b76d29c0a6
2 changed files with 15 additions and 5 deletions
  1. 13 5
      panda/src/gobj/qpgeomVertexData.cxx
  2. 2 0
      panda/src/gobj/qpgeomVertexFormat.cxx

+ 13 - 5
panda/src/gobj/qpgeomVertexData.cxx

@@ -92,6 +92,10 @@ qpGeomVertexData(const qpGeomVertexData &copy) :
   _skinning_pcollector(copy._skinning_pcollector),
   _skinning_pcollector(copy._skinning_pcollector),
   _morphs_pcollector(copy._morphs_pcollector)
   _morphs_pcollector(copy._morphs_pcollector)
 {
 {
+  CDWriter cdata(_cycler);
+  // It's important that we *not* copy the animated_vertices pointer.
+  cdata->_animated_vertices = NULL;
+  cdata->_animated_vertices_modified = UpdateSeq();
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
@@ -126,6 +130,10 @@ qpGeomVertexData(const qpGeomVertexData &copy,
       (_format->get_array(i), usage_hint);
       (_format->get_array(i), usage_hint);
     cdata->_arrays.push_back(array);
     cdata->_arrays.push_back(array);
   }
   }
+
+  // It's important that we *not* copy the animated_vertices pointer.
+  cdata->_animated_vertices = NULL;
+  cdata->_animated_vertices_modified = UpdateSeq();
 }
 }
   
   
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
@@ -1351,11 +1359,11 @@ update_animated_vertices(qpGeomVertexData::CDWriter &cdata) {
   }
   }
   PT(qpGeomVertexData) new_data = cdata->_animated_vertices;
   PT(qpGeomVertexData) new_data = cdata->_animated_vertices;
 
 
-  // We have to make a complete copy of data first so we can modify
-  // it.  If we were clever, we could maybe just figure out the subset
-  // of the data that might have changed since last frame, but that's
-  // too much trouble (and isn't obviously faster than just copying
-  // the whole thing).
+  // We have to make a complete copy of the data first so we can
+  // modify it.  If we were clever, we could maybe just figure out the
+  // subset of the data that might have changed since last frame, but
+  // that's too much trouble (and isn't obviously faster than just
+  // copying the whole thing).
   new_data->copy_from(this, true);
   new_data->copy_from(this, true);
 
 
   // First, apply all of the morphs.
   // First, apply all of the morphs.

+ 2 - 0
panda/src/gobj/qpgeomVertexFormat.cxx

@@ -117,6 +117,8 @@ get_post_animated_format() const {
       new_format->remove_column(delta_name);
       new_format->remove_column(delta_name);
     }
     }
 
 
+    new_format->_animation.set_none();
+
     CPT(qpGeomVertexFormat) registered = 
     CPT(qpGeomVertexFormat) registered = 
       qpGeomVertexFormat::register_format(new_format);
       qpGeomVertexFormat::register_format(new_format);
     ((qpGeomVertexFormat *)this)->_post_animated_format = registered;
     ((qpGeomVertexFormat *)this)->_post_animated_format = registered;