Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_modifier.cc
| Show All 29 Lines | |||||
| #include "BLI_bitmap.h" | #include "BLI_bitmap.h" | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_path_util.h" | #include "BLI_path_util.h" | ||||
| #include "BLI_string.h" | #include "BLI_string.h" | ||||
| #include "BLI_string_utf8.h" | #include "BLI_string_utf8.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLT_translation.h" | |||||
| #include "BKE_DerivedMesh.h" | #include "BKE_DerivedMesh.h" | ||||
| #include "BKE_animsys.h" | #include "BKE_animsys.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.h" | #include "BKE_curves.h" | ||||
| #include "BKE_curves.hh" | #include "BKE_curves.hh" | ||||
| #include "BKE_displist.h" | #include "BKE_displist.h" | ||||
| ▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | |||||
| Object *ob = (ptr.owner_id != nullptr) ? (Object *)ptr.owner_id : ED_object_active_context(C); | Object *ob = (ptr.owner_id != nullptr) ? (Object *)ptr.owner_id : ED_object_active_context(C); | ||||
| if ((ob->data != nullptr) && ID_REAL_USERS(ob->data) > 1) { | if ((ob->data != nullptr) && ID_REAL_USERS(ob->data) > 1) { | ||||
| PropertyRNA *prop = RNA_struct_find_property(op->ptr, "single_user"); | PropertyRNA *prop = RNA_struct_find_property(op->ptr, "single_user"); | ||||
| 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, "Make object data single-user and apply modifier"); | |||||
| } | } | ||||
| } | } | ||||
| return modifier_apply_exec(C, op); | return modifier_apply_exec(C, op); | ||||
| } | } | ||||
| return retval; | return retval; | ||||
| } | } | ||||
| void modifier_apply_warning(bContext *C, wmOperator *op, wmWarningDetails *warning) | |||||
| { | |||||
| STRNCPY(warning->message, IFACE_("Make object data single-user and apply modifier")); | |||||
| STRNCPY(warning->confirm_button, TIP_("Apply")); | |||||
| } | |||||
| void OBJECT_OT_modifier_apply(wmOperatorType *ot) | void OBJECT_OT_modifier_apply(wmOperatorType *ot) | ||||
| { | { | ||||
| ot->name = "Apply Modifier"; | ot->name = "Apply Modifier"; | ||||
| ot->description = "Apply modifier and remove from the stack"; | ot->description = "Apply modifier and remove from the stack"; | ||||
| ot->idname = "OBJECT_OT_modifier_apply"; | ot->idname = "OBJECT_OT_modifier_apply"; | ||||
| ot->invoke = modifier_apply_invoke; | ot->invoke = modifier_apply_invoke; | ||||
| ot->exec = modifier_apply_exec; | ot->exec = modifier_apply_exec; | ||||
| ot->poll = modifier_apply_poll; | ot->poll = modifier_apply_poll; | ||||
| ot->warning = modifier_apply_warning; | |||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; | ||||
| edit_modifier_properties(ot); | edit_modifier_properties(ot); | ||||
| edit_modifier_report_property(ot); | edit_modifier_report_property(ot); | ||||
| RNA_def_boolean(ot->srna, | RNA_def_boolean(ot->srna, | ||||
| ▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines | |||||