Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release/scripts/startup/bl_ui/properties_paint_common.py12
-rw-r--r--release/scripts/startup/bl_ui/space_topbar.py12
-rw-r--r--source/blender/makesrna/RNA_access.h1
-rw-r--r--source/blender/makesrna/intern/rna_brush.c59
4 files changed, 71 insertions, 13 deletions
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index 51db0a99b7d..9f12f2258d3 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -113,7 +113,7 @@ def brush_texpaint_common(panel, context, layout, brush, settings, projpaint=Fal
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)
@@ -318,6 +318,8 @@ def brush_basic_wpaint_settings(layout, context, brush, *, compact=False):
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")
@@ -326,8 +328,10 @@ def brush_basic_vpaint_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")
- 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):
@@ -346,7 +350,7 @@ 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")
diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 94965e5d03d..06a6e3dc5ac 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -257,7 +257,9 @@ class _draw_left_context_mode:
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
@@ -276,7 +278,9 @@ class _draw_left_context_mode:
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
@@ -453,7 +457,9 @@ class _draw_left_context_mode:
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)
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 20231e2d036..0deff2ab6d2 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -724,6 +724,7 @@ extern StructRNA RNA_VertexPaint;
extern StructRNA RNA_VertexWeightEditModifier;
extern StructRNA RNA_VertexWeightMixModifier;
extern StructRNA RNA_VertexWeightProximityModifier;
+extern StructRNA RNA_VertexpaintToolCapabilities;
extern StructRNA RNA_View3DOverlay;
extern StructRNA RNA_View3DShading;
extern StructRNA RNA_ViewLayer;
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 03081ff606d..79350b57708 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -310,6 +310,18 @@ static bool rna_ImapaintToolCapabilities_has_space_attenuation_get(PointerRNA *p
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;
@@ -377,6 +389,11 @@ static PointerRNA rna_Imapaint_tool_capabilities_get(PointerRNA *ptr)
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);
@@ -865,8 +882,7 @@ static void rna_def_brush_capabilities(BlenderRNA *brna)
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_, \
@@ -894,8 +910,7 @@ static void rna_def_image_paint_capabilities(BlenderRNA *brna)
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_, \
@@ -908,10 +923,35 @@ static void rna_def_image_paint_capabilities(BlenderRNA *brna)
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;
@@ -1927,13 +1967,19 @@ static void rna_def_brush(BlenderRNA *brna)
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");
@@ -2009,6 +2055,7 @@ void RNA_def_brush(BlenderRNA *brna)
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);