Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksi Juvani <aleksijuvani>2022-01-11 15:02:49 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2022-01-18 12:10:00 +0300
commitf7b8875ed5a5e86375a119847f5cdf8d4719a62d (patch)
tree15841b9c9ace9f20b45c16bd945410dd35917ffe
parent0ac83d05d7cccec436bb939e0aa768f6a3d77d72 (diff)
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
-rw-r--r--source/blender/editors/physics/particle_object.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index 141315d5200..3bb7d634f2f 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -935,7 +935,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;
}