Tweak Brush Gradient UI
Gradient and Color are mutually exclusive, so we now communicate this in the UI much more clearly Differential Revision: https://developer.blender.org/D5395 Reviewers: brechrt
This commit is contained in:
@@ -1077,9 +1077,12 @@ class IMAGE_PT_paint_color(Panel, ImagePaintPanel):
|
|||||||
settings = context.tool_settings.image_paint
|
settings = context.tool_settings.image_paint
|
||||||
brush = settings.brush
|
brush = settings.brush
|
||||||
|
|
||||||
layout.active = not brush.use_gradient
|
layout.prop(brush, "color_type", expand=True)
|
||||||
|
|
||||||
brush_texpaint_common_color(self, context, layout, brush, settings, True)
|
if brush.color_type == 'COLOR':
|
||||||
|
brush_texpaint_common_color(self, context, layout, brush, settings, True)
|
||||||
|
elif brush.color_type == 'GRADIENT':
|
||||||
|
brush_texpaint_common_gradient(self, context, layout, brush, settings, True)
|
||||||
|
|
||||||
|
|
||||||
class IMAGE_PT_paint_swatches(Panel, ImagePaintPanel):
|
class IMAGE_PT_paint_swatches(Panel, ImagePaintPanel):
|
||||||
@@ -1106,38 +1109,6 @@ class IMAGE_PT_paint_swatches(Panel, ImagePaintPanel):
|
|||||||
layout.template_palette(settings, "palette", color=True)
|
layout.template_palette(settings, "palette", color=True)
|
||||||
|
|
||||||
|
|
||||||
class IMAGE_PT_paint_gradient(Panel, ImagePaintPanel):
|
|
||||||
bl_category = "Tool"
|
|
||||||
bl_context = ".paint_common_2d"
|
|
||||||
bl_parent_id = "IMAGE_PT_paint"
|
|
||||||
bl_label = "Gradient"
|
|
||||||
bl_options = {'DEFAULT_CLOSED'}
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def poll(cls, context):
|
|
||||||
settings = context.tool_settings.image_paint
|
|
||||||
brush = settings.brush
|
|
||||||
capabilities = brush.image_paint_capabilities
|
|
||||||
|
|
||||||
return capabilities.has_color
|
|
||||||
|
|
||||||
def draw_header(self, context):
|
|
||||||
settings = context.tool_settings.image_paint
|
|
||||||
brush = settings.brush
|
|
||||||
self.layout.prop(brush, "use_gradient", text="")
|
|
||||||
|
|
||||||
def draw(self, context):
|
|
||||||
layout = self.layout
|
|
||||||
layout.use_property_split = False
|
|
||||||
layout.use_property_decorate = False # No animation.
|
|
||||||
settings = context.tool_settings.image_paint
|
|
||||||
brush = settings.brush
|
|
||||||
|
|
||||||
layout.active = brush.use_gradient
|
|
||||||
|
|
||||||
brush_texpaint_common_gradient(self, context, layout, brush, settings, True)
|
|
||||||
|
|
||||||
|
|
||||||
class IMAGE_PT_paint_clone(Panel, ImagePaintPanel):
|
class IMAGE_PT_paint_clone(Panel, ImagePaintPanel):
|
||||||
bl_category = "Tool"
|
bl_category = "Tool"
|
||||||
bl_context = ".paint_common_2d"
|
bl_context = ".paint_common_2d"
|
||||||
@@ -1740,7 +1711,6 @@ classes = (
|
|||||||
IMAGE_PT_paint,
|
IMAGE_PT_paint,
|
||||||
IMAGE_PT_paint_color,
|
IMAGE_PT_paint_color,
|
||||||
IMAGE_PT_paint_swatches,
|
IMAGE_PT_paint_swatches,
|
||||||
IMAGE_PT_paint_gradient,
|
|
||||||
IMAGE_PT_paint_clone,
|
IMAGE_PT_paint_clone,
|
||||||
IMAGE_PT_paint_options,
|
IMAGE_PT_paint_options,
|
||||||
IMAGE_PT_tools_brush_texture,
|
IMAGE_PT_tools_brush_texture,
|
||||||
|
|||||||
@@ -429,9 +429,16 @@ class VIEW3D_PT_tools_brush_color(Panel, View3DPaintPanel):
|
|||||||
settings = self.paint_settings(context)
|
settings = self.paint_settings(context)
|
||||||
brush = settings.brush
|
brush = settings.brush
|
||||||
|
|
||||||
layout.active = not brush.use_gradient
|
if context.vertex_paint_object:
|
||||||
|
brush_texpaint_common_color(self, context, layout, brush, settings, True)
|
||||||
|
|
||||||
|
else:
|
||||||
|
layout.prop(brush, "color_type", expand=True)
|
||||||
|
|
||||||
brush_texpaint_common_color(self, context, layout, brush, settings, True)
|
if brush.color_type == 'COLOR':
|
||||||
|
brush_texpaint_common_color(self, context, layout, brush, settings, True)
|
||||||
|
elif brush.color_type == 'GRADIENT':
|
||||||
|
brush_texpaint_common_gradient(self, context, layout, brush, settings, True)
|
||||||
|
|
||||||
|
|
||||||
class VIEW3D_PT_tools_brush_swatches(Panel, View3DPaintPanel):
|
class VIEW3D_PT_tools_brush_swatches(Panel, View3DPaintPanel):
|
||||||
@@ -461,37 +468,6 @@ class VIEW3D_PT_tools_brush_swatches(Panel, View3DPaintPanel):
|
|||||||
layout.template_palette(settings, "palette", color=True)
|
layout.template_palette(settings, "palette", color=True)
|
||||||
|
|
||||||
|
|
||||||
class VIEW3D_PT_tools_brush_gradient(Panel, View3DPaintPanel):
|
|
||||||
bl_context = ".paint_common" # dot on purpose (access from topbar)
|
|
||||||
bl_parent_id = "VIEW3D_PT_tools_brush"
|
|
||||||
bl_label = "Gradient"
|
|
||||||
bl_options = {'DEFAULT_CLOSED'}
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def poll(cls, context):
|
|
||||||
settings = cls.paint_settings(context)
|
|
||||||
brush = settings.brush
|
|
||||||
capabilities = brush.image_paint_capabilities
|
|
||||||
|
|
||||||
return capabilities.has_color and context.image_paint_object
|
|
||||||
|
|
||||||
def draw_header(self, context):
|
|
||||||
settings = self.paint_settings(context)
|
|
||||||
brush = settings.brush
|
|
||||||
self.layout.prop(brush, "use_gradient", text="")
|
|
||||||
|
|
||||||
def draw(self, context):
|
|
||||||
layout = self.layout
|
|
||||||
layout.use_property_split = False
|
|
||||||
layout.use_property_decorate = False # No animation.
|
|
||||||
settings = self.paint_settings(context)
|
|
||||||
brush = settings.brush
|
|
||||||
|
|
||||||
layout.active = brush.use_gradient
|
|
||||||
|
|
||||||
brush_texpaint_common_gradient(self, context, layout, brush, settings, True)
|
|
||||||
|
|
||||||
|
|
||||||
class VIEW3D_PT_tools_brush_clone(Panel, View3DPaintPanel):
|
class VIEW3D_PT_tools_brush_clone(Panel, View3DPaintPanel):
|
||||||
bl_context = ".paint_common" # dot on purpose (access from topbar)
|
bl_context = ".paint_common" # dot on purpose (access from topbar)
|
||||||
bl_parent_id = "VIEW3D_PT_tools_brush"
|
bl_parent_id = "VIEW3D_PT_tools_brush"
|
||||||
@@ -2106,7 +2082,6 @@ classes = (
|
|||||||
VIEW3D_PT_tools_brush,
|
VIEW3D_PT_tools_brush,
|
||||||
VIEW3D_PT_tools_brush_color,
|
VIEW3D_PT_tools_brush_color,
|
||||||
VIEW3D_PT_tools_brush_swatches,
|
VIEW3D_PT_tools_brush_swatches,
|
||||||
VIEW3D_PT_tools_brush_gradient,
|
|
||||||
VIEW3D_PT_tools_brush_clone,
|
VIEW3D_PT_tools_brush_clone,
|
||||||
VIEW3D_PT_tools_brush_options,
|
VIEW3D_PT_tools_brush_options,
|
||||||
TEXTURE_UL_texpaintslots,
|
TEXTURE_UL_texpaintslots,
|
||||||
|
|||||||
@@ -1565,6 +1565,12 @@ static void rna_def_brush(BlenderRNA *brna)
|
|||||||
{0, NULL, 0, NULL, NULL},
|
{0, NULL, 0, NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const EnumPropertyItem color_gradient_items[] = {
|
||||||
|
{0, "COLOR", 0, "Color", "Paint with a single color"},
|
||||||
|
{BRUSH_USE_GRADIENT, "GRADIENT", 0, "Gradient", "Paint with a gradient"},
|
||||||
|
{0, NULL, 0, NULL, NULL},
|
||||||
|
};
|
||||||
|
|
||||||
static const EnumPropertyItem brush_curve_preset_items[] = {
|
static const EnumPropertyItem brush_curve_preset_items[] = {
|
||||||
{BRUSH_CURVE_CUSTOM, "CUSTOM", ICON_RNDCURVE, "Custom", ""},
|
{BRUSH_CURVE_CUSTOM, "CUSTOM", ICON_RNDCURVE, "Custom", ""},
|
||||||
{BRUSH_CURVE_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", ""},
|
{BRUSH_CURVE_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", ""},
|
||||||
@@ -1934,12 +1940,6 @@ static void rna_def_brush(BlenderRNA *brna)
|
|||||||
RNA_def_property_ui_text(prop, "Size Pressure", "Enable tablet pressure sensitivity for size");
|
RNA_def_property_ui_text(prop, "Size Pressure", "Enable tablet pressure sensitivity for size");
|
||||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "use_gradient", PROP_BOOLEAN, PROP_NONE);
|
|
||||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_USE_GRADIENT);
|
|
||||||
RNA_def_property_boolean_funcs(prop, NULL, "rna_Brush_use_gradient_set");
|
|
||||||
RNA_def_property_ui_text(prop, "Use Gradient", "Use Gradient by utilizing a sampling method");
|
|
||||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "use_pressure_jitter", PROP_BOOLEAN, PROP_NONE);
|
prop = RNA_def_property(srna, "use_pressure_jitter", PROP_BOOLEAN, PROP_NONE);
|
||||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_JITTER_PRESSURE);
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_JITTER_PRESSURE);
|
||||||
RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
|
RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
|
||||||
@@ -2055,6 +2055,13 @@ static void rna_def_brush(BlenderRNA *brna)
|
|||||||
prop, "Radius Unit", "Measure brush size relative to the view or the scene");
|
prop, "Radius Unit", "Measure brush size relative to the view or the scene");
|
||||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||||
|
|
||||||
|
prop = RNA_def_property(srna, "color_type", PROP_ENUM, PROP_NONE); /* as an enum */
|
||||||
|
RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
|
||||||
|
RNA_def_property_enum_items(prop, color_gradient_items);
|
||||||
|
RNA_def_property_enum_funcs(prop, NULL, "rna_Brush_use_gradient_set", NULL);
|
||||||
|
RNA_def_property_ui_text(prop, "Color Type", "Use single color or gradient when painting");
|
||||||
|
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "use_edge_to_edge", PROP_BOOLEAN, PROP_NONE);
|
prop = RNA_def_property(srna, "use_edge_to_edge", PROP_BOOLEAN, PROP_NONE);
|
||||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_EDGE_TO_EDGE);
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_EDGE_TO_EDGE);
|
||||||
RNA_def_property_ui_text(prop, "Edge-to-edge", "Drag anchor brush from edge-to-edge");
|
RNA_def_property_ui_text(prop, "Edge-to-edge", "Drag anchor brush from edge-to-edge");
|
||||||
|
|||||||
Reference in New Issue
Block a user