10#include <fmt/format.h>
57 ot->name =
"Pack Linked Libraries";
58 ot->idname =
"FILE_OT_pack_libraries";
60 "Store all data-blocks linked from other .blend files in the current .blend file. "
61 "Library references are preserved so the linked data-blocks can be unpacked again";
93 IFACE_(
"Restore Packed Linked Data to Their Original Locations"),
94 IFACE_(
"Will create directories so that all paths are valid."),
103 ot->name =
"Unpack Linked Libraries";
104 ot->idname =
"FILE_OT_unpack_libraries";
105 ot->description =
"Restore all packed linked data-blocks to their original locations";
139 ot->name =
"Automatically Pack Resources";
140 ot->idname =
"FILE_OT_autopack_toggle";
141 ot->description =
"Automatically pack all external files into the .blend file";
185 IFACE_(
"Pack all used external files into this .blend file"),
186 IFACE_(
"Warning: Some images are modified and these changes will be lost."),
198 ot->name =
"Pack Resources";
199 ot->idname =
"FILE_OT_pack_all";
200 ot->description =
"Pack all used external files into this .blend";
217 {
PF_USE_LOCAL,
"USE_LOCAL", 0,
"Use files in current directory (create when necessary)",
""},
221 "Write files to current directory (overwrite existing files)",
226 "Use files in original location (create when necessary)",
231 "Write files to original location (overwrite existing files)",
233 {
PF_KEEP,
"KEEP", 0,
"Disable auto-pack, keep all packed files",
""},
234 {
PF_REMOVE,
"REMOVE", 0,
"Remove Pack",
""},
236 {0,
nullptr, 0,
nullptr,
nullptr},
263 if (
count.total() == 0) {
269 const std::string title = fmt::format(
270 fmt::runtime(
IFACE_(
"Unpack - Files: {}, Bakes: {}")),
count.individual_files,
count.bakes);
276 layout->
op_enum(
"FILE_OT_unpack_all",
"method");
286 ot->name =
"Unpack Resources";
287 ot->idname =
"FILE_OT_unpack_all";
288 ot->description =
"Unpack all files packed into this .blend to external ones";
309 {
PF_USE_LOCAL,
"USE_LOCAL", 0,
"Use file from current directory (create when necessary)",
""},
313 "Write file to current directory (overwrite existing file)",
318 "Use file in original location (create when necessary)",
323 "Write file to original location (overwrite existing file)",
326 {0,
nullptr, 0,
nullptr,
nullptr},
384 ot->name =
"Unpack Item";
385 ot->idname =
"FILE_OT_unpack_item";
386 ot->description =
"Unpack this file to an external file";
399 ot->srna,
"id_name",
nullptr,
BKE_ST_MAXNAME,
"ID Name",
"Name of ID block to unpack");
406 "Identifier type of ID block",
422 if (blendfile_path[0] ==
'\0') {
440 ot->name =
"Make Paths Relative";
441 ot->idname =
"FILE_OT_make_paths_relative";
442 ot->description =
"Make all paths to external files relative to current .blend";
462 if (blendfile_path[0] ==
'\0') {
480 ot->name =
"Make Paths Absolute";
481 ot->idname =
"FILE_OT_make_paths_absolute";
482 ot->description =
"Make all paths to external files absolute";
512 ot->name =
"Report Missing Files";
513 ot->idname =
"FILE_OT_report_missing_files";
514 ot->description =
"Report all missing external files";
554 ot->name =
"Find Missing Files";
555 ot->idname =
"FILE_OT_find_missing_files";
556 ot->description =
"Try to find missing external files";
570 "Find all files in the search path (not just missing)");
593#define INFO_TIMEOUT 5.0f
594#define ERROR_TIMEOUT 10.0f
595#define FLASH_TIMEOUT 1.0f
596#define COLLAPSE_TIMEOUT 0.25f
616 bool send_notifier =
false;
622 if (time_duration > timeout) {
635 const float progress =
powf(time_duration / timeout, 2.0f);
636 const float flash_progress =
powf(time_duration / flash_timeout, 2.0);
639 if (flash_progress <= 1.0f) {
641 send_notifier =
true;
649 send_notifier =
true;
662 ot->name =
"Update Reports Display";
663 ot->idname =
"INFO_OT_reports_display_update";
664 ot->description =
"Update the display of reports in Blender UI (internal use)";
void BKE_bpath_relative_convert(Main *bmain, const char *basedir, ReportList *reports, BPathSummary *r_summary=nullptr)
void BKE_bpath_absolute_convert(Main *bmain, const char *basedir, ReportList *reports, BPathSummary *r_summary=nullptr)
void BKE_bpath_summary_report(const BPathSummary &summary, ReportList *reports)
void BKE_bpath_missing_files_find(Main *bmain, const char *searchpath, ReportList *reports, bool find_all)
void BKE_bpath_missing_files_check(Main *bmain, ReportList *reports)
ReportList * CTX_wm_reports(const bContext *C)
Main * CTX_data_main(const bContext *C)
wmWindowManager * CTX_wm_manager(const bContext *C)
bool BKE_image_is_dirty(Image *image)
ID * BKE_libblock_find_name(Main *bmain, short type, const char *name, const std::optional< Library * > lib=std::nullopt) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
const char * BKE_main_blendfile_path(const Main *bmain) ATTR_NONNULL()
int BKE_packedfile_unpack_all_libraries(Main *bmain, ReportList *reports)
PackedFileCount BKE_packedfile_count_all(Main *bmain)
void BKE_packedfile_unpack_all(Main *bmain, ReportList *reports, enum ePF_FileStatus how)
void BKE_packedfile_pack_all_libraries(Main *bmain, ReportList *reports)
void BKE_packedfile_pack_all(Main *bmain, ReportList *reports, bool verbose)
void BKE_packedfile_id_unpack(Main *bmain, ID *id, ReportList *reports, enum ePF_FileStatus how)
Report * BKE_reports_last_displayable(ReportList *reports)
void BKE_report(ReportList *reports, eReportType type, const char *message)
#define ID_IS_EDITABLE(_id)
Read Guarded memory(de)allocation.
void UI_popup_menu_end(bContext *C, uiPopupMenu *pup)
uiPopupMenu * UI_popup_menu_begin(bContext *C, const char *title, int icon) ATTR_NONNULL()
uiLayout * UI_popup_menu_layout(uiPopupMenu *pup)
void FILE_OT_make_paths_absolute(wmOperatorType *ot)
static wmOperatorStatus pack_all_exec(bContext *C, wmOperator *op)
static wmOperatorStatus pack_all_invoke(bContext *C, wmOperator *op, const wmEvent *)
static wmOperatorStatus pack_libraries_exec(bContext *C, wmOperator *op)
void FILE_OT_unpack_all(wmOperatorType *ot)
void FILE_OT_unpack_item(wmOperatorType *ot)
static wmOperatorStatus find_missing_files_exec(bContext *C, wmOperator *op)
static wmOperatorStatus update_reports_display_invoke(bContext *C, wmOperator *, const wmEvent *event)
static const EnumPropertyItem unpack_all_method_items[]
void FILE_OT_pack_all(wmOperatorType *ot)
static const EnumPropertyItem unpack_item_method_items[]
static wmOperatorStatus make_paths_absolute_exec(bContext *C, wmOperator *op)
static wmOperatorStatus make_paths_relative_exec(bContext *C, wmOperator *op)
static wmOperatorStatus unpack_libraries_invoke(bContext *C, wmOperator *op, const wmEvent *)
void FILE_OT_autopack_toggle(wmOperatorType *ot)
void FILE_OT_report_missing_files(wmOperatorType *ot)
static wmOperatorStatus autopack_toggle_exec(bContext *C, wmOperator *op)
static wmOperatorStatus unpack_item_invoke(bContext *C, wmOperator *op, const wmEvent *)
static wmOperatorStatus report_missing_files_exec(bContext *C, wmOperator *op)
static wmOperatorStatus unpack_item_exec(bContext *C, wmOperator *op)
void FILE_OT_pack_libraries(wmOperatorType *ot)
static wmOperatorStatus unpack_libraries_exec(bContext *C, wmOperator *op)
static wmOperatorStatus unpack_all_exec(bContext *C, wmOperator *op)
static wmOperatorStatus find_missing_files_invoke(bContext *C, wmOperator *op, const wmEvent *)
void FILE_OT_unpack_libraries(wmOperatorType *ot)
void FILE_OT_make_paths_relative(wmOperatorType *ot)
void FILE_OT_find_missing_files(wmOperatorType *ot)
void INFO_OT_reports_display_update(wmOperatorType *ot)
static wmOperatorStatus unpack_all_invoke(bContext *C, wmOperator *op, const wmEvent *)
int RNA_int_get(PointerRNA *ptr, const char *name)
std::string RNA_string_get(PointerRNA *ptr, const char *name)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void op_enum(blender::StringRefNull opname, blender::StringRefNull propname, IDProperty *properties, blender::wm::OpCallContext context, eUI_Item_Flag flag, const int active=-1)
void operator_context_set(blender::wm::OpCallContext opcontext)
struct ReportList * reports
struct wmOperatorType * type
void WM_cursor_wait(bool val)
void WM_event_add_fileselect(bContext *C, wmOperator *op)
void WM_main_add_notifier(uint type, void *reference)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void WM_operator_properties_filesel(wmOperatorType *ot, const int filter, const short type, const eFileSel_Action action, const eFileSel_Flag flag, const short display, const short sort)
wmOperatorStatus WM_operator_confirm_ex(bContext *C, wmOperator *op, const char *title, const char *message, const char *confirm_text, int icon, bool cancel_default)
void WM_event_timer_remove(wmWindowManager *wm, wmWindow *, wmTimer *timer)