diff options
author | jon denning <gfxcoder@gmail.com> | 2022-07-06 23:21:56 +0300 |
---|---|---|
committer | jon denning <gfxcoder@gmail.com> | 2022-07-06 23:21:56 +0300 |
commit | 3354ec3fb3f6c0785c7c1ad9d84bae1c58d1628f (patch) | |
tree | 7e3754a489ce51d55fddffd25668ee79ed0ac71c | |
parent | 2a60b979cca272f01acf3a08a5517599b94a12f2 (diff) |
Fix T99334: Ignore edit-related snap options in Object mode
When in Object Mode, any of the active- and edit-related snapping
options (Include Active, Include Edited, Include Non-Edited) should be
ignored when in Object Mode, otherwise snapping could be effectively
disabled.
This commit forces snap code to ignore the active- and edit-related
options when in Object Mode.
Reviewed By: Germano Cavalcante (mano-wii)
Differential Revision: https://developer.blender.org/D15366
-rw-r--r-- | source/blender/editors/transform/transform_snap_object.cc | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/source/blender/editors/transform/transform_snap_object.cc b/source/blender/editors/transform/transform_snap_object.cc index 817474f795e..479214ee2d3 100644 --- a/source/blender/editors/transform/transform_snap_object.cc +++ b/source/blender/editors/transform/transform_snap_object.cc @@ -492,39 +492,39 @@ static bool snap_object_is_snappable(const SnapObjectContext *sctx, return false; } - /* get base attributes */ + /* Get attributes of potential target. */ const bool is_active = (base_act == base); const bool is_selected = (base->flag & BASE_SELECTED) || (base->flag_legacy & BA_WAS_SEL); const bool is_edited = (base->object->mode == OB_MODE_EDIT); const bool is_selectable = (base->flag & BASE_SELECTABLE); + /* Get attributes of state. */ const bool is_in_object_mode = (base_act == NULL) || (base_act->object->mode == OB_MODE_OBJECT); - if (is_edited) { - if (is_active) { - if (snap_target_select & SCE_SNAP_TARGET_NOT_ACTIVE) { - return false; - } - } - else { - if (snap_target_select & SCE_SNAP_TARGET_NOT_EDITED) { - return false; - } + if (is_in_object_mode) { + /* Handle target selection options that make sense for object mode. */ + if ((snap_target_select & SCE_SNAP_TARGET_NOT_SELECTED) && is_selected) { + /* What is selectable or not is part of the object and depends on the mode. */ + return false; } } - - if ((snap_target_select & SCE_SNAP_TARGET_NOT_NONEDITED) && !is_edited) { - return false; + else { + /* Handle target selection options that make sense for edit/pose mode. */ + if ((snap_target_select & SCE_SNAP_TARGET_NOT_ACTIVE) && is_active) { + return false; + } + if ((snap_target_select & SCE_SNAP_TARGET_NOT_EDITED) && is_edited && !is_active) { + /* Base is edited, but not active. */ + return false; + } + if ((snap_target_select & SCE_SNAP_TARGET_NOT_NONEDITED) && !is_edited) { + return false; + } } if ((snap_target_select & SCE_SNAP_TARGET_ONLY_SELECTABLE) && !is_selectable) { return false; } - if ((snap_target_select & SCE_SNAP_TARGET_NOT_SELECTED) && is_in_object_mode && is_selected) { - /* What is selectable or not is part of the object and depends on the mode. */ - return false; - } - return true; } |