Fix #132016: UV Sculpt crash with bad tool data
For a period of time during 4.2~4.3, the `UvSculpt` settings could have been in an invalid state. This commit reapplies the same versioning to prevent odd behavior and removes the old versioning code. Pull Request: https://projects.blender.org/blender/blender/pulls/147075
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
|
||||
/* Blender file format version. */
|
||||
#define BLENDER_FILE_VERSION BLENDER_VERSION
|
||||
#define BLENDER_FILE_SUBVERSION 97
|
||||
#define BLENDER_FILE_SUBVERSION 98
|
||||
|
||||
/* 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
|
||||
|
||||
@@ -964,18 +964,6 @@ void blo_do_versions_420(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 402, 23)) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
if (!ts->uvsculpt.curve_distance_falloff) {
|
||||
ts->uvsculpt.size = 50;
|
||||
ts->uvsculpt.strength = 1.0f;
|
||||
ts->uvsculpt.curve_distance_falloff_preset = BRUSH_CURVE_SMOOTH;
|
||||
ts->uvsculpt.curve_distance_falloff = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 402, 24)) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Material", "char", "thickness_mode")) {
|
||||
LISTBASE_FOREACH (Material *, material, &bmain->materials) {
|
||||
|
||||
@@ -3756,6 +3756,22 @@ void blo_do_versions_500(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
FOREACH_NODETREE_END;
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 500, 98)) {
|
||||
/* For a brief period of time, these values were not properly versioned, so it is possible for
|
||||
* files to be in an odd state. This versioning was formerly run in 4.2 subversion 23. */
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
UvSculpt &uvsculpt = scene->toolsettings->uvsculpt;
|
||||
if (uvsculpt.size == 0 || uvsculpt.curve_distance_falloff == nullptr) {
|
||||
uvsculpt.size = 100;
|
||||
uvsculpt.strength = 1.0f;
|
||||
uvsculpt.curve_distance_falloff_preset = BRUSH_CURVE_SMOOTH;
|
||||
if (uvsculpt.curve_distance_falloff == nullptr) {
|
||||
uvsculpt.curve_distance_falloff = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Always bump subversion in BKE_blender_version.h when adding versioning
|
||||
* code here, and wrap it inside a MAIN_VERSION_FILE_ATLEAST check.
|
||||
|
||||
Reference in New Issue
Block a user