Explorar el Código

to make sure the modifier is written to bam to for part bundles

Zachary Pavlov hace 18 años
padre
commit
f4a8b1673c

+ 36 - 0
panda/src/chan/partBundle.I

@@ -206,3 +206,39 @@ get_control_effect(AnimControl *control) const {
   CDReader cdata(_cycler);
   return do_get_control_effect(control, cdata);
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: PartBundle::get_modifies_anim_bundles
+//       Access: Published
+//  Description: getter for anim copying
+////////////////////////////////////////////////////////////////////
+INLINE bool PartBundle::
+get_modifies_anim_bundles(){
+  return _modifies_anim_bundles;
+}
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: PartBundle::set_modifies_anim_bundles
+//       Access: Published
+//  Description: setter for anim copying
+////////////////////////////////////////////////////////////////////
+INLINE void PartBundle::
+set_modifies_anim_bundles(bool value){
+  _modifies_anim_bundles = value;
+}
+
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: PartGroup::freeze
+//       Access: Published
+//  Description: stores a joint freeze for later binding
+////////////////////////////////////////////////////////////////////
+INLINE void PartBundle::
+freeze_joint(const string &joint_name, LMatrix4f const &transform)
+{
+  PT(PartGroup) pg = find_child(joint_name);
+  pg->freeze(transform);
+  _modifies_anim_bundles = true;
+}

+ 8 - 0
panda/src/chan/partBundle.cxx

@@ -222,6 +222,10 @@ bind_anim(AnimBundle *anim, int hierarchy_match_flags,
     }
   }
 
+  if(_modifies_anim_bundles) {
+    ptanim = ptanim->copy_bundle();
+  }
+
   if (!check_hierarchy(anim, NULL, hierarchy_match_flags)) {
     return NULL;
   }
@@ -492,6 +496,7 @@ void PartBundle::
 write_datagram(BamWriter *manager, Datagram &dg) {
   PartGroup::write_datagram(manager, dg);
   manager->write_cdata(dg, _cycler);
+  dg.add_bool(_modifies_anim_bundles);
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -525,6 +530,9 @@ fillin(DatagramIterator &scan, BamReader *manager) {
   if (manager->get_file_minor_ver() >= 10) {
     manager->read_cdata(scan, _cycler);
   }
+  if (manager->get_file_minor_ver() >= 11) {  
+    _modifies_anim_bundles=scan.get_bool();
+  }
 }
 
 ////////////////////////////////////////////////////////////////////

+ 10 - 1
panda/src/chan/partBundle.h

@@ -120,9 +120,14 @@ PUBLISHED:
                             int hierarchy_match_flags = 0, 
                             const PartSubset &subset = PartSubset());
 
+
+  INLINE void freeze_joint(const string &joint_name, LMatrix4f const &transform);
+
   bool update();
   bool force_update();
-
+  
+  INLINE bool get_modifies_anim_bundles();
+  INLINE void set_modifies_anim_bundles(bool value);
 public:
   // The following functions aren't really part of the public
   // interface; they're just public so we don't have to declare a
@@ -134,6 +139,10 @@ protected:
   virtual void remove_node(PartBundleNode *node);
 
 private:
+
+  bool _modifies_anim_bundles;
+
+
   class CData;
 
   void do_set_control_effect(AnimControl *control, float effect, CData *cdata);

+ 1 - 1
panda/src/chan/partGroup.I

@@ -57,7 +57,7 @@ PartGroup(const PartGroup &copy) :
 //  Description: stores a joint freeze for later binding
 ////////////////////////////////////////////////////////////////////
 INLINE void PartGroup::
-freeze_joint(LMatrix4f const &transform) 
+freeze(LMatrix4f const &transform) 
 {
   _frozen = true;
   _frozen_transform=LMatrix4f(transform);

+ 1 - 1
panda/src/chan/partGroup.h

@@ -79,7 +79,7 @@ PUBLISHED:
   virtual void write(ostream &out, int indent_level) const;
   virtual void write_with_value(ostream &out, int indent_level) const;
 
-  INLINE void freeze_joint(LMatrix4f const &transform);
+  INLINE void freeze(LMatrix4f const &transform);
 
 public:
   virtual TypeHandle get_value_type() const;