[Bf-blender-cvs] [0885484aa60] master: Fix T59587: Hair dynamics works different when opened in 2.8

Sergey Sharybin noreply at git.blender.org
Thu Feb 7 11:48:44 CET 2019


Commit: 0885484aa60336f601c0ea8042f82172198ec7ef
Author: Sergey Sharybin
Date:   Thu Feb 7 11:46:17 2019 +0100
Branches: master
https://developer.blender.org/rB0885484aa60336f601c0ea8042f82172198ec7ef

Fix T59587: Hair dynamics works different when opened in 2.8

Is a missing do-verisoning code in e3d31b8dfbd.

Unfortunately, at this point it is rather tricky to tell old and new
hair dynamics modifiers apart. Probably easier to accept possible
breackage of the files which were created in 2.7 and saved during
2.8 which had incomplete do-version code.

===================================================================

M	source/blender/blenloader/intern/versioning_280.c

===================================================================

diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 136891ee96e..1510b339c98 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -1981,9 +1981,16 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
 		if (!DNA_struct_elem_find(fd->filesdna, "ClothSimSettings", "short", "bending_model")) {
 			for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
 				for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
+					ClothModifierData *clmd = NULL;
 					if (md->type == eModifierType_Cloth) {
-						ClothModifierData *clmd = (ClothModifierData *)md;
-
+						clmd = (ClothModifierData *)md;
+					}
+					else if (md->type == eModifierType_ParticleSystem) {
+						ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md;
+						ParticleSystem *psys = psmd->psys;
+						clmd = psys->clmd;
+					}
+					if (clmd != NULL) {
 						clmd->sim_parms->bending_model = CLOTH_BENDING_LINEAR;
 						clmd->sim_parms->tension = clmd->sim_parms->structural;
 						clmd->sim_parms->compression = clmd->sim_parms->structural;



More information about the Bf-blender-cvs mailing list