diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-01-05 06:53:10 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-01-05 06:53:10 +0300 |
commit | 9be32ac5fed2b3d40fe12f31667b58ed1f9da623 (patch) | |
tree | f2cf0bd96e978a4fba80de31edc9ce23e085279b | |
parent | a9e3ac906e23dc72b8af1b07a25286ed0a6b0bcb (diff) |
Fix manipulator crash when modal operator doesn't run
-rw-r--r-- | source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c index ab7b4688d49..bf9b5b72c67 100644 --- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c +++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c @@ -893,17 +893,13 @@ void wm_manipulatormap_modal_set( WM_manipulatormap_tooltip_clear(C, mmap); - /* For now only grab cursor for 3D manipulators. */ - int retval = OPERATOR_RUNNING_MODAL; - if (mpr->type->invoke && (mpr->type->modal || mpr->custom_modal)) { - retval = mpr->type->invoke(C, mpr, event); - } - - if ((retval & OPERATOR_RUNNING_MODAL) == 0) { - return; + const int retval = mpr->type->invoke(C, mpr, event); + if ((retval & OPERATOR_RUNNING_MODAL) == 0) { + return; + } } mpr->state |= WM_MANIPULATOR_STATE_MODAL; @@ -922,7 +918,10 @@ void wm_manipulatormap_modal_set( struct wmManipulatorOpElem *mpop = WM_manipulator_operator_get(mpr, mpr->highlight_part); if (mpop && mpop->type) { - WM_operator_name_call_ptr(C, mpop->type, WM_OP_INVOKE_DEFAULT, &mpop->ptr); + const int retval = WM_operator_name_call_ptr(C, mpop->type, WM_OP_INVOKE_DEFAULT, &mpop->ptr); + if ((retval & OPERATOR_RUNNING_MODAL) == 0) { + wm_manipulatormap_modal_set(mmap, C, mpr, event, false); + } /* we failed to hook the manipulator to the operator handler or operator was cancelled, return */ if (!mmap->mmap_context.modal) { |