Modifiers: Change softbody fuzzy default value

Set fuzzy=1 when softbody modifier is added. As of now, value is 0, this
raises concern of division by zero so bump it to 1.
Updated `softbody_test.blend` to fix the failing test.
Resolves #137849

Pull Request: https://projects.blender.org/blender/blender/pulls/137878
This commit is contained in:
Pratik Borhade
2025-05-30 06:32:08 +02:00
committed by Pratik Borhade
parent bd0855f443
commit 2b0cc73ef6
4 changed files with 12 additions and 3 deletions

View File

@@ -27,7 +27,7 @@
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 82
#define BLENDER_FILE_SUBVERSION 83
/* 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

@@ -3140,6 +3140,7 @@ SoftBody *sbNew()
sb->maxloops = 300;
sb->choke = 3;
sb->fuzzyness = 1;
sb_new_scratch(sb);
/* TODO: backward file compatibility should set `sb->shearstiff = 1.0f` while reading old files.
*/

View File

@@ -15,6 +15,7 @@
#include "DNA_defaults.h"
#include "DNA_light_types.h"
#include "DNA_mesh_types.h"
#include "DNA_object_force_types.h"
#include "DNA_sequence_types.h"
#include "BLI_listbase.h"
@@ -6094,6 +6095,13 @@ void blo_do_versions_450(FileData * /*fd*/, Library * /*lib*/, Main *bmain)
}
}
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 405, 83)) {
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
if (ob->soft) {
ob->soft->fuzzyness = std::max<int>(1, ob->soft->fuzzyness);
}
}
}
/* Always run this versioning (keep at the bottom of the function). Meshes are written with the
* legacy format which always needs to be converted to the new format on file load. To be moved
* to a subversion check in 5.0. */

BIN
tests/files/physics/softbody_test.blend (Stored with Git LFS)

Binary file not shown.