From 057de815ef0f0c1a970fd053632f19d757ef660e Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Thu, 21 Sep 2023 15:43:09 +0200 Subject: [PATCH] Fix #97628: Clear and Keep Transformation not working when keyed When clearing the parent of an object that has keys, the object position jumped back to world space immediately. This didn't allow for keying the current position and was inconsistent with setting a parent. This PR fixes it by not instantly re-evaluating the animation. Pull Request: https://projects.blender.org/blender/blender/pulls/112670 --- source/blender/editors/object/object_relations.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/object/object_relations.cc b/source/blender/editors/object/object_relations.cc index 559993b2505..18e37a0b007 100644 --- a/source/blender/editors/object/object_relations.cc +++ b/source/blender/editors/object/object_relations.cc @@ -391,7 +391,7 @@ void ED_object_parent_clear(Object *ob, const int type) if (ob->parent == nullptr) { return; } - + unsigned int flags = ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION; switch (type) { case CLEAR_PARENT_ALL: { /* for deformers, remove corresponding modifiers to prevent @@ -409,6 +409,9 @@ void ED_object_parent_clear(Object *ob, const int type) * result as object's local transforms */ ob->parent = nullptr; BKE_object_apply_mat4(ob, ob->object_to_world, true, false); + /* Don't recalculate the animation because it would change the transform + * instead of keeping it. */ + flags &= ~ID_RECALC_ANIMATION; break; } case CLEAR_PARENT_INVERSE: { @@ -422,7 +425,7 @@ void ED_object_parent_clear(Object *ob, const int type) /* Always clear parentinv matrix for sake of consistency, see #41950. */ unit_m4(ob->parentinv); - DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION); + DEG_id_tag_update(&ob->id, flags); } /* NOTE: poll should check for editable scene. */