From 5ad7edb42be46a8e778cc9f02f4a4834dcbe28c2 Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 9 Jun 2003 22:47:47 +0000 Subject: [PATCH] reenable red wireframe highlight mode --- panda/src/framework/pandaFramework.cxx | 29 ++++++++++++++++++++++++++ panda/src/framework/pandaFramework.h | 1 + 2 files changed, 30 insertions(+) diff --git a/panda/src/framework/pandaFramework.cxx b/panda/src/framework/pandaFramework.cxx index 15a6f9abdf..71c4a7558f 100644 --- a/panda/src/framework/pandaFramework.cxx +++ b/panda/src/framework/pandaFramework.cxx @@ -24,6 +24,7 @@ #include "collisionNode.h" #include "config_framework.h" #include "graphicsPipeSelection.h" +#include "nodePathCollection.h" //////////////////////////////////////////////////////////////////// // Function: PandaFramework::Constructor @@ -45,6 +46,9 @@ PandaFramework() : _two_sided_enabled = false; _lighting_enabled = false; _background_type = WindowFramework::BT_gray; + _highlight_wireframe = NodePath("wireframe"); + _highlight_wireframe.set_render_mode_wireframe(1); + _highlight_wireframe.set_color(1.0f, 0.0f, 0.0f, 1.0f, 1); _default_keys_enabled = false; _exit_flag = false; } @@ -503,6 +507,13 @@ set_highlight(const NodePath &node) { if (!_highlight.is_empty()) { framework_cat.info(false) << _highlight << "\n"; _highlight.show_bounds(); + + // Also create a new instance of the highlighted geometry, as a + // sibling of itself, under the special highlight property. + if (_highlight.has_parent()) { + _highlight_wireframe.reparent_to(_highlight.get_parent()); + _highlight.instance_to(_highlight_wireframe); + } } } @@ -516,6 +527,10 @@ clear_highlight() { if (!_highlight.is_empty()) { _highlight.hide_bounds(); _highlight = NodePath(); + + // Clean up the special highlight instance. + _highlight_wireframe.detach_node(); + _highlight_wireframe.get_children().detach(); } } @@ -897,6 +912,13 @@ event_arrow_left(CPT_Event, void *data) { int index = parent.node()->find_child(node.node()); nassertv(index >= 0); int sibling = index - 1; + + if (sibling >= 0 && + parent.node()->get_child(sibling) == self->_highlight_wireframe.node()) { + // Skip over the special highlight node. + sibling--; + } + if (sibling >= 0) { self->set_highlight(NodePath(parent, parent.node()->get_child(sibling))); } @@ -923,6 +945,13 @@ event_arrow_right(CPT_Event, void *data) { nassertv(index >= 0); int num_children = parent.node()->get_num_children(); int sibling = index + 1; + + if (sibling < num_children && + parent.node()->get_child(sibling) == self->_highlight_wireframe.node()) { + // Skip over the special highlight node. + sibling++; + } + if (sibling < num_children) { self->set_highlight(NodePath(parent, parent.node()->get_child(sibling))); } diff --git a/panda/src/framework/pandaFramework.h b/panda/src/framework/pandaFramework.h index e22d24062b..c5a6df2b1d 100644 --- a/panda/src/framework/pandaFramework.h +++ b/panda/src/framework/pandaFramework.h @@ -154,6 +154,7 @@ private: WindowFramework::BackgroundType _background_type; NodePath _highlight; + NodePath _highlight_wireframe; bool _default_keys_enabled;