diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-05-12 04:10:22 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-05-13 03:55:30 +0300 |
commit | 05dd9ca06cc13d0847dbd6115b26df9484019c1e (patch) | |
tree | e41b085a93d5d6d8ab15a9b4a7bbc7ad8d71e1ff /source/blender/blenloader | |
parent | ce35cfd208ac8020f592a2c379e86b5b0f49a35f (diff) |
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
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index ff3909f5e1a..df6d1ee3c46 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -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; + } + } + } } } |