Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_transform.c
| Context not available. | |||||
| static int visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op)) | static int visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | Depsgraph *depsgraph = CTX_data_evaluated_depsgraph(C); | ||||
| bool changed = false; | bool changed = false; | ||||
| CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { | CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { | ||||
| BKE_object_where_is_calc(depsgraph, scene, ob); | Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); | ||||
| BKE_object_apply_mat4(ob, ob->obmat, true, true); | BKE_object_where_is_calc(depsgraph, scene, ob_eval); | ||||
sergey: If the dependency graph is evaluated, then you don't need this. If it is not evaluated yet (i.e. | |||||
| BKE_object_where_is_calc(depsgraph, scene, ob); | BKE_object_apply_mat4(ob, ob_eval->obmat, true, true); | ||||
sergeyUnsubmitted Not Done Inline ActionsThink this should be BKE_object_apply_mat4(ob_eval, ob_eval->obmat, true, true); sergey: Think this should be `BKE_object_apply_mat4(ob_eval, ob_eval->obmat, true, true);` | |||||
| BKE_object_transform_copy(ob_eval, ob); | |||||
Not Done Inline ActionsIt is unreliable to use BKE_object_where_is_calc on original object: it might depend on constraints which needs final geometry which does not exist in an original domain. Not sure why this is even needed. Is it for applying transform when both children and parent are selected? sergey: It is unreliable to use `BKE_object_where_is_calc` on original object: it might depend on… | |||||
| /* update for any children that may get moved */ | /* update for any children that may get moved */ | ||||
| DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM); | DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM); | ||||
| Context not available. | |||||
If the dependency graph is evaluated, then you don't need this. If it is not evaluated yet (i.e. on redo) this is not enough.
It should be enough to replace CTX_data_depsgraph with CTX_data_evaluated_depsgraph few lines above and remove this manual copy.