[Bf-blender-cvs] [088ff21] wiggly-widgets: Manipulator now uses the widget system (no operators used).
Antony Riakiotakis
noreply at git.blender.org
Mon Sep 29 19:48:52 CEST 2014
Commit: 088ff210a949b0e5c999124d8ff3c74791616d87
Author: Antony Riakiotakis
Date: Mon Sep 29 19:48:38 2014 +0200
Branches: wiggly-widgets
https://developer.blender.org/rB088ff210a949b0e5c999124d8ff3c74791616d87
Manipulator now uses the widget system (no operators used).
Widgets use a similar notification system as operators. It might be
worth using WM_BREAK messages like the rest of the handlers. For now
this should do.
===================================================================
M source/blender/editors/space_view3d/space_view3d.c
M source/blender/editors/transform/transform_manipulator.c
M source/blender/windowmanager/WM_api.h
M source/blender/windowmanager/intern/wm_event_system.c
M source/blender/windowmanager/intern/wm_widgets.c
===================================================================
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index d50c53c..2acc42a 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -559,7 +559,8 @@ static void view3d_main_area_init(wmWindowManager *wm, ARegion *ar)
WM_event_add_dropbox_handler(&ar->handlers, lb);
ar->widgets = WM_widgetmap_find("View3D", SPACE_VIEW3D, RGN_TYPE_WINDOW);
- WM_widget_handler_register(ar);
+
+ WM_event_add_widget_handler(ar);
}
static void view3d_main_area_exit(wmWindowManager *wm, ARegion *ar)
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index c6a93d5..a0f72f1 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -1829,7 +1829,6 @@ int BIF_do_manipulator(bContext *C, const struct wmEvent *event, wmWidget *UNUSE
// find the hotspots first test narrow hotspot
val = manipulator_selectbuf(sa, ar, event->mval, 0.5f * (float)U.tw_hotspot);
if (val) {
-
// drawflags still global, for drawing call above
drawflags = manipulator_selectbuf(sa, ar, event->mval, 0.2f * (float)U.tw_hotspot);
if (drawflags == 0) drawflags = val;
@@ -1946,5 +1945,5 @@ int BIF_do_manipulator(bContext *C, const struct wmEvent *event, wmWidget *UNUSE
MEM_freeN(ptr);
}
- return val;
+ return (val) ? OPERATOR_FINISHED : OPERATOR_PASS_THROUGH;
}
\ No newline at end of file
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index b6153f4..b16a61f 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -469,7 +469,7 @@ struct wmWidget *WM_widget_new(bool (*poll)(const struct bContext *, struct wmWi
void WM_widgets_delete(ListBase *widgetlist, struct wmWidget *widget);
void WM_widgets_draw(const struct bContext *C, struct ARegion *ar);
-void WM_widget_handler_register(struct ARegion *ar);
+void WM_event_add_widget_handler(struct ARegion *ar);
bool WM_widget_register(ListBase *widgetlist, struct wmWidget *widget);
void WM_widget_unregister(ListBase *widgetlist, struct wmWidget *widget);
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 77e92a2..ef64f5d 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1972,11 +1972,15 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
}
else if (handler->widgets) {
wmWidget *widget;
+ int ret;
/* similar interface to operators */
for (widget = handler->widgets->first; widget; widget = widget->next) {
if (widget->handler && (!widget->poll || widget->poll(C, widget))) {
- action |= widget->handler(C, event, widget);
+ if ((ret = widget->handler(C, event, widget)) == OPERATOR_FINISHED) {
+ action |= WM_HANDLER_BREAK;
+ break;
+ }
}
}
}
diff --git a/source/blender/windowmanager/intern/wm_widgets.c b/source/blender/windowmanager/intern/wm_widgets.c
index cc11195..797a92a 100644
--- a/source/blender/windowmanager/intern/wm_widgets.c
+++ b/source/blender/windowmanager/intern/wm_widgets.c
@@ -131,7 +131,7 @@ void WM_widgets_draw(const struct bContext *C, struct ARegion *ar)
}
}
-void WM_widget_handler_register(ARegion *ar)
+void WM_event_add_widget_handler(ARegion *ar)
{
wmEventHandler *handler;
@@ -142,7 +142,7 @@ void WM_widget_handler_register(ARegion *ar)
handler = MEM_callocN(sizeof(wmEventHandler), "widget handler");
handler->widgets = ar->widgets;
- BLI_addtail(&ar->handlers, handler);
+ BLI_addhead(&ar->handlers, handler);
}
More information about the Bf-blender-cvs
mailing list