Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_transform.c
| Show First 20 Lines • Show All 541 Lines • ▼ Show 20 Lines | static int apply_objects_internal(bContext *C, | ||||
| ReportList *reports, | ReportList *reports, | ||||
| bool apply_loc, | bool apply_loc, | ||||
| bool apply_rot, | bool apply_rot, | ||||
| bool apply_scale, | bool apply_scale, | ||||
| bool do_props) | bool do_props) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| Depsgraph *depsgraph = CTX_data_evaluated_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| float rsmat[3][3], obmat[3][3], iobmat[3][3], mat[4][4], scale; | float rsmat[3][3], obmat[3][3], iobmat[3][3], mat[4][4], scale; | ||||
| bool changed = true; | bool changed = true; | ||||
| /* first check if we can execute */ | /* first check if we can execute */ | ||||
| CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { | CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { | ||||
| if (ELEM(ob->type, | if (ELEM(ob->type, | ||||
| OB_MESH, | OB_MESH, | ||||
| OB_ARMATURE, | OB_ARMATURE, | ||||
| ▲ Show 20 Lines • Show All 317 Lines • ▼ Show 20 Lines | static int apply_objects_internal(bContext *C, | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); | WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| 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_evaluated_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_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) { | ||||
| Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); | Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); | ||||
| BKE_object_where_is_calc(depsgraph, scene, ob_eval); | BKE_object_where_is_calc(depsgraph, scene, ob_eval); | ||||
| BKE_object_apply_mat4(ob_eval, ob_eval->obmat, true, true); | BKE_object_apply_mat4(ob_eval, ob_eval->obmat, true, true); | ||||
| BKE_object_transform_copy(ob, ob_eval); | BKE_object_transform_copy(ob, ob_eval); | ||||
| ▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | |||||
| }; | }; | ||||
| static int object_origin_set_exec(bContext *C, wmOperator *op) | static int object_origin_set_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| Object *obact = CTX_data_active_object(C); | Object *obact = CTX_data_active_object(C); | ||||
| Object *obedit = CTX_data_edit_object(C); | Object *obedit = CTX_data_edit_object(C); | ||||
| Depsgraph *depsgraph = CTX_data_evaluated_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| Object *tob; | Object *tob; | ||||
| float cent[3], cent_neg[3], centn[3]; | float cent[3], cent_neg[3], centn[3]; | ||||
| const float *cursor = scene->cursor.location; | const float *cursor = scene->cursor.location; | ||||
| int centermode = RNA_enum_get(op->ptr, "type"); | int centermode = RNA_enum_get(op->ptr, "type"); | ||||
| /* keep track of what is changed */ | /* keep track of what is changed */ | ||||
| int tot_change = 0, tot_lib_error = 0, tot_multiuser_arm_error = 0; | int tot_change = 0, tot_lib_error = 0, tot_multiuser_arm_error = 0; | ||||
| ▲ Show 20 Lines • Show All 968 Lines • Show Last 20 Lines | |||||