Merge branch 'blender-v2.83-release'

This commit is contained in:
Campbell Barton 2020-05-15 17:47:58 +10:00
commit 20c25bffda
5 changed files with 24 additions and 17 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);
}

View File

@ -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;
}
/** \} */

View File

@ -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);