Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_transform.c
| Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_curve.h" | #include "BKE_curve.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_idcode.h" | #include "BKE_idcode.h" | ||||
| #include "BKE_mball.h" | #include "BKE_mball.h" | ||||
| #include "BKE_mesh.h" | #include "BKE_mesh.h" | ||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "BKE_scene.h" | |||||
| #include "BKE_report.h" | #include "BKE_report.h" | ||||
| #include "BKE_editmesh.h" | #include "BKE_editmesh.h" | ||||
| #include "BKE_multires.h" | #include "BKE_multires.h" | ||||
| #include "BKE_armature.h" | #include "BKE_armature.h" | ||||
| #include "BKE_lattice.h" | #include "BKE_lattice.h" | ||||
| #include "BKE_tracking.h" | #include "BKE_tracking.h" | ||||
| #include "BKE_gpencil.h" | #include "BKE_gpencil.h" | ||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "DEG_depsgraph_query.h" | |||||
| #include "RNA_define.h" | #include "RNA_define.h" | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "ED_armature.h" | #include "ED_armature.h" | ||||
| ▲ Show 20 Lines • Show All 395 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| Object workob; | Object workob; | ||||
| Object *ob_child; | Object *ob_child; | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | Depsgraph *depsgraph = CTX_data_depsgraph(C); | ||||
| /* a change was made, adjust the children to compensate */ | /* a change was made, adjust the children to compensate */ | ||||
| for (ob_child = bmain->objects.first; ob_child; ob_child = ob_child->id.next) { | for (ob_child = bmain->objects.first; ob_child; ob_child = ob_child->id.next) { | ||||
| if (ob_child->parent == ob) { | if (ob_child->parent == ob) { | ||||
| BKE_object_apply_mat4(ob_child, ob_child->obmat, true, false); | Object *ob_child_eval = DEG_get_evaluated_object(depsgraph, ob_child); | ||||
| BKE_object_workob_calc_parent(depsgraph, scene, ob_child, &workob); | BKE_object_apply_mat4(ob_child_eval, ob_child_eval->obmat, true, false); | ||||
| BKE_object_workob_calc_parent(depsgraph, scene, ob_child_eval, &workob); | |||||
| invert_m4_m4(ob_child->parentinv, workob.obmat); | invert_m4_m4(ob_child->parentinv, workob.obmat); | ||||
| /* Copy result of BKE_object_apply_mat4(). */ | |||||
| BKE_object_transform_copy(ob_child, ob_child_eval); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static int apply_objects_internal(bContext *C, | static int apply_objects_internal(bContext *C, | ||||
| ReportList *reports, | ReportList *reports, | ||||
| bool apply_loc, | bool apply_loc, | ||||
| bool apply_rot, | bool apply_rot, | ||||
| ▲ Show 20 Lines • Show All 293 Lines • ▼ Show 20 Lines | if (apply_scale) { | ||||
| ob->scale[0] = ob->scale[1] = ob->scale[2] = 1.0f; | ob->scale[0] = ob->scale[1] = ob->scale[2] = 1.0f; | ||||
| } | } | ||||
| if (apply_rot) { | if (apply_rot) { | ||||
| zero_v3(ob->rot); | zero_v3(ob->rot); | ||||
| unit_qt(ob->quat); | unit_qt(ob->quat); | ||||
| unit_axis_angle(ob->rotAxis, &ob->rotAngle); | unit_axis_angle(ob->rotAxis, &ob->rotAngle); | ||||
| } | } | ||||
| BKE_object_where_is_calc(depsgraph, scene, ob); | Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); | ||||
| BKE_object_transform_copy(ob_eval, ob); | |||||
| BKE_object_where_is_calc(depsgraph, scene, ob_eval); | |||||
| if (ob->type == OB_ARMATURE) { | if (ob->type == OB_ARMATURE) { | ||||
| BKE_pose_where_is(depsgraph, scene, ob); /* needed for bone parents */ | /* needed for bone parents */ | ||||
| BKE_pose_where_is(depsgraph, scene, ob_eval); | |||||
| } | } | ||||
| ignore_parent_tx(C, bmain, scene, ob); | ignore_parent_tx(C, bmain, scene, ob); | ||||
| DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); | DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); | ||||
| changed = true; | changed = true; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,080 Lines • Show Last 20 Lines | |||||