diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2021-04-17 22:36:00 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-04-17 22:51:19 +0300 |
commit | 4e1507bd3b9f28746d4c207391020a5eae8f77ad (patch) | |
tree | 48dc5598458b075241fbddaa0e32e76911a98bbe /source/blender/editors/gizmo_library | |
parent | 1fc446a9087b8c662f514884a37518078bad6161 (diff) |
Snap Gizmo Refactor: Implement options for the gizmo behavior
The Snap Gizmo now has options for occlusion, selection filter and edit
geometry.
It will be useful to implement in current tools.
Diffstat (limited to 'source/blender/editors/gizmo_library')
-rw-r--r-- | source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c index 6c274a0fbf9..79462f1cdf3 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c @@ -368,25 +368,39 @@ short ED_gizmotypes_snap_3d_update(wmGizmo *gz, snap_elements &= ~SCE_SNAP_MODE_EDGE_PERPENDICULAR; } + eSnapSelect snap_select = (snap_gizmo->flag & ED_SNAPGIZMO_SNAP_ONLY_ACTIVE) ? + SNAP_ONLY_ACTIVE : + SNAP_ALL; + + eSnapEditType edit_mode_type = (snap_gizmo->flag & ED_SNAPGIZMO_SNAP_EDIT_GEOM_FINAL) ? + SNAP_GEOM_FINAL : + (snap_gizmo->flag & ED_SNAPGIZMO_SNAP_EDIT_GEOM_CAGE) ? + SNAP_GEOM_CAGE : + SNAP_GEOM_EDIT; + + bool use_occlusion_test = (snap_gizmo->flag & ED_SNAPGIZMO_OCCLUSION_ALWAYS_TRUE) ? false : + true; + float dist_px = 12.0f * U.pixelsize; ED_gizmotypes_snap_3d_context_ensure(scene, region, v3d, gz); - snap_elem = ED_transform_snap_object_project_view3d_ex(snap_gizmo->snap_context_v3d, - depsgraph, - snap_elements, - &(const struct SnapObjectParams){ - .snap_select = SNAP_ALL, - .edit_mode_type = SNAP_GEOM_EDIT, - .use_occlusion_test = true, - }, - mval_fl, - prev_co, - &dist_px, - co, - no, - &index, - NULL, - NULL); + snap_elem = ED_transform_snap_object_project_view3d_ex( + snap_gizmo->snap_context_v3d, + depsgraph, + snap_elements, + &(const struct SnapObjectParams){ + .snap_select = snap_select, + .edit_mode_type = edit_mode_type, + .use_occlusion_test = use_occlusion_test, + }, + mval_fl, + prev_co, + &dist_px, + co, + no, + &index, + NULL, + NULL); } if (snap_elem == 0) { |