Vertex/Weight Paint: Use PBVH for painting

2016 GSOC project by @nathanvollmer, see D2150

- Mirrored painting and radial symmetry, like in sculpt mode.
- Volume based splash prevention,
  which avoids painting vertices far away from the 3D brush location.
- Normal based splash prevention,
  which avoids painting vertices with normals opposite the normal
  at the 3D brush location.
- Blur mode now uses a nearest neighbor average.
- Average mode, which averages the color/weight
  of the vertices within the brush
- Smudge mode, which pulls the colors/weights
  along the direction of the brush
- RGB^2 color blending, which gives a more accurate
  blend between two colors
- multithreading support. (PBVH leaves are painted in parallel.)
- Foreground/background color picker in vertex paint
This commit is contained in:
Campbell Barton
2017-09-28 01:38:17 +10:00
parent 2de5e14f53
commit 4f616c93f7
25 changed files with 2037 additions and 830 deletions

View File

@@ -51,6 +51,19 @@ def draw_keyframing_tools(context, layout):
row.operator("anim.keyframe_delete_v3d", text="Remove")
# Used by vertex & weight paint
def draw_vpaint_symmetry(layout, vpaint):
col = layout.column(align=True)
col.label(text="Mirror:")
row = col.row(align=True)
row.prop(vpaint, "use_symmetry_x", text="X", toggle=True)
row.prop(vpaint, "use_symmetry_y", text="Y", toggle=True)
row.prop(vpaint, "use_symmetry_z", text="Z", toggle=True)
col = layout.column()
col.prop(vpaint, "radial_symmetry", text="Radial")
# ********** default tools for object-mode ****************
@@ -1134,7 +1147,11 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
self.prop_unified_color_picker(col, context, brush, "color", value_slider=True)
if settings.palette:
col.template_palette(settings, "palette", color=True)
self.prop_unified_color(col, context, brush, "color", text="")
row = col.row(align=True)
self.prop_unified_color(row, context, brush, "color", text="")
self.prop_unified_color(row, context, brush, "secondary_color", text="")
row.separator()
row.operator("paint.brush_colors_flip", icon='FILE_REFRESH', text="")
col.separator()
row = col.row(align=True)
@@ -1717,6 +1734,19 @@ class VIEW3D_PT_tools_weightpaint(View3DPanel, Panel):
props.data_type = 'VGROUP_WEIGHTS'
class VIEW3D_PT_tools_weightpaint_symmetry(Panel, View3DPaintPanel):
bl_category = "Tools"
bl_context = "weightpaint"
bl_options = {'DEFAULT_CLOSED'}
bl_label = "Symmetry"
def draw(self, context):
layout = self.layout
toolsettings = context.tool_settings
wpaint = toolsettings.weight_paint
draw_vpaint_symmetry(layout, wpaint)
class VIEW3D_PT_tools_weightpaint_options(Panel, View3DPaintPanel):
bl_category = "Options"
bl_context = "weightpaint"
@@ -1779,6 +1809,20 @@ class VIEW3D_PT_tools_vertexpaint(Panel, View3DPaintPanel):
#~ col.label(text="Multiply:")
#~ col.prop(vpaint, "mul", text="")
class VIEW3D_PT_tools_vertexpaint_symmetry(Panel, View3DPaintPanel):
bl_category = "Tools"
bl_context = "vertexpaint"
bl_options = {'DEFAULT_CLOSED'}
bl_label = "Symmetry"
def draw(self, context):
layout = self.layout
toolsettings = context.tool_settings
vpaint = toolsettings.vertex_paint
draw_vpaint_symmetry(layout, vpaint)
# ********** default tools for texture-paint ****************
@@ -2058,8 +2102,10 @@ classes = (
VIEW3D_PT_sculpt_symmetry,
VIEW3D_PT_tools_brush_appearance,
VIEW3D_PT_tools_weightpaint,
VIEW3D_PT_tools_weightpaint_symmetry,
VIEW3D_PT_tools_weightpaint_options,
VIEW3D_PT_tools_vertexpaint,
VIEW3D_PT_tools_vertexpaint_symmetry,
VIEW3D_PT_tools_imagepaint_external,
VIEW3D_PT_tools_imagepaint_symmetry,
VIEW3D_PT_tools_projectpaint,