Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_transform.cc
| Show All 23 Lines | |||||
| #include "BLI_array.hh" | #include "BLI_array.hh" | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_math_vector.hh" | #include "BLI_math_vector.hh" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLI_vector.hh" | #include "BLI_vector.hh" | ||||
| #include "BLT_translation.h" | |||||
| #include "BKE_armature.h" | #include "BKE_armature.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_curve.h" | #include "BKE_curve.h" | ||||
| #include "BKE_curves.hh" | #include "BKE_curves.hh" | ||||
| #include "BKE_editmesh.h" | #include "BKE_editmesh.h" | ||||
| #include "BKE_gpencil.h" | #include "BKE_gpencil.h" | ||||
| #include "BKE_gpencil_geom.h" | #include "BKE_gpencil_geom.h" | ||||
| #include "BKE_idtype.h" | #include "BKE_idtype.h" | ||||
| ▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | |||||
| bool need_single_user = can_handle_multiuser && apply_objects_internal_need_single_user(C); | bool need_single_user = can_handle_multiuser && apply_objects_internal_need_single_user(C); | ||||
| if ((ob != nullptr) && (ob->data != nullptr) && need_single_user) { | if ((ob != nullptr) && (ob->data != nullptr) && need_single_user) { | ||||
| PropertyRNA *prop = RNA_struct_find_property(op->ptr, "isolate_users"); | PropertyRNA *prop = RNA_struct_find_property(op->ptr, "isolate_users"); | ||||
| if (!RNA_property_is_set(op->ptr, prop)) { | if (!RNA_property_is_set(op->ptr, prop)) { | ||||
| RNA_property_boolean_set(op->ptr, prop, true); | RNA_property_boolean_set(op->ptr, prop, true); | ||||
| } | } | ||||
| if (RNA_property_boolean_get(op->ptr, prop)) { | if (RNA_property_boolean_get(op->ptr, prop)) { | ||||
| return WM_operator_confirm_message( | return WM_operator_confirm(C, op, NULL); | ||||
| C, op, "Create new object-data users and apply transformation"); | |||||
| } | } | ||||
| } | } | ||||
| return object_transform_apply_exec(C, op); | return object_transform_apply_exec(C, op); | ||||
| } | } | ||||
| void object_transform_apply_warning(bContext *C, wmOperator *op, wmWarningDetails *warning) | |||||
| { | |||||
| STRNCPY(warning->message, IFACE_("Create new object-data users and apply transformation")); | |||||
| STRNCPY(warning->confirm_button, TIP_("Apply")); | |||||
| } | |||||
| void OBJECT_OT_transform_apply(wmOperatorType *ot) | void OBJECT_OT_transform_apply(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Apply Object Transform"; | ot->name = "Apply Object Transform"; | ||||
| ot->description = "Apply the object's transformation to its data"; | ot->description = "Apply the object's transformation to its data"; | ||||
| ot->idname = "OBJECT_OT_transform_apply"; | ot->idname = "OBJECT_OT_transform_apply"; | ||||
| /* api callbacks */ | /* api callbacks */ | ||||
| ot->exec = object_transform_apply_exec; | ot->exec = object_transform_apply_exec; | ||||
| ot->invoke = object_transform_apply_invoke; | ot->invoke = object_transform_apply_invoke; | ||||
| ot->poll = ED_operator_objectmode; | ot->poll = ED_operator_objectmode; | ||||
| ot->warning = object_transform_apply_warning; | |||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| RNA_def_boolean(ot->srna, "location", true, "Location", ""); | RNA_def_boolean(ot->srna, "location", true, "Location", ""); | ||||
| RNA_def_boolean(ot->srna, "rotation", true, "Rotation", ""); | RNA_def_boolean(ot->srna, "rotation", true, "Rotation", ""); | ||||
| RNA_def_boolean(ot->srna, "scale", true, "Scale", ""); | RNA_def_boolean(ot->srna, "scale", true, "Scale", ""); | ||||
| RNA_def_boolean(ot->srna, | RNA_def_boolean(ot->srna, | ||||
| ▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines | |||||