diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-04-18 14:16:20 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-04-18 14:16:20 +0300 |
commit | a444c7e0e218ae30cc61789f1c064cac1c5c17b5 (patch) | |
tree | e8fc0a4a2df12f0a3cae1ba7e905c0106f5b6b42 /source/blender/blenloader | |
parent | fda754145ae5a63c95942ded70e9713f06a48818 (diff) | |
parent | d809a0260ea7fe7a0fd7a9a5f235d817b6e3d9a4 (diff) |
Merge branch 'blender-v2.83-release'
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 087fef9ee09..e5c066a0ffc 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -111,6 +111,35 @@ /* Make preferences read-only, use versioning_userdef.c. */ #define U (*((const UserDef *)&U)) +/** + * Rename if the ID doesn't exist. + */ +static ID *rename_id_for_versioning(Main *bmain, + const short id_type, + const char *name_src, + const char *name_dst) +{ + /* We can ignore libraries */ + ListBase *lb = which_libbase(bmain, id_type); + ID *id = NULL; + LISTBASE_FOREACH (ID *, idtest, lb) { + if (idtest->lib == NULL) { + if (STREQ(idtest->name + 2, name_src)) { + id = idtest; + } + if (STREQ(idtest->name + 2, name_dst)) { + return NULL; + } + } + } + if (id != NULL) { + BLI_strncpy(id->name + 2, name_dst, sizeof(id->name) - 2); + /* We know it's unique, this just sorts. */ + BLI_libblock_ensure_unique_name(bmain, id->name); + } + return id; +} + static bScreen *screen_parent_find(const bScreen *screen) { /* Can avoid lookup if screen state isn't maximized/full @@ -1633,7 +1662,27 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports)) if (!MAIN_VERSION_ATLEAST(bmain, 282, 2)) { /* Init all Vertex/Sculpt and Weight Paint brushes. */ - Brush *brush = BLI_findstring(&bmain->brushes, "Pencil", offsetof(ID, name) + 2); + Brush *brush; + /* Pen Soft brush. */ + brush = (Brush *)rename_id_for_versioning(bmain, ID_BR, "Draw Soft", "Pencil Soft"); + if (brush) { + brush->gpencil_settings->icon_id = GP_BRUSH_ICON_PEN; + } + rename_id_for_versioning(bmain, ID_BR, "Draw Pencil", "Pencil"); + rename_id_for_versioning(bmain, ID_BR, "Draw Pen", "Pen"); + rename_id_for_versioning(bmain, ID_BR, "Draw Ink", "Ink Pen"); + rename_id_for_versioning(bmain, ID_BR, "Draw Noise", "Ink Pen Rough"); + rename_id_for_versioning(bmain, ID_BR, "Draw Marker", "Marker Bold"); + rename_id_for_versioning(bmain, ID_BR, "Draw Block", "Marker Chisel"); + + /* Remove useless Fill Area.001 brush. */ + brush = BLI_findstring(&bmain->brushes, "Fill Area.001", offsetof(ID, name) + 2); + if (brush) { + BKE_id_delete(bmain, brush); + } + + brush = BLI_findstring(&bmain->brushes, "Pencil", offsetof(ID, name) + 2); + for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) { ToolSettings *ts = scene->toolsettings; |