Fix T75347: Update cloth brushes in versioning with a valid mass value

The file attached in the report has a cloth brush saved with a particle
mass of 0.0, which causes all sort of issues in the solver. I don't know
how that brush was created, but it does not seems to be possible to do
in the current version (reset values are correct, property limits are
correct and a default brush is created in versioning_defaults). This
resets all brushes with an invalid value to 1.0.

Reviewed By: jbakker

Maniphest Tasks: T75347

Differential Revision: https://developer.blender.org/D7698
This commit is contained in:
Pablo Dobarro 2020-05-12 03:10:22 +02:00
parent ce35cfd208
commit 05dd9ca06c
Notes: blender-bot 2023-02-14 11:08:33 +01:00
Referenced by issue #75347, cloth brush makes holes in my mesh
1 changed files with 9 additions and 0 deletions

View File

@ -5071,5 +5071,14 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
*/
{
/* Keep this block, even when empty. */
/* Reset the cloth mass to 1.0 in brushes with an invalid value. */
for (Brush *br = bmain->brushes.first; br; br = br->id.next) {
if (br->sculpt_tool == SCULPT_TOOL_CLOTH) {
if (br->cloth_mass == 0.0f) {
br->cloth_mass = 1.0f;
}
}
}
}
}