Fix T76738: Duplicate brushes cause assertion on undo

Changes for 2.90 versioning.
This commit is contained in:
Campbell Barton 2020-05-15 17:53:03 +10:00
parent 559a8886d6
commit e60560bda0
Notes: blender-bot 2023-02-14 05:28:01 +01:00
Referenced by issue #76738, Assert failure undoing view layer creation
3 changed files with 25 additions and 22 deletions

View File

@ -31,7 +31,7 @@ extern "C" {
* \note Use #STRINGIFY() rather than defining with quotes.
*/
#define BLENDER_VERSION 290
#define BLENDER_SUBVERSION 1
#define BLENDER_SUBVERSION 2
/** Several breakages with 280, e.g. collections vs layers. */
#define BLENDER_MINVERSION 280
#define BLENDER_MINSUBVERSION 0

View File

@ -5194,16 +5194,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
/** Repair files from duplicate brushes added to blend files, see: T76738. */
if (!MAIN_VERSION_ATLEAST(bmain, 283, 17) ||
((bmain->versionfile == 290) && !MAIN_VERSION_ATLEAST(bmain, 290, 2))) {
short id_codes[] = {ID_BR, ID_PAL};
for (int i = 0; i < ARRAY_SIZE(id_codes); i++) {
ListBase *lb = which_libbase(bmain, id_codes[i]);
BKE_main_id_repair_duplicate_names_listbase(lb);
}
}
/**
* Versioning code until next subversion bump goes here.
*

View File

@ -29,6 +29,7 @@
#include "BKE_collection.h"
#include "BKE_colortools.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BLO_readfile.h"
@ -40,17 +41,16 @@
void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
UNUSED_VARS(fd);
/**
* Versioning code until next subversion bump goes here.
*
* \note Be sure to check when bumping the version:
* - "versioning_userdef.c", #BLO_version_defaults_userpref_blend
* - "versioning_userdef.c", #do_versions_theme
*
* \note Keep this message at the bottom of the function.
*/
{
/* Keep this block, even when empty. */
/** Repair files from duplicate brushes added to blend files, see: T76738. */
if (!MAIN_VERSION_ATLEAST(bmain, 290, 2)) {
{
short id_codes[] = {ID_BR, ID_PAL};
for (int i = 0; i < ARRAY_SIZE(id_codes); i++) {
ListBase *lb = which_libbase(bmain, id_codes[i]);
BKE_main_id_repair_duplicate_names_listbase(lb);
}
}
if (!DNA_struct_elem_find(fd->filesdna, "SpaceImage", "float", "uv_opacity")) {
for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
@ -84,4 +84,17 @@ void blo_do_versions_290(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_version_defaults_userpref_blend
* - "versioning_userdef.c", #do_versions_theme
*
* \note Keep this message at the bottom of the function.
*/
{
/* Keep this block, even when empty. */
}
}