diff options
author | Campbell Barton <campbell@blender.org> | 2022-03-22 08:41:11 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-03-22 09:34:37 +0300 |
commit | fa96f7381c3dddefb43a75c845444ac4d5e8fb5a (patch) | |
tree | b45d0e1538988de50b107d6fcf168f6a807eba25 | |
parent | 8c072cdc935c6cd6ccb7babd48df3809577c6e71 (diff) |
Cleanup: de-duplicate object-mode locking when selecting
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.c | 50 |
1 files changed, 18 insertions, 32 deletions
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 73155a3b52f..b51adb7cb5b 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -2450,19 +2450,6 @@ static bool ed_object_select_pick(bContext *C, } } } - if (scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) { - if (is_obedit == false) { - if (basact && !BKE_object_is_mode_compat(basact->object, object_mode)) { - if (object_mode == OB_MODE_OBJECT) { - struct Main *bmain = CTX_data_main(C); - ED_object_mode_generic_exit(bmain, vc.depsgraph, scene, basact->object); - } - if (!BKE_object_is_mode_compat(basact->object, object_mode)) { - basact = NULL; - } - } - } - } } else { GPUSelectResult buffer[MAXPICKELEMS]; @@ -2578,31 +2565,30 @@ static bool ed_object_select_pick(bContext *C, handled = true; } } + } - if (scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) { - if ((handled == false) && (is_obedit == false)) { - if (basact && !BKE_object_is_mode_compat(basact->object, object_mode)) { - if (object_mode == OB_MODE_OBJECT) { - struct Main *bmain = CTX_data_main(C); - ED_object_mode_generic_exit(bmain, vc.depsgraph, scene, basact->object); - } - if (!BKE_object_is_mode_compat(basact->object, object_mode)) { - basact = NULL; - } - } + if ((scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) && + /* No further selection should take place. */ + (handled == false) && + /* No special logic in edit-mode. */ + (is_obedit == false)) { + + if (basact && !BKE_object_is_mode_compat(basact->object, object_mode)) { + if (object_mode == OB_MODE_OBJECT) { + struct Main *bmain = CTX_data_main(C); + ED_object_mode_generic_exit(bmain, vc.depsgraph, scene, basact->object); + } + if (!BKE_object_is_mode_compat(basact->object, object_mode)) { + basact = NULL; } } - } - if (scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) { /* Disallow switching modes, * special exception for edit-mode - vertex-parent operator. */ - if ((handled == false) && (is_obedit == false)) { - if (oldbasact && basact) { - if ((oldbasact->object->mode != basact->object->mode) && - (oldbasact->object->mode & basact->object->mode) == 0) { - basact = NULL; - } + if (basact && oldbasact) { + if ((oldbasact->object->mode != basact->object->mode) && + (oldbasact->object->mode & basact->object->mode) == 0) { + basact = NULL; } } } |