Attempt to fix T39412
authorAntony Riakiotakis <kalast@gmail.com>
Wed, 26 Mar 2014 22:04:40 +0000 (00:04 +0200)
committerAntony Riakiotakis <kalast@gmail.com>
Wed, 26 Mar 2014 22:04:59 +0000 (00:04 +0200)
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.

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

index f180e30f9dc1282bb30288d27db7d873f85fa9f1..3f8432204b52a18f481dfd0ae5465913480b6ff2 100644 (file)
@@ -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()
index 31dd4960f9039c3637f8d3a3798e9c9b0da7972f..eec666426b6523d88bf0414ece8ba722d184d64b 100644 (file)
@@ -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");
index 34c44565456aa7f85f065074e33cd8d043e98111..67cea35b94517a3f4035f93143eb47b98a1f87b1 100644 (file)
@@ -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");