diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-05-15 09:53:43 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-05-15 10:42:01 +0300 |
commit | 6a850f3cc840a574d3b5b5af7b608ae3536f96ec (patch) | |
tree | 7427864cc1fa2201619f34da5564f1d4a4181f10 /source/blender/blenloader/intern/versioning_280.c | |
parent | c361f911f9c459364fceea5de5b9d0ea2f91c9e9 (diff) |
Fix duplicate ID's being created when appending/linking
This removes grease pencil brush creation/dat-block delete on load,
since this causes duplicate data-blocks.
Add assert to prevent this happening in the future
since the error is isn't obvious.
Diffstat (limited to 'source/blender/blenloader/intern/versioning_280.c')
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index df6d1ee3c46..2c4cc544e2a 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -159,6 +159,8 @@ static bScreen *screen_parent_find(const bScreen *screen) static void do_version_workspaces_create_from_screens(Main *bmain) { + bmain->is_locked_for_linking = false; + for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { const bScreen *screen_parent = screen_parent_find(screen); WorkSpace *workspace; @@ -180,6 +182,8 @@ static void do_version_workspaces_create_from_screens(Main *bmain) } BKE_workspace_layout_add(bmain, workspace, screen, screen->id.name + 2); } + + bmain->is_locked_for_linking = true; } static void do_version_area_change_space_to_space_action(ScrArea *area, const Scene *scene) @@ -1694,21 +1698,11 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports)) rename_id_for_versioning(bmain, ID_MA, "Black Dots", "Dots Stroke"); } - /* 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; - BKE_brush_gpencil_vertex_presets(bmain, ts); - BKE_brush_gpencil_sculpt_presets(bmain, ts); - BKE_brush_gpencil_weight_presets(bmain, ts); - /* Ensure new Paint modes. */ BKE_paint_ensure_from_paintmode(scene, PAINT_MODE_GPENCIL); BKE_paint_ensure_from_paintmode(scene, PAINT_MODE_VERTEX_GPENCIL); @@ -1722,8 +1716,6 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports)) /* Enable cursor by default. */ paint->flags |= PAINT_SHOW_BRUSH; } - /* Ensure Palette by default. */ - BKE_gpencil_palette_ensure(bmain, scene); } } @@ -1737,11 +1729,6 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports)) /* Reset all grease pencil brushes. */ LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { - BKE_brush_gpencil_paint_presets(bmain, scene->toolsettings); - BKE_brush_gpencil_sculpt_presets(bmain, scene->toolsettings); - BKE_brush_gpencil_weight_presets(bmain, scene->toolsettings); - BKE_brush_gpencil_vertex_presets(bmain, scene->toolsettings); - /* Ensure new Paint modes. */ BKE_paint_ensure_from_paintmode(scene, PAINT_MODE_VERTEX_GPENCIL); BKE_paint_ensure_from_paintmode(scene, PAINT_MODE_SCULPT_GPENCIL); |