mirror of
https://github.com/panda3d/panda3d.git
synced 2026-04-22 06:28:43 -05:00
fix base.mouseWatcherNode.showRegions()
This commit is contained in:
@@ -222,6 +222,14 @@ replace_group(MouseWatcherGroup *old_group, MouseWatcherGroup *new_group) {
|
||||
}
|
||||
|
||||
MutexHolder holder(_lock);
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (!_show_regions_render2d.is_empty()) {
|
||||
old_group->hide_regions();
|
||||
new_group->show_regions(_show_regions_render2d);
|
||||
}
|
||||
#endif // NDEBUG
|
||||
|
||||
MutexHolder holder2(old_group->_lock);
|
||||
MutexHolder holder3(new_group->_lock);
|
||||
|
||||
@@ -272,7 +280,6 @@ replace_group(MouseWatcherGroup *old_group, MouseWatcherGroup *new_group) {
|
||||
|
||||
// Did not find the group to erase
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@@ -565,6 +572,46 @@ clear_current_regions() {
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MouseWatcher::do_show_regions
|
||||
// Access: Protected, Virtual
|
||||
// Description: The protected implementation of show_regions(). This
|
||||
// assumes the lock is already held.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void MouseWatcher::
|
||||
do_show_regions(const NodePath &render2d) {
|
||||
MouseWatcherGroup::do_show_regions(render2d);
|
||||
_show_regions_render2d = render2d;
|
||||
|
||||
Groups::const_iterator gi;
|
||||
for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
|
||||
MouseWatcherGroup *group = (*gi);
|
||||
group->show_regions(render2d);
|
||||
}
|
||||
}
|
||||
#endif // NDEBUG
|
||||
|
||||
#ifndef NDEBUG
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MouseWatcher::do_hide_regions
|
||||
// Access: Protected, Virtual
|
||||
// Description: The protected implementation of hide_regions(). This
|
||||
// assumes the lock is already held.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void MouseWatcher::
|
||||
do_hide_regions() {
|
||||
MouseWatcherGroup::do_hide_regions();
|
||||
_show_regions_render2d = NodePath();
|
||||
|
||||
Groups::const_iterator gi;
|
||||
for (gi = _groups.begin(); gi != _groups.end(); ++gi) {
|
||||
MouseWatcherGroup *group = (*gi);
|
||||
group->hide_regions();
|
||||
}
|
||||
}
|
||||
#endif // NDEBUG
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MouseWatcher::intersect_regions
|
||||
// Access: Protected, Static
|
||||
|
||||
@@ -126,6 +126,11 @@ protected:
|
||||
void set_current_regions(Regions ®ions);
|
||||
void clear_current_regions();
|
||||
|
||||
#ifndef NDEBUG
|
||||
virtual void do_show_regions(const NodePath &render2d);
|
||||
virtual void do_hide_regions();
|
||||
#endif // NDEBUG
|
||||
|
||||
static void intersect_regions(Regions &only_a,
|
||||
Regions &only_b,
|
||||
Regions &both,
|
||||
@@ -161,7 +166,7 @@ protected:
|
||||
private:
|
||||
void consider_keyboard_suppress(const MouseWatcherRegion *region);
|
||||
|
||||
protected:
|
||||
private:
|
||||
// This wants to be a set, but because you cannot export sets across
|
||||
// dlls in windows, we will make it a vector instead
|
||||
typedef pvector< PT(MouseWatcherGroup) > Groups;
|
||||
@@ -194,6 +199,10 @@ protected:
|
||||
ModifierButtons _mods;
|
||||
DisplayRegion *_display_region;
|
||||
|
||||
#ifndef NDEBUG
|
||||
NodePath _show_regions_render2d;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
// Inherited from DataNode
|
||||
virtual void do_transmit_data(DataGraphTraverser *trav,
|
||||
|
||||
@@ -222,11 +222,7 @@ write(ostream &out, int indent_level) const {
|
||||
void MouseWatcherGroup::
|
||||
show_regions(const NodePath &render2d) {
|
||||
MutexHolder holder(_lock);
|
||||
|
||||
_show_regions = true;
|
||||
_show_regions_root = render2d.attach_new_node("show_regions");
|
||||
_show_regions_root.set_bin("unsorted", 0);
|
||||
update_regions();
|
||||
do_show_regions(render2d);
|
||||
}
|
||||
#endif // NDEBUG
|
||||
|
||||
@@ -250,17 +246,14 @@ set_color(const Colorf &color) {
|
||||
#ifndef NDEBUG
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MouseWatcherGroup::hide_regions
|
||||
// Access: Published
|
||||
// Access: Published, Virtual
|
||||
// Description: Stops the visualization created by a previous call to
|
||||
// show_regions().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void MouseWatcherGroup::
|
||||
hide_regions() {
|
||||
MutexHolder holder(_lock);
|
||||
|
||||
_show_regions_root.remove_node();
|
||||
_show_regions = false;
|
||||
_vizzes.clear();
|
||||
do_hide_regions();
|
||||
}
|
||||
#endif // NDEBUG
|
||||
|
||||
@@ -298,6 +291,38 @@ do_remove_region(MouseWatcherRegion *region) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MouseWatcherGroup::do_show_regions
|
||||
// Access: Protected, Virtual
|
||||
// Description: The protected implementation of show_regions(). This
|
||||
// assumes the lock is already held.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void MouseWatcherGroup::
|
||||
do_show_regions(const NodePath &render2d) {
|
||||
_show_regions = true;
|
||||
_show_regions_root = render2d.attach_new_node("show_regions");
|
||||
_show_regions_root.set_bin("unsorted", 0);
|
||||
update_regions();
|
||||
}
|
||||
#endif // NDEBUG
|
||||
|
||||
#ifndef NDEBUG
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MouseWatcherGroup::do_hide_regions
|
||||
// Access: Protected, Virtual
|
||||
// Description: The protected implementation of hide_regions(). This
|
||||
// assumes the lock is already held.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void MouseWatcherGroup::
|
||||
do_hide_regions() {
|
||||
_show_regions_root.remove_node();
|
||||
_show_regions = false;
|
||||
_vizzes.clear();
|
||||
}
|
||||
#endif // NDEBUG
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MouseWatcherGroup::update_regions
|
||||
|
||||
@@ -60,6 +60,11 @@ PUBLISHED:
|
||||
protected:
|
||||
bool do_remove_region(MouseWatcherRegion *region);
|
||||
|
||||
#ifndef NDEBUG
|
||||
virtual void do_show_regions(const NodePath &render2d);
|
||||
virtual void do_hide_regions();
|
||||
#endif // NDEBUG
|
||||
|
||||
protected:
|
||||
typedef pvector< PT(MouseWatcherRegion) > Regions;
|
||||
Regions _regions;
|
||||
|
||||
Reference in New Issue
Block a user