Fix: Re-apply versioning made for EEVEE-Next in 4.1

Pull Request: https://projects.blender.org/blender/blender/pulls/123909
This commit is contained in:
Miguel Pozo
2024-07-01 13:37:48 +02:00
parent e545c814a4
commit 635db22ca6
2 changed files with 18 additions and 1 deletions

View File

@@ -29,7 +29,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 63
#define BLENDER_FILE_SUBVERSION 64
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and cancel loading the file, showing a warning to

View File

@@ -4202,6 +4202,23 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
}
}
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 402, 64)) {
Scene *scene = static_cast<Scene *>(bmain->scenes.first);
bool is_eevee_legacy = scene && STR_ELEM(scene->r.engine, RE_engine_id_BLENDER_EEVEE);
if (is_eevee_legacy) {
/* Re-apply versioning made for EEVEE-Next in 4.1 before it got delayed. */
LISTBASE_FOREACH (Material *, material, &bmain->materials) {
bool transparent_shadows = material->blend_shadow != MA_BS_SOLID;
SET_FLAG_FROM_TEST(material->blend_flag, transparent_shadows, MA_BL_TRANSPARENT_SHADOW);
}
LISTBASE_FOREACH (Material *, mat, &bmain->materials) {
mat->surface_render_method = (mat->blend_method == MA_BM_BLEND) ?
MA_SURFACE_METHOD_FORWARD :
MA_SURFACE_METHOD_DEFERRED;
}
}
}
/**
* Always bump subversion in BKE_blender_version.h when adding versioning
* code here, and wrap it inside a MAIN_VERSION_FILE_ATLEAST check.