diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-05-15 10:47:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-05-15 10:47:58 +0300 |
commit | 20c25bffda0df4260e13bda697347ce830857b7a (patch) | |
tree | ec68fc90ef33bb2463c1f34cf6bb254cf91e9596 /source/blender | |
parent | 656692913beb0d47f41a21db53fc4c310e2fb203 (diff) | |
parent | 6a850f3cc840a574d3b5b5af7b608ae3536f96ec (diff) |
Merge branch 'blender-v2.83-release'
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_main.h | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lib_id.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lib_id_delete.c | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 10 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 21 |
5 files changed, 24 insertions, 17 deletions
diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h index b2472e862ec..29ec65166a9 100644 --- a/source/blender/blenkernel/BKE_main.h +++ b/source/blender/blenkernel/BKE_main.h @@ -105,6 +105,12 @@ typedef struct Main { */ char use_memfile_full_barrier; + /** + * When linking, disallow creation of new data-blocks. + * Make sure we don't do this by accident, see T76738. + */ + char is_locked_for_linking; + BlendThumbnail *blen_thumb; struct Library *curlib; diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c index d8b63f0f527..9ef5c549235 100644 --- a/source/blender/blenkernel/intern/lib_id.c +++ b/source/blender/blenkernel/intern/lib_id.c @@ -963,6 +963,8 @@ void *BKE_libblock_alloc(Main *bmain, short type, const char *name, const int fl id->us = 1; } if ((flag & LIB_ID_CREATE_NO_MAIN) == 0) { + /* Note that 2.8x versioning has tested not to cause conflicts. */ + BLI_assert(bmain->is_locked_for_linking == false || ELEM(type, ID_WS, ID_GR)); ListBase *lb = which_libbase(bmain, type); BKE_main_lock(bmain); diff --git a/source/blender/blenkernel/intern/lib_id_delete.c b/source/blender/blenkernel/intern/lib_id_delete.c index fdee5500fbd..7c96d0a6401 100644 --- a/source/blender/blenkernel/intern/lib_id_delete.c +++ b/source/blender/blenkernel/intern/lib_id_delete.c @@ -128,6 +128,8 @@ void BKE_id_free_ex(Main *bmain, void *idv, int flag, const bool use_flag_from_i const short type = GS(id->name); if (bmain && (flag & LIB_ID_FREE_NO_DEG_TAG) == 0) { + BLI_assert(bmain->is_locked_for_linking == false); + DEG_id_type_tag(bmain, type); } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 7a63c2699f3..9cbe6056dc4 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -10003,6 +10003,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { /* WATCH IT!!!: pointers from libdata have not been converted */ + /* Don't allow versioning to create new data-blocks. */ + main->is_locked_for_linking = true; + if (G.debug & G_DEBUG) { char build_commit_datetime[32]; time_t temp_time = main->build_commit_timestamp; @@ -10034,6 +10037,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* WATCH IT 2!: Userdef struct init see do_versions_userdef() above! */ /* don't forget to set version number in BKE_blender_version.h! */ + + main->is_locked_for_linking = false; } static void do_versions_after_linking(Main *main, ReportList *reports) @@ -10041,11 +10046,16 @@ static void do_versions_after_linking(Main *main, ReportList *reports) // printf("%s for %s (%s), %d.%d\n", __func__, main->curlib ? main->curlib->name : main->name, // main->curlib ? "LIB" : "MAIN", main->versionfile, main->subversionfile); + /* Don't allow versioning to create new data-blocks. */ + main->is_locked_for_linking = true; + do_versions_after_linking_250(main); do_versions_after_linking_260(main); do_versions_after_linking_270(main); do_versions_after_linking_280(main, reports); do_versions_after_linking_cycles(main); + + main->is_locked_for_linking = false; } /** \} */ diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 62e3a196b08..a8203e7b083 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -160,6 +160,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; @@ -181,6 +183,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) @@ -1695,21 +1699,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); @@ -1723,8 +1717,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); } } @@ -1738,11 +1730,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); |