From 9ac81ed6abfbd431aafd75969f8590703ebe122f Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 27 Jul 2022 15:29:49 +0200 Subject: Fix corrupted blend files after issues from new name_map code. Add a version of #BKE_main_namemap_validate that also fixes the issues, and call it in a do_version to fix recent .blend files saved after the regression introduced in rB7f8d05131a77. This is mandatory to fix some production files here at the studio, among other things. --- source/blender/blenloader/intern/versioning_300.c | 28 ++++++++++++++--------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'source/blender/blenloader') diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index fa3789ea590..fd5f93c3e29 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -57,6 +57,7 @@ #include "BKE_lib_id.h" #include "BKE_lib_override.h" #include "BKE_main.h" +#include "BKE_main_namemap.h" #include "BKE_modifier.h" #include "BKE_node.h" #include "BKE_screen.h" @@ -3285,18 +3286,8 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } - /** - * Versioning code until next subversion bump goes here. - * - * \note Be sure to check when bumping the version: - * - "versioning_userdef.c", #blo_do_versions_userdef - * - "versioning_userdef.c", #do_versions_theme - * - * \note Keep this message at the bottom of the function. - */ - { - /* Keep this block, even when empty. */ + if (!MAIN_VERSION_ATLEAST(bmain, 303, 44)) { /* Initialize brush curves sculpt settings. */ LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) { if (brush->ob_mode != OB_MODE_SCULPT_CURVES) { @@ -3312,5 +3303,20 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) ob->dtx &= ~OB_DRAWBOUNDOX; } } + + BKE_main_namemap_validate_and_fix(bmain); + } + + /** + * Versioning code until next subversion bump goes here. + * + * \note Be sure to check when bumping the version: + * - "versioning_userdef.c", #blo_do_versions_userdef + * - "versioning_userdef.c", #do_versions_theme + * + * \note Keep this message at the bottom of the function. + */ + { + /* Keep this block, even when empty. */ } } -- cgit v1.2.3