Browse Source

fix render order for wait bars

David Rose 20 years ago
parent
commit
7683032977
3 changed files with 10 additions and 5 deletions
  1. 4 3
      panda/src/pgui/pgFrameStyle.cxx
  2. 2 1
      panda/src/pgui/pgFrameStyle.h
  3. 4 1
      panda/src/pgui/pgWaitBar.cxx

+ 4 - 3
panda/src/pgui/pgFrameStyle.cxx

@@ -153,13 +153,14 @@ xform(const LMatrix4f &mat) {
 //       Access: Public
 //  Description: Generates geometry representing a frame of the
 //               indicated size, and parents it to the indicated node,
-//               with a scene graph sort order of -1.
+//               with the indicated scene graph sort order.
 //
 //               The return value is the generated NodePath, if any,
 //               or an empty NodePath if nothing is generated.
 ////////////////////////////////////////////////////////////////////
 NodePath PGFrameStyle::
-generate_into(const NodePath &parent, const LVecBase4f &frame) {
+generate_into(const NodePath &parent, const LVecBase4f &frame,
+	      int sort) {
   PT(PandaNode) new_node;
 
   LPoint2f center((frame[0] + frame[1]) / 2.0f,
@@ -204,7 +205,7 @@ generate_into(const NodePath &parent, const LVecBase4f &frame) {
   }
 
   // Adding the node to the parent keeps the reference count.
-  return parent.attach_new_node(new_node);
+  return parent.attach_new_node(new_node, sort);
 }
 
 ////////////////////////////////////////////////////////////////////

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

@@ -75,7 +75,8 @@ PUBLISHED:
 
 public:
   bool xform(const LMatrix4f &mat);
-  NodePath generate_into(const NodePath &parent, const LVecBase4f &frame);
+  NodePath generate_into(const NodePath &parent, const LVecBase4f &frame,
+			 int sort = 0);
 
 private:
   PT(PandaNode) generate_flat_geom(const LVecBase4f &frame);

+ 4 - 1
panda/src/pgui/pgWaitBar.cxx

@@ -177,7 +177,10 @@ update() {
     frac = max(min(frac, 1.0f), 0.0f);
     bar_frame[1] = bar_frame[0] + frac * (bar_frame[1] - bar_frame[0]);
     
-    _bar = _bar_style.generate_into(root, bar_frame);
+    _bar = _bar_style.generate_into(root, bar_frame, 1);
+
+    // Make sure the bar is rendered after the frame.
+    _bar.set_bin("fixed", 1);
   }
 
   // Indicate that the bar is current for this state.