diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-03-27 02:04:40 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-03-27 02:04:59 +0400 |
commit | 0adc1ba209c24a2200c2e42f75e735da0a5f9c2d (patch) | |
tree | 0135e85428acb0d680463f8f3ad29b69db6aacb1 | |
parent | 10e754458614638cfde0cdd0e7f9858d24a4079d (diff) |
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.
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d_toolbar.py | 5 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_ops.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 52 |
3 files changed, 32 insertions, 27 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index f180e30f9dc..3f8432204b5 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 31dd4960f90..eec666426b6 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 34c44565456..67cea35b945 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"); |