From 768303297712414f39dfd03f7c58eb32e3d22c8d Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 6 Oct 2005 23:12:53 +0000 Subject: [PATCH] fix render order for wait bars --- panda/src/pgui/pgFrameStyle.cxx | 7 ++++--- panda/src/pgui/pgFrameStyle.h | 3 ++- panda/src/pgui/pgWaitBar.cxx | 5 ++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/panda/src/pgui/pgFrameStyle.cxx b/panda/src/pgui/pgFrameStyle.cxx index 8684d5e979..5616f7f12e 100644 --- a/panda/src/pgui/pgFrameStyle.cxx +++ b/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); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pgui/pgFrameStyle.h b/panda/src/pgui/pgFrameStyle.h index be9bfe8906..6e8cedd0b2 100644 --- a/panda/src/pgui/pgFrameStyle.h +++ b/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); diff --git a/panda/src/pgui/pgWaitBar.cxx b/panda/src/pgui/pgWaitBar.cxx index 6a28c4d244..d48d35e68c 100644 --- a/panda/src/pgui/pgWaitBar.cxx +++ b/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.