[Bf-blender-cvs] [97bb7d0] wiggly-widgets: Hook calling widget to operator event system. Alpha alpha code still. Transform/lamp still don't process those.
Antony Riakiotakis
noreply at git.blender.org
Fri Oct 17 19:17:26 CEST 2014
Commit: 97bb7d0a5ba1cbd0d34bb4408090329a468065c8
Author: Antony Riakiotakis
Date: Fri Oct 17 17:11:14 2014 +0200
Branches: wiggly-widgets
https://developer.blender.org/rB97bb7d0a5ba1cbd0d34bb4408090329a468065c8
Hook calling widget to operator event system. Alpha alpha code still.
Transform/lamp still don't process those.
===================================================================
M source/blender/windowmanager/intern/wm_event_system.c
M source/blender/windowmanager/wm_event_types.h
===================================================================
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 475815a..2334275 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1575,10 +1575,37 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
if (ot->flag & OPTYPE_UNDO)
wm->op_undo_depth++;
- /* warning, after this call all context data and 'event' may be freed. see check below */
- retval = ot->modal(C, op, event);
+ /* if a widget has called the operator, it swallows all events here */
+ if (handler->op_widget) {
+ wmWidget *widget = handler->op_widget;
+
+ switch (event->type) {
+ case MOUSEMOVE:
+ if (widget->handler(C, event, widget) == OPERATOR_PASS_THROUGH) {
+ event->type = EVT_WIDGET_UPDATE;
+ retval = ot->modal(C, op, event);
+ }
+ break;
+
+ case LEFTMOUSE:
+ {
+ if (event->val == KM_RELEASE) {
+ ARegion *ar = CTX_wm_region(C);
+ event->type = EVT_WIDGET_RELEASED;
+ retval = ot->modal(C, op, event);
+ wm_widgetmap_set_active_widget(ar->widgetmap, C, event, NULL);
+ handler->op_widget = NULL;
+ }
+ break;
+ }
+ }
+ }
+ else {
+ /* warning, after this call all context data and 'event' may be freed. see check below */
+ retval = ot->modal(C, op, event);
+ }
+
OPERATOR_RETVAL_CHECK(retval);
-
/* when this is _not_ the case the modal modifier may have loaded
* a new blend file (demo mode does this), so we have to assume
* the event, operator etc have all been freed. - campbell */
@@ -2014,6 +2041,7 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
}
}
else {
+ /* handle the widget first, before passing the event down */
/* modal, swallows all */
action |= wm_handler_operator_call(C, handlers, handler, event, NULL);
}
diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h
index 7dfc2b5..e060b1e 100644
--- a/source/blender/windowmanager/wm_event_types.h
+++ b/source/blender/windowmanager/wm_event_types.h
@@ -316,6 +316,8 @@ enum {
EVT_DROP = 0x5023,
EVT_BUT_CANCEL = 0x5024,
+ EVT_WIDGET_UPDATE = 0x5024,
+ EVT_WIDGET_RELEASED = 0x5025,
/* ********** End of Blender internal events. ********** */
};
More information about the Bf-blender-cvs
mailing list