[Bf-blender-cvs] [59adee83e7c] retopo_transform: Transform Snap: added nearest face snap mode, added snapping options, lightly refactored snapping code.

Jon Denning noreply at git.blender.org
Sat Jul 16 13:00:35 CEST 2022


Commit: 59adee83e7cd1e312a28d8dc96a5ced04ca2036e
Author: Jon Denning
Date:   Fri Jun 3 10:48:04 2022 -0400
Branches: retopo_transform
https://developer.blender.org/rB59adee83e7cd1e312a28d8dc96a5ced04ca2036e

Transform Snap: added nearest face snap mode, added snapping options, lightly refactored snapping code.

This diff 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.

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 e [...]

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-ed [...]

The Snapping Options dropdown has been lightly reorganized to allow for the additional options.

Included in this patch:

  - Refactored the snap-related `#define`s into `enum`s, and refactored enum-related `char`, `short`, and `int` to use the appropriate enum instead.
  - 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.
  - Updated `startup.blend` so face nearest steps starts at 1, and the snap target selection options have reasonable defaults (include self, include edited, include nonedited)
  - 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.

Not included in this patch / future updates:

  - Snapping "Target" is a confusing named, as "Target" is used as both the transformed items (or `SCE_SNAP_TARGET_CLOSEST`, etc.) and for the objects to which the transformed items are snapped (especially Shrinkwrap modifier).  I plan to submit another patch to make this clearer after this is accepted.
  - Many of the functions do not specify in which space the point info (coordinates and normal) is defined.
  - Target selection code could be simplified by separating it from the uber `snap_flag` variable.
  - The snapping dropdown is feeling very disorganized.  Also, since enabling both the Face Projection and the Face Nearest methods does not make sense, perhaps the switch between these methods could be a checkbox (similar to snapping to relative or absolute grid).

Differential Revision: https://developer.blender.org/D14591

===================================================================

M	release/datafiles/blender_icons.svg
A	release/datafiles/blender_icons16/icon16_snap_surface.dat
A	release/datafiles/blender_icons32/icon32_snap_surface.dat
M	release/datafiles/startup.blend
M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/editors/curve/editcurve.c
M	source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c
M	source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c
M	source/blender/editors/gpencil/gpencil_utils.c
M	source/blender/editors/include/ED_gizmo_library.h
M	source/blender/editors/include/ED_transform.h
M	source/blender/editors/include/ED_transform_snap_object_context.h
M	source/blender/editors/include/ED_view3d.h
M	source/blender/editors/include/UI_icons.h
M	source/blender/editors/mesh/editmesh_extrude.c
M	source/blender/editors/mesh/editmesh_utils.c
M	source/blender/editors/space_view3d/view3d_cursor_snap.c
M	source/blender/editors/space_view3d/view3d_edit.c
M	source/blender/editors/space_view3d/view3d_gizmo_ruler.c
M	source/blender/editors/space_view3d/view3d_navigate_walk.c
M	source/blender/editors/space_view3d/view3d_placement.c
M	source/blender/editors/transform/transform.c
M	source/blender/editors/transform/transform.h
M	source/blender/editors/transform/transform_constraints.c
M	source/blender/editors/transform/transform_convert_armature.c
M	source/blender/editors/transform/transform_convert_curve.c
M	source/blender/editors/transform/transform_convert_lattice.c
M	source/blender/editors/transform/transform_convert_mball.c
M	source/blender/editors/transform/transform_convert_mesh.c
M	source/blender/editors/transform/transform_convert_object.c
M	source/blender/editors/transform/transform_convert_object_texspace.c
M	source/blender/editors/transform/transform_convert_particle.c
M	source/blender/editors/transform/transform_mode.c
M	source/blender/editors/transform/transform_mode.h
M	source/blender/editors/transform/transform_mode_edge_rotate_normal.c
M	source/blender/editors/transform/transform_mode_edge_seq_slide.c
M	source/blender/editors/transform/transform_mode_edge_slide.c
M	source/blender/editors/transform/transform_mode_resize.c
M	source/blender/editors/transform/transform_mode_rotate.c
M	source/blender/editors/transform/transform_mode_skin_resize.c
M	source/blender/editors/transform/transform_mode_translate.c
M	source/blender/editors/transform/transform_mode_vert_slide.c
M	source/blender/editors/transform/transform_snap.c
M	source/blender/editors/transform/transform_snap.h
M	source/blender/editors/transform/transform_snap_object.cc
M	source/blender/makesdna/DNA_scene_defaults.h
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesrna/intern/rna_scene.c
M	source/blender/makesrna/intern/rna_scene_api.c
M	source/blender/windowmanager/xr/intern/wm_xr_operators.c

===================================================================

diff --git a/release/datafiles/blender_icons.svg b/release/datafiles/blender_icons.svg
index 6f0216176d7..f1ad11fae72 100644
--- a/release/datafiles/blender_icons.svg
+++ b/release/datafiles/blender_icons.svg
@@ -1,24 +1,24 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://creativecommons.org/ns#"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
    width="602"
    height="640"
    id="svg2"
    sodipodi:version="0.32"
-   inkscape:version="1.0 (4035a4f, 2020-05-01)"
+   inkscape:version="1.1.2 (b8e25be8, 2022-02-05)"
    version="1.0"
    sodipodi:docname="blender_icons.svg"
    inkscape:output_extension="org.inkscape.output.svg.inkscape"
    style="display:inline;enable-background:new"
    inkscape:export-filename="blender_icons.png"
    inkscape:export-xdpi="96"
-   inkscape:export-ydpi="96">
+   inkscape:export-ydpi="96"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:dc="http://purl.org/dc/elements/1.1/">
   <metadata
      id="metadata34337">
     <rdf:RDF>
@@ -27,7 +27,7 @@
         <dc:format>image/svg+xml</dc:format>
         <dc:type
            rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-        <dc:title></dc:title>
+        <dc:title />
       </cc:Work>
     </rdf:RDF>
   </metadata>
@@ -42,17 +42,21 @@
      guidetolerance="10"
      inkscape:pageopacity="0"
      inkscape:pageshadow="2"
-     inkscape:window-width="1792"
-     inkscape:window-height="968"
+     inkscape:window-width="1440"
+     inkscape:window-height="900"
      id="namedview34335"
-     showgrid="false"
-     inkscape:zoom="0.815521"
-     inkscape:cx="60.911776"
-     inkscape:cy="331.5525"
-     inkscape:window-x="-1"
-     inkscape:window-y="25"
+     showgrid="true"
+     inkscape:zoom="16"
+     inkscape:cx="9.84375"
+     inkscape:cy="173.625"
+     inkscape:window-x="0"
+     inkscape:window-y="483"
      inkscape:window-maximized="0"
-     inkscape:current-layer="layer2" />
+     inkscape:current-layer="layer8">
+    <inkscape:grid
+       type="xygrid"
+       id="grid13870" />
+  </sodipodi:namedview>
   <defs
      id="defs4" />
   <path
@@ -17473,6 +17477,34 @@
          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.49184,21.480752)">
+      <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:nor [...]
+         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:nor [...]
+         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:n [...]
+      </g>
+    </g>
   </g>
   <g
      inkscape:groupmode="layer"
diff --git a/release/datafiles/blender_icons16/icon16_snap_surface.dat b/release/datafiles/blender_icons16/icon16_snap_surface.dat
new file mode 100644
index 00000000000..305f044805a
Binary files /dev/null and b/release/datafiles/blender_icons16/icon16_snap_surface.dat differ
diff --git a/release/datafiles/blender_icons32/icon32_snap_surface.dat b/release/datafiles/blender_icons32/icon32_snap_surface.dat
new file mode 100644
index 00000000000..2e7e06a3a75
Binary files /dev/null and b/release/datafiles/blender_icons32/icon32_snap_surface.dat differ
diff --git a/release/datafiles/startup.blend b/release/datafiles/startup.blend
index fe142d7de7e..469986a5576 100644
Binary files a/release/datafiles/startup.blend and b/release/datafiles/startup.blend differ
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 122c7078c04..ea34260bbae 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -6729,10 +6729,11 @@ class VIEW3D_PT_snapping(Panel):
         tool_settings = context.tool_settings
         snap_elements = tool_settings.snap_elements
         obj = context.active_object
-        object_mode = 'OBJECT' if obj is None else obj.mode
+        object_mode = obj.mode if obj else 'OBJECT'
 
         layout = self.layout
         col = layout.column()
+        col.active = tool_settings.use_snap
         col.label(text="Snap To")
         col.prop(tool_settings, "snap_elements", expand=True)
 
@@ -6741,23 +6742,36 @@ class VIEW3D_PT_snapping(Panel):
             col.prop(tool_settings, "use_snap_grid_absolute")
 
       

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list