Curves: operator to snap curves to surface

This operator snaps the first point of every curve to the corresponding
surface object. The shape of individual curves or their orientation is
not changed.

There are two different attachment modes:
* `Nearest`: Move each curve so that the first point is on the closest
  point on the surface. This should be used when the topology of the
  surface mesh changed, but the shape generally stayed the same.
* `Deform`: Use the existing attachment information that is stored
  for curves to move curves to their new location when the surface
  mesh was deformed. This generally does not work when the
  topology changed.

The purpose of the operator is to help setup the "ground truth"
for how curves are attached to the surface. When the ground
truth surface changed, the original curves have to be updated
as well. Deforming curves based on an animated surface will be
done with geometry nodes independent of the operator.

In the UI, the operator is currently exposed in curves sculpt mode
in the `Curves > Snap Curves to Surface` menu.

Differential Revision: https://developer.blender.org/D14515
This commit is contained in:
2022-04-07 12:49:13 +02:00
parent e5c7f37223
commit 50869b408b
3 changed files with 225 additions and 0 deletions

View File

@@ -935,6 +935,8 @@ class VIEW3D_MT_editor_menus(Menu):
if mode_string == 'SCULPT':
layout.menu("VIEW3D_MT_mask")
layout.menu("VIEW3D_MT_face_sets")
if mode_string == 'SCULPT_CURVES':
layout.menu("VIEW3D_MT_sculpt_curves")
else:
layout.menu("VIEW3D_MT_object")
@@ -3124,6 +3126,15 @@ class VIEW3D_MT_sculpt(Menu):
layout.operator("object.transfer_mode", text="Transfer Sculpt Mode")
class VIEW3D_MT_sculpt_curves(Menu):
bl_label = "Curves"
def draw(self, _context):
layout = self.layout
layout.operator("curves.snap_curves_to_surface")
class VIEW3D_MT_mask(Menu):
bl_label = "Mask"
@@ -7759,6 +7770,7 @@ classes = (
VIEW3D_MT_sculpt_automasking_pie,
VIEW3D_MT_wpaint_vgroup_lock_pie,
VIEW3D_MT_sculpt_face_sets_edit_pie,
VIEW3D_MT_sculpt_curves,
VIEW3D_PT_active_tool,
VIEW3D_PT_active_tool_duplicate,
VIEW3D_PT_view3d_properties,