From 9f4dca8963373889cd4efb096d3ae44a19312cd9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 2 Oct 2019 03:26:51 +1000 Subject: Fix mismatch in brush default versioning Assign a variable to avoid repetition and having this happen again. --- .../blenloader/intern/versioning_defaults.c | 29 ++++++++++++++-------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'source') diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index 7bae0ede55b..2e2b4bcd1dd 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -419,7 +419,8 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template) { /* Enable for UV sculpt (other brush types will be created as needed), * without this the grab brush will be active but not selectable from the list. */ - Brush *brush = BLI_findstring(&bmain->brushes, "Grab", offsetof(ID, name) + 2); + const char *brush_name = "Grab"; + Brush *brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2); if (brush) { brush->ob_mode |= OB_MODE_EDIT; } @@ -431,35 +432,43 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template) { /* Change the spacing of the Smear brush to 3.0% */ - Brush *brush = BLI_findstring(&bmain->brushes, "Smear", offsetof(ID, name) + 2); + const char *brush_name; + Brush *brush; + + brush_name = "Smear"; + brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2); if (brush) { brush->spacing = 3.0; } - brush = BLI_findstring(&bmain->brushes, "Draw Sharp", offsetof(ID, name) + 2); + brush_name = "Draw Sharp"; + brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2); if (!brush) { - brush = BKE_brush_add(bmain, "Draw Sharp", OB_MODE_SCULPT); + brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT); id_us_min(&brush->id); brush->sculpt_tool = SCULPT_TOOL_DRAW_SHARP; } - brush = BLI_findstring(&bmain->brushes, "Elastic Deform", offsetof(ID, name) + 2); + brush_name = "Elastic Deform"; + brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2); if (!brush) { - brush = BKE_brush_add(bmain, "Elastic Defrom", OB_MODE_SCULPT); + brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT); id_us_min(&brush->id); brush->sculpt_tool = SCULPT_TOOL_ELASTIC_DEFORM; } - brush = BLI_findstring(&bmain->brushes, "Pose", offsetof(ID, name) + 2); + brush_name = "Pose"; + brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2); if (!brush) { - brush = BKE_brush_add(bmain, "Pose", OB_MODE_SCULPT); + brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT); id_us_min(&brush->id); brush->sculpt_tool = SCULPT_TOOL_POSE; } - brush = BLI_findstring(&bmain->brushes, "Simplify", offsetof(ID, name) + 2); + brush_name = "Simplify"; + brush = BLI_findstring(&bmain->brushes, brush_name, offsetof(ID, name) + 2); if (!brush) { - brush = BKE_brush_add(bmain, "Simplify", OB_MODE_SCULPT); + brush = BKE_brush_add(bmain, brush_name, OB_MODE_SCULPT); id_us_min(&brush->id); brush->sculpt_tool = SCULPT_TOOL_SIMPLIFY; } -- cgit v1.2.3