col = layout.column()
- if brush.image_tool in {'DRAW', 'FILL'}:
+ if capabilities.has_color:
if brush.blend not in {'ERASE_ALPHA', 'ADD_ALPHA'}:
if not brush.use_gradient:
panel.prop_unified_color_picker(col, context, brush, "color", value_slider=True)
def brush_basic_vpaint_settings(layout, context, brush, *, compact=False):
+ capabilities = brush.vertex_paint_capabilities
+
row = layout.row(align=True)
UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size")
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", text="Strength")
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength")
- layout.separator()
- layout.prop(brush, "blend", text="" if compact else "Blend")
+
+ if capabilities.has_color:
+ layout.separator()
+ layout.prop(brush, "blend", text="" if compact else "Blend")
def brush_basic_texpaint_settings(layout, context, brush, *, compact=False):
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", text="Strength")
UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength")
- if brush.image_tool in {'DRAW', 'FILL'}:
+ if capabilities.has_color:
layout.separator()
layout.prop(brush, "blend", text="" if compact else "Blend")
UnifiedPaintPanel,
brush_basic_texpaint_settings,
)
- UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="")
+ capabilities = brush.image_paint_capabilities
+ if capabilities.has_color:
+ UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="")
brush_basic_texpaint_settings(layout, context, brush, compact=True)
@staticmethod
UnifiedPaintPanel,
brush_basic_vpaint_settings,
)
- UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="")
+ capabilities = brush.vertex_paint_capabilities
+ if capabilities.has_color:
+ UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="")
brush_basic_vpaint_settings(layout, context, brush, compact=True)
@staticmethod
UnifiedPaintPanel,
brush_basic_texpaint_settings,
)
- UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="")
+ capabilities = brush.image_paint_capabilities
+ if capabilities.has_color:
+ UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="")
brush_basic_texpaint_settings(layout, context, brush, compact=True)
br->imagepaint_tool != PAINT_TOOL_FILL;
}
+static bool rna_ImapaintToolCapabilities_has_color_get(PointerRNA *ptr)
+{
+ Brush *br = (Brush *)ptr->data;
+ return ELEM(br->imagepaint_tool, PAINT_TOOL_DRAW, PAINT_TOOL_FILL);
+}
+
+static bool rna_VertexpaintToolCapabilities_has_color_get(PointerRNA *ptr)
+{
+ Brush *br = (Brush *)ptr->data;
+ return ELEM(br->vertexpaint_tool, VPAINT_TOOL_DRAW);
+}
+
static bool rna_BrushCapabilities_has_spacing_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return rna_pointer_inherit_refine(ptr, &RNA_ImapaintToolCapabilities, ptr->id.data);
}
+static PointerRNA rna_Vertexpaint_tool_capabilities_get(PointerRNA *ptr)
+{
+ return rna_pointer_inherit_refine(ptr, &RNA_VertexpaintToolCapabilities, ptr->id.data);
+}
+
static PointerRNA rna_Brush_capabilities_get(PointerRNA *ptr)
{
return rna_pointer_inherit_refine(ptr, &RNA_BrushCapabilities, ptr->id.data);
RNA_def_struct_sdna(srna, "Brush");
RNA_def_struct_nested(brna, srna, "Brush");
RNA_def_struct_ui_text(srna, "Brush Capabilities",
- "Read-only indications of which brush operations "
- "are supported by the current brush");
+ "Read-only indications of supported operations");
#define BRUSH_CAPABILITY(prop_name_, ui_name_) \
prop = RNA_def_property(srna, #prop_name_, \
RNA_def_struct_sdna(srna, "Brush");
RNA_def_struct_nested(brna, srna, "Brush");
RNA_def_struct_ui_text(srna, "Image Paint Capabilities",
- "Read-only indications of which brush operations "
- "are supported by the current image paint brush");
+ "Read-only indications of supported operations");
#define IMAPAINT_TOOL_CAPABILITY(prop_name_, ui_name_) \
prop = RNA_def_property(srna, #prop_name_, \
IMAPAINT_TOOL_CAPABILITY(has_accumulate, "Has Accumulate");
IMAPAINT_TOOL_CAPABILITY(has_space_attenuation, "Has Space Attenuation");
IMAPAINT_TOOL_CAPABILITY(has_radius, "Has Radius");
+ IMAPAINT_TOOL_CAPABILITY(has_color, "Has Color");
#undef IMAPAINT_TOOL_CAPABILITY
}
+static void rna_def_vertex_paint_capabilities(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "VertexpaintToolCapabilities", NULL);
+ RNA_def_struct_sdna(srna, "Brush");
+ RNA_def_struct_nested(brna, srna, "Brush");
+ RNA_def_struct_ui_text(srna, "Vertex Paint Capabilities",
+ "Read-only indications of supported operations");
+
+#define VPAINT_TOOL_CAPABILITY(prop_name_, ui_name_) \
+ prop = RNA_def_property(srna, #prop_name_, \
+ PROP_BOOLEAN, PROP_NONE); \
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); \
+ RNA_def_property_boolean_funcs(prop, "rna_VertexpaintToolCapabilities_" \
+ #prop_name_ "_get", NULL); \
+ RNA_def_property_ui_text(prop, ui_name_, NULL)
+
+ VPAINT_TOOL_CAPABILITY(has_color, "Has Color");
+
+#undef VPAINT_TOOL_CAPABILITY
+}
+
static void rna_def_gpencil_options(BlenderRNA *brna)
{
StructRNA *srna;
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_struct_type(prop, "SculptToolCapabilities");
RNA_def_property_pointer_funcs(prop, "rna_Sculpt_tool_capabilities_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Sculpt Capabilities", "Brush's capabilities in sculpt mode");
+ RNA_def_property_ui_text(prop, "Sculpt Capabilities", "");
prop = RNA_def_property(srna, "image_paint_capabilities", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_struct_type(prop, "ImapaintToolCapabilities");
RNA_def_property_pointer_funcs(prop, "rna_Imapaint_tool_capabilities_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Image Painting Capabilities", "Brush's capabilities in image paint mode");
+ RNA_def_property_ui_text(prop, "Image Paint Capabilities", "");
+
+ prop = RNA_def_property(srna, "vertex_paint_capabilities", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "VertexpaintToolCapabilities");
+ RNA_def_property_pointer_funcs(prop, "rna_Vertexpaint_tool_capabilities_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Vertex Paint Capabilities", "");
prop = RNA_def_property(srna, "gpencil_settings", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "BrushGpencilSettings");
rna_def_brush_capabilities(brna);
rna_def_sculpt_capabilities(brna);
rna_def_image_paint_capabilities(brna);
+ rna_def_vertex_paint_capabilities(brna);
rna_def_gpencil_options(brna);
rna_def_brush_texture_slot(brna);
rna_def_operator_stroke_element(brna);