Fix T60971: Apply visual transform not working

Fix issue with 'apply visual transfrom' not working.
Based on fix for https://developer.blender.org/T55494

Reviewers: campbellbarton, sergey

Maniphest Tasks: T60971

Differential Revision: https://developer.blender.org/D5007
This commit is contained in:
Pelle Johnsen 2019-06-04 15:17:23 +02:00 committed by Sergey Sharybin
parent 2fb54ef86e
commit ddc19819f3
Notes: blender-bot 2023-02-14 03:55:09 +01:00
Referenced by issue #60971, Apply Visual Transform(ctrl+a) isn't working with constraints
1 changed files with 5 additions and 4 deletions

View File

@ -813,13 +813,14 @@ static int apply_objects_internal(bContext *C,
static int visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
Depsgraph *depsgraph = CTX_data_evaluated_depsgraph(C);
bool changed = false;
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
BKE_object_where_is_calc(depsgraph, scene, ob);
BKE_object_apply_mat4(ob, ob->obmat, true, true);
BKE_object_where_is_calc(depsgraph, scene, ob);
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
BKE_object_where_is_calc(depsgraph, scene, ob_eval);
BKE_object_apply_mat4(ob_eval, ob_eval->obmat, true, true);
BKE_object_transform_copy(ob, ob_eval);
/* update for any children that may get moved */
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);