Commit: 61f52072e12aae2989f11fddf253364b2f4328e5
Author: Julian Eisel
Date: Sun Aug 16 20:31:24 2015 +0200
Branches: wiggly-widgets
https://developer.blender.org/rB61f52072e12aae2989f11fddf253364b2f4328e5
Fix manipulator mouse hover highlighting (Finally! \o/)
Issue already existed since rB4ee1de8c3ce6e, used fallback to old manipulator
handling since then.
Issue was that we weren't able do identify the highlighted widget after freeing
and reinitializing the widget group (as it happens on each redraw).
widgets_compare checked the property assigned to the widgets, but since the
manipulator widgets trigger operators instead of tweaking a property, it never
returned the right result.
Now, instead of comparing widget properties, we use a widget id-name that is
unique within it's widget group (see rB3b42468bff06d2).
Hrmpf, and I spent countless hours debugging widget initialization and OGL
selection :S
===================================================================
M source/blender/editors/transform/manipulator_widget.c
M source/blender/windowmanager/intern/wm_widgets.c
===================================================================
diff --git a/source/blender/editors/transform/manipulator_widget.c
b/source/blender/editors/transform/manipulator_widget.c
index c52b37b..b27b03c 100644
--- a/source/blender/editors/transform/manipulator_widget.c
+++ b/source/blender/editors/transform/manipulator_widget.c
@@ -1979,20 +1979,13 @@ static void WIDGETGROUP_manipulator_free(struct
wmWidgetGroup *wgroup)
static ManipulatorGroup *manipulator_widgetgroup_create(struct wmWidgetGroup
*wgroup)
{
ManipulatorGroup *manipulator = MEM_callocN(sizeof(ManipulatorGroup),
"manipulator_data");
- wmWidget *widget, *axis;
+ wmWidget *axis;
float color_green[4] = {0.25f, 1.0f, 0.25f, 1.0f};
float color_red[4] = {1.0f, 0.25f, 0.25f, 1.0f};
float color_blue[4] = {0.25f, 0.25f, 1.0f, 1.0f};
short i;
- widget = WM_widget_new(WIDGET_manipulator_draw,
- WIDGET_manipulator_render_3d_intersect,
- NULL,
- WIDGET_manipulator_handler);
-
- wm_widget_register(wgroup, widget, "");
-
manipulator->translate_x = WIDGET_arrow_new(wgroup, "translate_x",
WIDGET_ARROW_STYLE_NORMAL);
manipulator->translate_y = WIDGET_arrow_new(wgroup, "translate_y",
WIDGET_ARROW_STYLE_NORMAL);
manipulator->translate_z = WIDGET_arrow_new(wgroup, "translate_z",
WIDGET_ARROW_STYLE_NORMAL);
@@ -2022,7 +2015,6 @@ static ManipulatorGroup
*manipulator_widgetgroup_create(struct wmWidgetGroup *wg
WIDGET_dial_set_color(axis, color_blue);
break;
}
- axis->render_3d_intersection = widget->render_3d_intersection;
/* XXX overides arrow/dial intersection */
}
MAN_ITER_AXES_END;
diff --git a/source/blender/windowmanager/intern/wm_widgets.c
b/source/blender/windowmanager/intern/wm_widgets.c
index 22d5f1f..a271515 100644
--- a/source/blender/windowmanager/intern/wm_widgets.c
+++ b/source/blender/windowmanager/intern/wm_widgets.c
@@ -257,17 +257,7 @@ static void widget_calculate_scale(wmWidget *widget, const
bContext *C)
static bool widgets_compare(wmWidget *widget, wmWidget *widget2)
{
- int i;
-
- if (widget->max_prop != widget2->max_prop)
- return false;
-
- for (i = 0; i < widget->max_prop; i++) {
- if (widget->props[i] != widget2->props[i] ||
widget->ptr[i].data != widget2->ptr[i].data)
- return false;
- }
-
- return true;
+ return STREQ(widget->idname, widget2->idname);
}
void WM_widgets_update(const bContext *C, wmWidgetMap *wmap)
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs