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:
authorCampbell Barton <ideasman42@gmail.com>2019-01-15 03:03:33 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-01-15 03:06:36 +0300
commit07541052a03740f358127b890197517433eb6d8d (patch)
tree98a9454e3e0ced32d31eedc7043a118a7274eea9 /source/blender/makesrna
parent62ac0996e76cf0ea1ceec3316b38dca98d0c4f6e (diff)
Fix T60512: Weight paint brushes show weight when unused
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_brush.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 5330bbb02ec..4aadcb04ad5 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -322,6 +322,12 @@ static bool rna_BrushCapabilitiesVertexPaint_has_color_get(PointerRNA *ptr)
return ELEM(br->vertexpaint_tool, VPAINT_TOOL_DRAW);
}
+static bool rna_BrushCapabilitiesWeightPaint_has_weight_get(PointerRNA *ptr)
+{
+ Brush *br = (Brush *)ptr->data;
+ return ELEM(br->weightpaint_tool, WPAINT_TOOL_DRAW);
+}
+
static bool rna_BrushCapabilities_has_spacing_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
@@ -394,6 +400,11 @@ static PointerRNA rna_Vertexpaint_tool_capabilities_get(PointerRNA *ptr)
return rna_pointer_inherit_refine(ptr, &RNA_BrushCapabilitiesVertexPaint, ptr->id.data);
}
+static PointerRNA rna_Weightpaint_tool_capabilities_get(PointerRNA *ptr)
+{
+ return rna_pointer_inherit_refine(ptr, &RNA_BrushCapabilitiesWeightPaint, ptr->id.data);
+}
+
static PointerRNA rna_Brush_capabilities_get(PointerRNA *ptr)
{
return rna_pointer_inherit_refine(ptr, &RNA_BrushCapabilities, ptr->id.data);
@@ -952,6 +963,30 @@ static void rna_def_vertex_paint_capabilities(BlenderRNA *brna)
#undef VPAINT_TOOL_CAPABILITY
}
+static void rna_def_weight_paint_capabilities(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BrushCapabilitiesWeightPaint", NULL);
+ RNA_def_struct_sdna(srna, "Brush");
+ RNA_def_struct_nested(brna, srna, "Brush");
+ RNA_def_struct_ui_text(srna, "Weight Paint Capabilities",
+ "Read-only indications of supported operations");
+
+#define WPAINT_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_BrushCapabilitiesWeightPaint_" \
+ #prop_name_ "_get", NULL); \
+ RNA_def_property_ui_text(prop, ui_name_, NULL)
+
+ WPAINT_TOOL_CAPABILITY(has_weight, "Has Weight");
+
+#undef WPAINT_TOOL_CAPABILITY
+}
+
static void rna_def_gpencil_options(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1981,6 +2016,12 @@ static void rna_def_brush(BlenderRNA *brna)
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, "weight_paint_capabilities", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "BrushCapabilitiesWeightPaint");
+ RNA_def_property_pointer_funcs(prop, "rna_Weightpaint_tool_capabilities_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Weight Paint Capabilities", "");
+
prop = RNA_def_property(srna, "gpencil_settings", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "BrushGpencilSettings");
RNA_def_property_pointer_sdna(prop, NULL, "gpencil_settings");
@@ -2056,6 +2097,7 @@ void RNA_def_brush(BlenderRNA *brna)
rna_def_sculpt_capabilities(brna);
rna_def_image_paint_capabilities(brna);
rna_def_vertex_paint_capabilities(brna);
+ rna_def_weight_paint_capabilities(brna);
rna_def_gpencil_options(brna);
rna_def_brush_texture_slot(brna);
rna_def_operator_stroke_element(brna);