[Bf-blender-cvs] [0adc1ba] master: Attempt to fix T39412

Antony Riakiotakis noreply at git.blender.org
Wed Mar 26 23:05:12 CET 2014


Commit: 0adc1ba209c24a2200c2e42f75e735da0a5f9c2d
Author: Antony Riakiotakis
Date:   Thu Mar 27 00:04:40 2014 +0200
https://developer.blender.org/rB0adc1ba209c24a2200c2e42f75e735da0a5f9c2d

Attempt to fix T39412

do not use different stroke property names for different paint systems.
This was done due to different stroke sets being supported for each
system, but this lead to trouble if we changed the names (due to
different stroke sets being supported) and users created custom keymaps
with the old property name saved.

The first part of this fix addresses master. A similar commit will be
done to soc-2013-paint.

===================================================================

M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/editors/sculpt_paint/paint_ops.c
M	source/blender/makesrna/intern/rna_brush.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index f180e30..3f84322 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1119,10 +1119,7 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
 
         col.label(text="Stroke Method:")
 
-        if context.sculpt_object:
-            col.prop(brush, "sculpt_stroke_method", text="")
-        else:
-            col.prop(brush, "stroke_method", text="")
+        col.prop(brush, "stroke_method", text="")
 
         if brush.use_anchor:
             col.separator()
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 31dd496..eec6664 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -1193,7 +1193,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
 
 	/* */
 	kmi = WM_keymap_add_item(keymap, "WM_OT_context_menu_enum", AKEY, KM_PRESS, 0, 0);
-	RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush.sculpt_stroke_method");
+	RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush.stroke_method");
 
 	kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", SKEY, KM_PRESS, KM_SHIFT, 0);
 	RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush.use_smooth_stroke");
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 34c4456..67cea35 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -49,6 +49,13 @@ static EnumPropertyItem prop_direction_items[] = {
 	{0, NULL, 0, NULL, NULL}
 };
 
+static EnumPropertyItem brush_stroke_method_items[] = {
+	{0, "DOTS", 0, "Dots", "Apply paint on each mouse move step"},
+	{BRUSH_SPACE, "SPACE", 0, "Space", "Limit brush application to the distance specified by spacing"},
+	{BRUSH_AIRBRUSH, "AIRBRUSH", 0, "Airbrush", "Keep applying paint effect while holding mouse (spray)"},
+	{0, NULL, 0, NULL, NULL}
+};
+
 EnumPropertyItem brush_sculpt_tool_items[] = {
 	{SCULPT_TOOL_BLOB, "BLOB", ICON_BRUSH_BLOB, "Blob", ""},
 	{SCULPT_TOOL_CLAY, "CLAY", ICON_BRUSH_CLAY, "Clay", ""},
@@ -465,6 +472,28 @@ static EnumPropertyItem *rna_Brush_direction_itemf(bContext *UNUSED(C), PointerR
 	}
 }
 
+static EnumPropertyItem *rna_Brush_stroke_itemf(bContext *C, PointerRNA *UNUSED(ptr),
+												   PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
+{
+	static EnumPropertyItem sculpt_stroke_method_items[] = {
+		{0, "DOTS", 0, "Dots", "Apply paint on each mouse move step"},
+		{BRUSH_DRAG_DOT, "DRAG_DOT", 0, "Drag Dot", "Allows a single dot to be carefully positioned"},
+		{BRUSH_SPACE, "SPACE", 0, "Space", "Limit brush application to the distance specified by spacing"},
+		{BRUSH_ANCHORED, "ANCHORED", 0, "Anchored", "Keep the brush anchored to the initial location"},
+		{BRUSH_AIRBRUSH, "AIRBRUSH", 0, "Airbrush", "Keep applying paint effect while holding mouse (spray)"},
+		{0, NULL, 0, NULL, NULL}
+	};
+
+	PaintMode mode = BKE_paintmode_get_active_from_context(C);
+
+	switch(mode) {
+		case PAINT_SCULPT:
+			return sculpt_stroke_method_items;
+
+		default:
+			return brush_stroke_method_items;
+	}
+}
 #else
 
 static void rna_def_brush_texture_slot(BlenderRNA *brna)
@@ -613,22 +642,6 @@ static void rna_def_brush(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}
 	};
 	
-	static EnumPropertyItem sculpt_stroke_method_items[] = {
-		{0, "DOTS", 0, "Dots", "Apply paint on each mouse move step"},
-		{BRUSH_DRAG_DOT, "DRAG_DOT", 0, "Drag Dot", "Allows a single dot to be carefully positioned"},
-		{BRUSH_SPACE, "SPACE", 0, "Space", "Limit brush application to the distance specified by spacing"},
-		{BRUSH_ANCHORED, "ANCHORED", 0, "Anchored", "Keep the brush anchored to the initial location"},
-		{BRUSH_AIRBRUSH, "AIRBRUSH", 0, "Airbrush", "Keep applying paint effect while holding mouse (spray)"},
-		{0, NULL, 0, NULL, NULL}
-	};
-
-	static EnumPropertyItem brush_stroke_method_items[] = {
-		{0, "DOTS", 0, "Dots", "Apply paint on each mouse move step"},
-		{BRUSH_SPACE, "SPACE", 0, "Space", "Limit brush application to the distance specified by spacing"},
-		{BRUSH_AIRBRUSH, "AIRBRUSH", 0, "Airbrush", "Keep applying paint effect while holding mouse (spray)"},
-		{0, NULL, 0, NULL, NULL}
-	};
-
 	static EnumPropertyItem texture_angle_source_items[] = {
 		{0, "USER", 0, "User", "Rotate the brush texture by given angle"},
 		{BRUSH_RAKE, "RAKE", 0, "Rake", "Rotate the brush texture to match the stroke direction"},
@@ -694,12 +707,7 @@ static void rna_def_brush(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "stroke_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, brush_stroke_method_items);
-	RNA_def_property_ui_text(prop, "Stroke Method", "");
-	RNA_def_property_update(prop, 0, "rna_Brush_update");
-
-	prop = RNA_def_property(srna, "sculpt_stroke_method", PROP_ENUM, PROP_NONE);
-	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
-	RNA_def_property_enum_items(prop, sculpt_stroke_method_items);
+	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Brush_stroke_itemf");
 	RNA_def_property_ui_text(prop, "Stroke Method", "");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");




More information about the Bf-blender-cvs mailing list