[Bf-blender-cvs] [66346a6852e] blender-v2.93-release: Fix `PSYS_GLOBAL_HAIR` stripped even if connecting the hair fails

Aleksi Juvani noreply at git.blender.org
Tue Jan 11 16:00:24 CET 2022


Commit: 66346a6852e282a3a614ac230badf3aa3d228fc4
Author: Aleksi Juvani
Date:   Tue Jan 11 13:02:49 2022 +0100
Branches: blender-v2.93-release
https://developer.blender.org/rB66346a6852e282a3a614ac230badf3aa3d228fc4

Fix `PSYS_GLOBAL_HAIR` stripped even if connecting the hair fails

After disconnecting hair on an object, if you then hide the particle system, and try connecting the hair again, the operator is cancelled due to `remap_hair_emitter` returning `false` because `target_psmd->mesh_final` is NULL, but `connect_hair` will still strip the `PSYS_GLOBAL_HAIR` flag, which will cause the hair in the hidden particle system to be positioned incorrectly. The correct behavior is to strip the flag only if `remap_hair_emitter` succeeds.

Differential Revision: https://developer.blender.org/D13703

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

M	source/blender/editors/physics/particle_object.c

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

diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index 8ba600d3a7d..d6b36dd4a6b 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -937,7 +937,9 @@ static bool connect_hair(Depsgraph *depsgraph, Scene *scene, Object *ob, Particl
                           ob->obmat,
                           psys->flag & PSYS_GLOBAL_HAIR,
                           false);
-  psys->flag &= ~PSYS_GLOBAL_HAIR;
+  if (ok) {
+    psys->flag &= ~PSYS_GLOBAL_HAIR;
+  }
 
   return ok;
 }



More information about the Bf-blender-cvs mailing list