Surface Deform modifier: add vertex group and strength control.

This commit aims to add functionality to the surface deform modifier that
gives more control and allows it to work better with the modifier stack.
* Maintains compatibility with older files. The default settings keep it
  so that the whole object is bound and vertex coordinates get overwritten
  as the modifier currently does.
* Turns the deformations from an absolute vertex coordinate overwrite into
  an additive offset from the vertex location before the modifier to the
  resulting bound deformation. This gives the ability to control the
  strength of the deformation and mix the deformation of the modifier
  with the modifier stack that comes before it.
* Also adds in a vertex group with the invert option. This is applied after
  the bind deformation is added. So the whole object is still bound to target,
  and the vertex group filters afterwards what parts get affected.
  I experimented with a version to only binds the geometry weighted to the
  vertex group, but that would break compatibility with old files.
  I may bring it in later as a separate option/mode for the surface deform.

With several fixes from @mont29.

Reviewed By: mont29

Differencial Revision: https://developer.blender.org/D6894
This commit is contained in:
Cody Winchester
2020-03-27 12:20:31 +01:00
committed by Bastien Montagne
parent 1bb7d42cf6
commit 6e505a45a1
4 changed files with 143 additions and 16 deletions

View File

@@ -1141,13 +1141,24 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
layout.label(text="Settings are inside the Physics tab")
def SURFACE_DEFORM(self, layout, _ob, md):
col = layout.column()
split = layout.split()
col = split.column()
col.active = not md.is_bound
col.prop(md, "target")
col.prop(md, "falloff")
col.label(text="Target:")
col.prop(md, "target", text="")
layout.separator()
col = split.column()
col.label(text="Vertex Group:")
row = col.row(align=True)
row.prop_search(md, "vertex_group", _ob, "vertex_groups", text="")
row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT')
split = layout.split()
col = split.column()
col.prop(md, "falloff")
col = split.column()
col.prop(md, "strength")
col = layout.column()