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
This commit is contained in:
committed by
Christoph Lendenfeld
parent
dd3e23e812
commit
057de815ef
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user