diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-09-13 02:04:50 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-09-13 02:10:19 +0300 |
commit | 1f1802307f9a3b1a09b9eb8d70dadc7c849c5e2c (patch) | |
tree | 75a1859bba472bc01d3801ce027d290adfdc8629 /source/blender/windowmanager/intern/wm_event_system.c | |
parent | 26a6e58e9a259327fd5125095f052a42a9405320 (diff) |
Gizmo: value2d utility to adjust operator values
This allows any operator to interactively redo without having to
manually make each operator modal.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_event_system.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index cd1357e85b1..d9c8028c9bb 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2031,7 +2031,8 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand if (ot && wm_operator_check_locked_interface(C, ot)) { bool use_last_properties = true; PointerRNA tool_properties = {{0}}; - bool use_tool_properties = (handler->keymap_tool != NULL); + const bool is_tool = (handler->keymap_tool != NULL); + const bool use_tool_properties = is_tool; if (use_tool_properties) { WM_toolsystem_ref_properties_init_for_keymap(handler->keymap_tool, &tool_properties, properties, ot); @@ -2044,6 +2045,23 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand if (use_tool_properties) { WM_operator_properties_free(&tool_properties); } + + /* Link gizmo if 'WM_GIZMOGROUPTYPE_TOOL_INIT' is set. */ + if (retval & OPERATOR_FINISHED) { + if (is_tool) { + bToolRef_Runtime *tref_rt = handler->keymap_tool->runtime; + if (tref_rt->gizmo_group[0]) { + const char *idname = tref_rt->gizmo_group; + wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(idname, false); + if (gzgt != NULL) { + if ((gzgt->flag & WM_GIZMOGROUPTYPE_TOOL_INIT) != 0) { + WM_gizmo_group_type_ensure_ptr(gzgt); + } + } + } + } + } + /* Done linking gizmo. */ } } /* Finished and pass through flag as handled */ |