Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_info/info_ops.c
| Show First 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Unpack Blend File Libraries Operator | /** \name Unpack Blend File Libraries Operator | ||||
| * \{ */ | * \{ */ | ||||
| static int unpack_libraries_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | void unpack_libraries_warning(bContext *C, wmOperator *op, wmWarningDetails *warning) | ||||
| { | { | ||||
| return WM_operator_confirm_message( | STRNCPY(warning->message, IFACE_("Creates directories, all new paths should work")); | ||||
| C, op, "Unpack Linked Libraries - creates directories, all new paths should work"); | STRNCPY(warning->confirm_button, TIP_("Unpack")); | ||||
| warning->icon = ALERT_ICON_INFO; | |||||
| } | } | ||||
| void FILE_OT_unpack_libraries(wmOperatorType *ot) | void FILE_OT_unpack_libraries(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Unpack Linked Libraries"; | ot->name = "Unpack Linked Libraries"; | ||||
| ot->idname = "FILE_OT_unpack_libraries"; | ot->idname = "FILE_OT_unpack_libraries"; | ||||
| ot->description = "Restore all packed linked data-blocks to their original locations"; | ot->description = "Restore all packed linked data-blocks to their original locations"; | ||||
| /* api callbacks */ | /* api callbacks */ | ||||
| ot->invoke = unpack_libraries_invoke; | ot->invoke = WM_operator_confirm; | ||||
| ot->exec = unpack_libraries_exec; | ot->exec = unpack_libraries_exec; | ||||
| ot->warning = unpack_libraries_warning; | |||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| ▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | static int pack_all_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | ||||
| /* First check for dirty images. */ | /* First check for dirty images. */ | ||||
| for (ima = bmain->images.first; ima; ima = ima->id.next) { | for (ima = bmain->images.first; ima; ima = ima->id.next) { | ||||
| if (BKE_image_is_dirty(ima)) { | if (BKE_image_is_dirty(ima)) { | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| if (ima) { | if (ima) { | ||||
| return WM_operator_confirm_message( | return WM_operator_confirm(C, op, NULL); | ||||
| C, op, "Some images are painted on. These changes will be lost. Continue?"); | |||||
| } | } | ||||
| return pack_all_exec(C, op); | return pack_all_exec(C, op); | ||||
| } | } | ||||
| void pack_all_warning(bContext *C, wmOperator *op, wmWarningDetails *warning) | |||||
| { | |||||
| STRNCPY(warning->message, | |||||
| IFACE_("Some images are mofified. These changes will be lost. Continue?")); | |||||
| STRNCPY(warning->confirm_button, TIP_("Pack")); | |||||
| } | |||||
| void FILE_OT_pack_all(wmOperatorType *ot) | void FILE_OT_pack_all(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Pack Resources"; | ot->name = "Pack Resources"; | ||||
| ot->idname = "FILE_OT_pack_all"; | ot->idname = "FILE_OT_pack_all"; | ||||
| ot->description = "Pack all used external files into this .blend"; | ot->description = "Pack all used external files into this .blend"; | ||||
| /* api callbacks */ | /* api callbacks */ | ||||
| ot->exec = pack_all_exec; | ot->exec = pack_all_exec; | ||||
| ot->invoke = pack_all_invoke; | ot->invoke = pack_all_invoke; | ||||
| ot->warning = pack_all_warning; | |||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| ▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines | |||||