Browse Source

fix flattening 2-d objects

David Rose 19 years ago
parent
commit
28110b2774
3 changed files with 16 additions and 3 deletions
  1. 1 2
      panda/src/pgraph/sceneGraphReducer.cxx
  2. 13 0
      panda/src/pgui/pgEntry.cxx
  3. 2 1
      panda/src/pgui/pgEntry.h

+ 1 - 2
panda/src/pgraph/sceneGraphReducer.cxx

@@ -426,9 +426,8 @@ flatten_siblings(PandaNode *parent_node, int combine_siblings_bits) {
               do_flatten_siblings(parent_node, child1, child2);
               do_flatten_siblings(parent_node, child1, child2);
             if (new_node != (PandaNode *)NULL) {
             if (new_node != (PandaNode *)NULL) {
               // We successfully collapsed a node.
               // We successfully collapsed a node.
+              (*ai1_hold) = new_node;
               nodes.erase(ai2_hold);
               nodes.erase(ai2_hold);
-              nodes.erase(ai1_hold);
-              nodes.push_back(new_node);
               ai1 = nodes.begin();
               ai1 = nodes.begin();
               ai2 = nodes.end();
               ai2 = nodes.end();
               num_nodes++;
               num_nodes++;

+ 13 - 0
panda/src/pgui/pgEntry.cxx

@@ -122,6 +122,19 @@ make_copy() const {
   return new PGEntry(*this);
   return new PGEntry(*this);
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: PGEntry::xform
+//       Access: Public, Virtual
+//  Description: Transforms the contents of this node by the indicated
+//               matrix, if it means anything to do so.  For most
+//               kinds of nodes, this does nothing.
+////////////////////////////////////////////////////////////////////
+void PGEntry::
+xform(const LMatrix4f &mat) {
+  PGItem::xform(mat);
+  _text_render_root.set_mat(_text_render_root.get_mat() * mat);
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: PGEntry::cull_callback
 //     Function: PGEntry::cull_callback
 //       Access: Protected, Virtual
 //       Access: Protected, Virtual

+ 2 - 1
panda/src/pgui/pgEntry.h

@@ -51,7 +51,8 @@ protected:
   PGEntry(const PGEntry &copy);
   PGEntry(const PGEntry &copy);
 
 
 public:
 public:
-  virtual PandaNode *make_copy() const;
+  virtual PandaNode *make_copy() const; 
+  virtual void xform(const LMatrix4f &mat);
   virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data);
   virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data);
 
 
   virtual void press(const MouseWatcherParameter &param, bool background);
   virtual void press(const MouseWatcherParameter &param, bool background);