Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_transform.c
| Show First 20 Lines • Show All 1,220 Lines • ▼ Show 20 Lines | #endif | ||||
| * Bone + object locations are handled there. | * Bone + object locations are handled there. | ||||
| */ | */ | ||||
| ED_armature_origin_set(bmain, ob, cursor, centermode, around); | ED_armature_origin_set(bmain, ob, cursor, centermode, around); | ||||
| tot_change++; | tot_change++; | ||||
| arm->id.tag |= LIB_TAG_DOIT; | arm->id.tag |= LIB_TAG_DOIT; | ||||
| /* do_inverse_offset = true; */ /* docenter_armature() handles this */ | /* do_inverse_offset = true; */ /* docenter_armature() handles this */ | ||||
| BKE_object_where_is_calc(depsgraph, scene, ob); | Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); | ||||
| BKE_pose_where_is(depsgraph, scene, ob); /* needed for bone parents */ | BKE_object_transform_copy(ob_eval, ob); | ||||
| BKE_object_where_is_calc(depsgraph, scene, ob_eval); | |||||
| BKE_pose_where_is(depsgraph, scene, ob_eval); /* needed for bone parents */ | |||||
| ignore_parent_tx(bmain, depsgraph, scene, ob); | ignore_parent_tx(bmain, depsgraph, scene, ob); | ||||
| if (obedit) { | if (obedit) { | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 118 Lines • ▼ Show 20 Lines | #endif | ||||
| * note: the functions above must set 'cent' */ | * note: the functions above must set 'cent' */ | ||||
| /* convert the offset to parent space */ | /* convert the offset to parent space */ | ||||
| BKE_object_to_mat4(ob, obmat); | BKE_object_to_mat4(ob, obmat); | ||||
| mul_v3_mat3_m4v3(centn, obmat, cent); /* omit translation part */ | mul_v3_mat3_m4v3(centn, obmat, cent); /* omit translation part */ | ||||
| add_v3_v3(ob->loc, centn); | add_v3_v3(ob->loc, centn); | ||||
| 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(bmain, depsgraph, scene, ob); | ignore_parent_tx(bmain, depsgraph, scene, ob); | ||||
| /* other users? */ | /* other users? */ | ||||
| // CTX_DATA_BEGIN (C, Object *, ob_other, selected_editable_objects) | // CTX_DATA_BEGIN (C, Object *, ob_other, selected_editable_objects) | ||||
| //{ | //{ | ||||
| /* use existing context looper */ | /* use existing context looper */ | ||||
| for (int other_object_index = 0; other_object_index < num_objects; ++other_object_index) { | for (int other_object_index = 0; other_object_index < num_objects; ++other_object_index) { | ||||
| Object *ob_other = objects[other_object_index]; | Object *ob_other = objects[other_object_index]; | ||||
| if ((ob_other->flag & OB_DONE) == 0 && | if ((ob_other->flag & OB_DONE) == 0 && | ||||
| ((ob->data && (ob->data == ob_other->data)) || | ((ob->data && (ob->data == ob_other->data)) || | ||||
| (ob->instance_collection == ob_other->instance_collection && | (ob->instance_collection == ob_other->instance_collection && | ||||
| (ob->transflag | ob_other->transflag) & OB_DUPLICOLLECTION))) { | (ob->transflag | ob_other->transflag) & OB_DUPLICOLLECTION))) { | ||||
| ob_other->flag |= OB_DONE; | ob_other->flag |= OB_DONE; | ||||
| DEG_id_tag_update(&ob_other->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); | DEG_id_tag_update(&ob_other->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); | ||||
| mul_v3_mat3_m4v3(centn, ob_other->obmat, cent); /* omit translation part */ | mul_v3_mat3_m4v3(centn, ob_other->obmat, cent); /* omit translation part */ | ||||
| add_v3_v3(ob_other->loc, centn); | add_v3_v3(ob_other->loc, centn); | ||||
| BKE_object_where_is_calc(depsgraph, scene, ob_other); | Object *ob_other_eval = DEG_get_evaluated_object(depsgraph, ob_other); | ||||
| BKE_object_transform_copy(ob_other_eval, ob_other); | |||||
| BKE_object_where_is_calc(depsgraph, scene, ob_other_eval); | |||||
| if (ob_other->type == OB_ARMATURE) { | if (ob_other->type == OB_ARMATURE) { | ||||
| /* needed for bone parents */ | /* needed for bone parents */ | ||||
| BKE_pose_where_is(depsgraph, scene, ob_other); | BKE_pose_where_is(depsgraph, scene, ob_other_eval); | ||||
| } | } | ||||
| ignore_parent_tx(bmain, depsgraph, scene, ob_other); | ignore_parent_tx(bmain, depsgraph, scene, ob_other); | ||||
| } | } | ||||
| } | } | ||||
| // CTX_DATA_END; | // CTX_DATA_END; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 542 Lines • Show Last 20 Lines | |||||