10#include <fmt/format.h>
56 ot->name =
"Pack Linked Libraries";
57 ot->idname =
"FILE_OT_pack_libraries";
59 "Store all data-blocks linked from other .blend files in the current .blend file. "
60 "Library references are preserved so the linked data-blocks can be unpacked again";
92 IFACE_(
"Restore Packed Linked Data to Their Original Locations"),
93 IFACE_(
"Will create directories so that all paths are valid."),
102 ot->name =
"Unpack Linked Libraries";
103 ot->idname =
"FILE_OT_unpack_libraries";
104 ot->description =
"Restore all packed linked data-blocks to their original locations";
138 ot->name =
"Automatically Pack Resources";
139 ot->idname =
"FILE_OT_autopack_toggle";
140 ot->description =
"Automatically pack all external files into the .blend file";
184 IFACE_(
"Pack all used external files into this .blend file"),
185 IFACE_(
"Warning: Some images are modified and these changes will be lost."),
197 ot->name =
"Pack Resources";
198 ot->idname =
"FILE_OT_pack_all";
199 ot->description =
"Pack all used external files into this .blend";
216 {
PF_USE_LOCAL,
"USE_LOCAL", 0,
"Use files in current directory (create when necessary)",
""},
220 "Write files to current directory (overwrite existing files)",
225 "Use files in original location (create when necessary)",
230 "Write files to original location (overwrite existing files)",
232 {
PF_KEEP,
"KEEP", 0,
"Disable auto-pack, keep all packed files",
""},
233 {
PF_REMOVE,
"REMOVE", 0,
"Remove Pack",
""},
235 {0,
nullptr, 0,
nullptr,
nullptr},
262 if (
count.total() == 0) {
268 const std::string title = fmt::format(
269 fmt::runtime(
IFACE_(
"Unpack - Files: {}, Bakes: {}")),
count.individual_files,
count.bakes);
285 ot->name =
"Unpack Resources";
286 ot->idname =
"FILE_OT_unpack_all";
287 ot->description =
"Unpack all files packed into this .blend to external ones";
308 {
PF_USE_LOCAL,
"USE_LOCAL", 0,
"Use file from current directory (create when necessary)",
""},
312 "Write file to current directory (overwrite existing file)",
317 "Use file in original location (create when necessary)",
322 "Write file to original location (overwrite existing file)",
325 {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";
555 ot->name =
"Find Missing Files";
556 ot->idname =
"FILE_OT_find_missing_files";
557 ot->description =
"Try to find missing external files";
571 "Find all files in the search path (not just missing)");
594#define INFO_TIMEOUT 5.0f
595#define ERROR_TIMEOUT 10.0f
596#define FLASH_TIMEOUT 1.0f
597#define COLLAPSE_TIMEOUT 0.25f
617 bool send_notifier =
false;
620 const float time_duration = float(
reports->reporttimer->time_duration);
623 if (time_duration > timeout) {
625 reports->reporttimer =
nullptr;
636 const float progress =
powf(time_duration / timeout, 2.0f);
637 const float flash_progress =
powf(time_duration / flash_timeout, 2.0);
640 if (flash_progress <= 1.0f) {
642 send_notifier =
true;
650 send_notifier =
true;
663 ot->name =
"Update Reports Display";
664 ot->idname =
"INFO_OT_reports_display_update";
665 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)
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 uiItemsEnumO(uiLayout *layout, blender::StringRefNull opname, blender::StringRefNull propname)
void uiLayoutSetOperatorContext(uiLayout *layout, wmOperatorCallContext opcontext)
void uiItemsFullEnumO(uiLayout *layout, blender::StringRefNull opname, blender::StringRefNull propname, IDProperty *properties, wmOperatorCallContext context, eUI_Item_Flag flag, const int active=-1)
#define ID_IS_EDITABLE(_id)
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 *)
void MEM_freeN(void *vmemh)
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
int RNA_int_get(PointerRNA *ptr, const char *name)
char * RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, int fixedlen, int *r_len)
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)
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)