Sculpt: Enable color palettes for sculpt vertex colors

Enables the color palette subpanel for brushes that have color
capabilities (only the paint brush for now)

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8268
This commit is contained in:
Pablo Dobarro 2020-07-10 19:43:01 +02:00
parent 8dd2386a68
commit eb3f74a0fe
2 changed files with 9 additions and 1 deletions

@ -192,6 +192,10 @@ class ColorPalettePanel(BrushPanel):
elif context.vertex_paint_object:
capabilities = brush.vertex_paint_capabilities
return capabilities.has_color
elif context.sculpt_object:
capabilities = brush.sculpt_capabilities
return capabilities.has_color
return False
def draw(self, context):

@ -246,7 +246,11 @@ static int palette_color_add_exec(bContext *C, wmOperator *UNUSED(op))
color = BKE_palette_color_add(palette);
palette->active_color = BLI_listbase_count(&palette->colors) - 1;
if (ELEM(mode, PAINT_MODE_TEXTURE_3D, PAINT_MODE_TEXTURE_2D, PAINT_MODE_VERTEX)) {
if (ELEM(mode,
PAINT_MODE_TEXTURE_3D,
PAINT_MODE_TEXTURE_2D,
PAINT_MODE_VERTEX,
PAINT_MODE_SCULPT)) {
copy_v3_v3(color->rgb, BKE_brush_color_get(scene, brush));
color->value = 0.0;
}