diff options
author | jon denning <gfxcoder@gmail.com> | 2022-06-30 03:52:00 +0300 |
---|---|---|
committer | jon denning <gfxcoder@gmail.com> | 2022-06-30 03:52:00 +0300 |
commit | 011327224ecec1312e0780865a1fb0dc83830a30 (patch) | |
tree | f6e82e3c116fd7bd18f0277bbeb4f3756124bb67 /release | |
parent | 0ea282f7462070041b2599389ba61c7ef50426b5 (diff) |
Transform Snap: nearest face snap mode, snapping options, refactoring.
This commit adds a new face nearest snapping mode, adds new snapping
options, and (lightly) refactors code around snapping.
The new face nearest snapping mode will snap transformed geometry to the
nearest surface in world space. In contrast, the original face snapping
mode uses projection (raycasting) to snap source to target geometry.
Face snapping therefore only works with what is visible, while nearest
face snapping can snap geometry to occluded parts of the scene. This new
mode is critical for retopology work, where some of the target mesh
might be occluded (ex: sliding an edge loop that wraps around the
backside of target mesh).
The nearest face snapping mode has two options: "Snap to Same Target"
and "Face Nearest Steps". When the Snap to Same Object option is
enabled, the selected source geometry will stay near the target that it
is nearest before editing started, which prevents the source geometry
from snapping to other targets. The Face Nearest Steps divides the
overall transformation for each vertex into n smaller transformations,
then applies those n transformations with surface snapping interlacing
each step. This steps option handles transformations that cross U-shaped
targets better.
The new snapping options allow the artist to better control which target
objects (objects to which the edited geometry is snapped) are considered
when snapping. In particular, the only option for filtering target
objects was a "Project onto Self", which allowed the currently edited
mesh to be considered as a target. Now, the artist can choose any
combination of the following to be considered as a target: the active
object, any edited object that isn't active (see note below), any non-
edited object. Additionally, the artist has another snapping option to
exclude objects that are not selectable as potential targets.
The Snapping Options dropdown has been lightly reorganized to allow for
the additional options.
Included in this patch:
- Snap target selection is more controllable for artist with additional
snapping options.
- Renamed a few of the snap-related functions to better reflect what
they actually do now. For example, `applySnapping` implies that this
handles the snapping, while `applyProject` implies something entirely
different is done there. However, better names would be
`applySnappingAsGroup` and `applySnappingIndividual`, respectively,
where `applySnappingIndividual` previously only does Face snapping.
- Added an initial coordinate parameter to snapping functions so that
the nearest target before transforming can be determined(for "Snap to
Same Object"), and so the transformation can be broken into smaller
steps (for "Face Nearest Steps").
- Separated the BVH Tree getter code from mesh/edit mesh to its own
function to reduce code duplication.
- Added icon for nearest face snapping.
- The original "Project onto Self" was actually not correct! This option
should be called "Project onto Active" instead, but that only matters
when editing multiple meshes at the same time. This patch makes this
change in the UI.
Reviewed By: Campbell Barton, Germano Cavalcante
Differential Revision: https://developer.blender.org/D14591
Diffstat (limited to 'release')
-rw-r--r-- | release/datafiles/blender_icons.svg | 49 | ||||
-rw-r--r-- | release/datafiles/blender_icons16/icon16_snap_face_nearest.dat | bin | 0 -> 1048 bytes | |||
-rw-r--r-- | release/datafiles/blender_icons32/icon32_snap_face_nearest.dat | bin | 0 -> 4120 bytes | |||
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 46 |
4 files changed, 77 insertions, 18 deletions
diff --git a/release/datafiles/blender_icons.svg b/release/datafiles/blender_icons.svg index f8164d1f646..985714d813f 100644 --- a/release/datafiles/blender_icons.svg +++ b/release/datafiles/blender_icons.svg @@ -11,9 +11,9 @@ height="640" id="svg2" sodipodi:version="0.32" - inkscape:version="1.0 (4035a4f, 2020-05-01)" + inkscape:version="1.0.2 (e86c870879, 2021-01-15)" version="1.0" - sodipodi:docname="blender_icons.svg" + sodipodi:docname="blender_icons.master.svg" inkscape:output_extension="org.inkscape.output.svg.inkscape" style="display:inline;enable-background:new" inkscape:export-filename="blender_icons.png" @@ -42,17 +42,17 @@ guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" - inkscape:window-width="1792" - inkscape:window-height="968" + inkscape:window-width="1618" + inkscape:window-height="846" id="namedview34335" showgrid="false" - inkscape:zoom="0.815521" - inkscape:cx="60.911776" - inkscape:cy="331.5525" - inkscape:window-x="-1" - inkscape:window-y="25" + inkscape:zoom="16" + inkscape:cx="18.1714" + inkscape:cy="166.10682" + inkscape:window-x="185" + inkscape:window-y="159" inkscape:window-maximized="0" - inkscape:current-layer="layer2" /> + inkscape:current-layer="layer8" /> <defs id="defs4" /> <path @@ -17505,6 +17505,35 @@ id="path2-6" d="m 469,101 v 7.5 c 0,0.276 0.224,0.5 0.5,0.5 h 11 c 0.30423,0 0.5,-0.22782 0.5,-0.5 v -4 c 0,-0.65459 -1,-0.65682 -1,0 v 3.5 h -10 v -7 z m 4.48081,-6 c -0.151,0.004 -0.293,0.077 -0.384,0.197 l -3.95,3.949 c -0.314,0.315 -0.091,0.854 0.354,0.854 h 4 c 0.276,0 0.5,-0.224 0.5,-0.5 V 96 H 480.5 c 0.68512,0 0.64092,-1 0,-1 z" /> </g> + <g + id="g7324" + transform="translate(-231.45606,21.458247)" + style="display:inline;enable-background:new"> + <path + style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.6;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:new" + d="m 244.01184,140.51071 c 1.65601,0 3,1.37486 3,3.04688 0,1.67201 -1.34399,3.04687 -3,3.04687 -1.65601,0 -3,-1.37486 -3,-3.04687 0,-1.67202 1.34399,-3.04688 3,-3.04688 z m 0,1 c -1.10534,0 -2,0.90526 -2,2.04688 0,1.14161 0.89466,2.04687 2,2.04687 1.10534,0 2,-0.90526 2,-2.04687 0,-1.14162 -0.89466,-2.04688 -2,-2.04688 z" + id="circle22836-6" + inkscape:connector-curvature="0" /> + <path + style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:new" + d="m 244.01184,137.51071 c -3.5093,0 -6,2.77253 -6,5.91992 v 7.08008 h -0.96094 a 0.50004991,0.50004991 0 1 0 0,1 h 1.46094 a 0.50004991,0.50004991 0 0 0 0.5,-0.5 v -7.58008 c 0,-2.62796 2.01002,-4.91992 5,-4.91992 2.99076,0 5,2.29197 5,4.91992 v 7.58008 a 0.50004991,0.50004991 0 0 0 0.5,0.5 h 1.46094 a 0.50004991,0.50004991 0 1 0 0,-1 h -0.96094 v -7.08008 c 0,-3.14741 -2.49004,-5.91992 -6,-5.91992 z" + id="path22838-0" + inkscape:connector-curvature="0" /> + <g + transform="translate(-15.954521,-1.3298229)" + style="display:inline;fill:#ffffff;enable-background:new" + id="g26501-5-3" + inkscape:export-filename="blender_icons.png" + inkscape:export-xdpi="96" + inkscape:export-ydpi="96"> + <path + sodipodi:nodetypes="ccccccccc" + inkscape:connector-curvature="0" + id="path26499-8-9" + d="m 258.49962,136.9993 c -0.27613,3e-5 -0.49997,0.22387 -0.5,0.5 v 3 c 3e-5,0.27613 0.22387,0.49997 0.5,0.5 h 3 c 0.27613,-3e-5 0.49997,-0.22387 0.5,-0.5 v -3 c -3e-5,-0.27613 -0.22387,-0.49997 -0.5,-0.5 z" + style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" /> + </g> + </g> </g> <g inkscape:groupmode="layer" diff --git a/release/datafiles/blender_icons16/icon16_snap_face_nearest.dat b/release/datafiles/blender_icons16/icon16_snap_face_nearest.dat Binary files differnew file mode 100644 index 00000000000..eade810d41a --- /dev/null +++ b/release/datafiles/blender_icons16/icon16_snap_face_nearest.dat diff --git a/release/datafiles/blender_icons32/icon32_snap_face_nearest.dat b/release/datafiles/blender_icons32/icon32_snap_face_nearest.dat Binary files differnew file mode 100644 index 00000000000..19ca9d38995 --- /dev/null +++ b/release/datafiles/blender_icons32/icon32_snap_face_nearest.dat diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 1f69705db8e..411bad65991 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -6796,23 +6796,53 @@ class VIEW3D_PT_snapping(Panel): col.prop(tool_settings, "use_snap_grid_absolute") if snap_elements != {'INCREMENT'}: - col.label(text="Snap With") - row = col.row(align=True) - row.prop(tool_settings, "snap_target", expand=True) - - col.prop(tool_settings, "use_snap_backface_culling") + if snap_elements != {'FACE_NEAREST'}: + col.label(text="Snap With") + row = col.row(align=True) + row.prop(tool_settings, "snap_target", expand=True) if obj: + col.label(text="Target Selection") + col_targetsel = col.column(align=True) if object_mode == 'EDIT' and obj.type not in {'LATTICE', 'META', 'FONT'}: - sub = col.column() - sub.active = not (tool_settings.use_proportional_edit and obj.type == 'MESH') - sub.prop(tool_settings, "use_snap_self") + col_targetsel.prop( + tool_settings, + "use_snap_self", + text="Include Active", + icon='EDITMODE_HLT', + ) + col_targetsel.prop( + tool_settings, + "use_snap_edit", + text="Include Edited", + icon='OUTLINER_DATA_MESH', + ) + col_targetsel.prop( + tool_settings, + "use_snap_nonedit", + text="Include Non-Edited", + icon='OUTLINER_OB_MESH', + ) + col_targetsel.prop( + tool_settings, + "use_snap_selectable", + text="Exclude Non-Selectable", + icon='RESTRICT_SELECT_OFF', + ) + if object_mode in {'OBJECT', 'POSE', 'EDIT', 'WEIGHT_PAINT'}: col.prop(tool_settings, "use_snap_align_rotation") + col.prop(tool_settings, "use_snap_backface_culling") + if 'FACE' in snap_elements: col.prop(tool_settings, "use_snap_project") + if 'FACE_NEAREST' in snap_elements: + col.prop(tool_settings, 'use_snap_to_same_target') + if object_mode == 'EDIT': + col.prop(tool_settings, 'snap_face_nearest_steps') + if 'VOLUME' in snap_elements: col.prop(tool_settings, "use_snap_peel_object") |