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.
This commit is contained in:
Antonis Ryakiotakis 2014-03-27 00:04:40 +02:00
parent 10e7544586
commit 0adc1ba209
Notes: blender-bot 2023-02-14 10:54:33 +01:00
Referenced by issue #39412, Stroke Method Shortcut Creates error message
3 changed files with 32 additions and 27 deletions

View 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()

View 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");

View 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");