diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-10-17 18:45:26 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-10-17 18:45:26 +0400 |
commit | ffac46c30c92fc09b81494953b1a4e2d18fb005c (patch) | |
tree | 5eb004c0f7058bdaf41f3e0a8dfb68efb7d7c382 /source/blender/windowmanager/intern | |
parent | 1f9f58938d2072ea74c2ac7741aeb921d53006de (diff) |
Store the active widget in the context. This allows us to first call the
widget handler if needed.
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 3 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_generic_widgets.c | 6 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_widgets.c | 5 |
3 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 398d0d0764b..475815ad379 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2559,7 +2559,7 @@ wmEventHandler *WM_event_add_modal_handler(bContext *C, wmOperator *op) { wmEventHandler *handler = MEM_callocN(sizeof(wmEventHandler), "event modal handler"); wmWindow *win = CTX_wm_window(C); - + /* operator was part of macro */ if (op->opm) { /* give the mother macro to the handler */ @@ -2572,6 +2572,7 @@ wmEventHandler *WM_event_add_modal_handler(bContext *C, wmOperator *op) handler->op_area = CTX_wm_area(C); /* means frozen screen context for modal handlers! */ handler->op_region = CTX_wm_region(C); + handler->op_widget = CTX_wm_widget(C); BLI_addhead(&win->modalhandlers, handler); diff --git a/source/blender/windowmanager/intern/wm_generic_widgets.c b/source/blender/windowmanager/intern/wm_generic_widgets.c index 4fd522e2366..12da73e3536 100644 --- a/source/blender/windowmanager/intern/wm_generic_widgets.c +++ b/source/blender/windowmanager/intern/wm_generic_widgets.c @@ -28,6 +28,7 @@ */ #include "RNA_types.h" +#include "RNA_access.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" @@ -228,6 +229,11 @@ static int widget_arrow_handler(struct bContext *C, const struct wmEvent *event, project_v3_v3v3(orig_origin, orig_origin, arrow->direction); add_v3_v3v3(widget->origin, orig_origin, data->orig_origin); + /* set the property for the operator and call its modal function */ + if (widget->prop) { + RNA_float_set_array(&widget->opptr, widget->prop, widget->origin); + } + /* tag the region for redraw */ ED_region_tag_redraw(ar); diff --git a/source/blender/windowmanager/intern/wm_widgets.c b/source/blender/windowmanager/intern/wm_widgets.c index 0b8d6261dac..a9f8ef21dd0 100644 --- a/source/blender/windowmanager/intern/wm_widgets.c +++ b/source/blender/windowmanager/intern/wm_widgets.c @@ -541,7 +541,8 @@ void wm_widgetmap_set_active_widget(struct wmWidgetMap *wmap, struct bContext *C widget->initialize_op(C, event, widget, &widget->opptr); } - //WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &widget->opptr); + CTX_wm_widget_set(C, widget); + WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &widget->opptr); wmap->active_widget = widget; return; } @@ -571,6 +572,8 @@ void wm_widgetmap_set_active_widget(struct wmWidgetMap *wmap, struct bContext *C WM_operator_properties_free(&widget->opptr); } + CTX_wm_widget_set(C, NULL); + wmap->active_widget = NULL; ED_region_tag_redraw(ar); } |