11#include <fmt/format.h>
59 ot->
name =
"Pack Linked Libraries";
60 ot->
idname =
"FILE_OT_pack_libraries";
62 "Store all data-blocks linked from other .blend files in the current .blend file. "
63 "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";
126 G.fileflags &= ~G_FILE_AUTOPACK;
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";
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},
249 G.fileflags &= ~G_FILE_AUTOPACK;
263 if (
count.total() == 0) {
265 G.fileflags &= ~G_FILE_AUTOPACK;
269 const std::string title = fmt::format(
270 IFACE_(
"Unpack - Files: {}, Bakes: {}"),
count.individual_files,
count.bakes);
286 ot->
name =
"Unpack Resources";
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},
351 G.fileflags &= ~G_FILE_AUTOPACK;
402 "Identifier type of ID block",
418 if (blendfile_path[0] ==
'\0') {
436 ot->
name =
"Make Paths Relative";
437 ot->
idname =
"FILE_OT_make_paths_relative";
438 ot->
description =
"Make all paths to external files relative to current .blend";
458 if (blendfile_path[0] ==
'\0') {
476 ot->
name =
"Make Paths Absolute";
477 ot->
idname =
"FILE_OT_make_paths_absolute";
478 ot->
description =
"Make all paths to external files absolute";
508 ot->
name =
"Report Missing Files";
509 ot->
idname =
"FILE_OT_report_missing_files";
549 ot->
name =
"Find Missing Files";
550 ot->
idname =
"FILE_OT_find_missing_files";
565 "Find all files in the search path (not just missing)");
588#define INFO_TIMEOUT 5.0f
589#define ERROR_TIMEOUT 10.0f
590#define FLASH_TIMEOUT 1.0f
591#define COLLAPSE_TIMEOUT 0.25f
609 bool send_notifier =
false;
615 if (time_duration > timeout) {
628 const float progress =
powf(time_duration / timeout, 2.0f);
629 const float flash_progress =
powf(time_duration / flash_timeout, 2.0);
632 if (flash_progress <= 1.0f) {
634 send_notifier =
true;
642 send_notifier =
true;
655 ot->
name =
"Update Reports Display";
656 ot->
idname =
"INFO_OT_reports_display_update";
657 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 uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname, IDProperty *properties, wmOperatorCallContext context, eUI_Item_Flag flag, const int active=-1)
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, const char *opname, const char *propname)
void uiLayoutSetOperatorContext(uiLayout *layout, wmOperatorCallContext opcontext)
draw_view in_light_buf[] float
void FILE_OT_make_paths_absolute(wmOperatorType *ot)
static int unpack_item_exec(bContext *C, wmOperator *op)
void FILE_OT_unpack_all(wmOperatorType *ot)
static int pack_all_invoke(bContext *C, wmOperator *op, const wmEvent *)
void FILE_OT_unpack_item(wmOperatorType *ot)
static int report_missing_files_exec(bContext *C, wmOperator *op)
static int update_reports_display_invoke(bContext *C, wmOperator *, const wmEvent *event)
static int autopack_toggle_exec(bContext *C, wmOperator *op)
static const EnumPropertyItem unpack_all_method_items[]
static int make_paths_absolute_exec(bContext *C, wmOperator *op)
void FILE_OT_pack_all(wmOperatorType *ot)
static const EnumPropertyItem unpack_item_method_items[]
void FILE_OT_autopack_toggle(wmOperatorType *ot)
static int make_paths_relative_exec(bContext *C, wmOperator *op)
void FILE_OT_report_missing_files(wmOperatorType *ot)
static int unpack_all_exec(bContext *C, wmOperator *op)
static int unpack_libraries_exec(bContext *C, wmOperator *op)
static int pack_all_exec(bContext *C, wmOperator *op)
static int unpack_all_invoke(bContext *C, wmOperator *op, const wmEvent *)
void FILE_OT_pack_libraries(wmOperatorType *ot)
static int find_missing_files_invoke(bContext *C, wmOperator *op, const wmEvent *)
static int unpack_libraries_invoke(bContext *C, wmOperator *op, const wmEvent *)
static int find_missing_files_exec(bContext *C, wmOperator *op)
static int unpack_item_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 int pack_libraries_exec(bContext *C, wmOperator *op)
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 wmTimer * reporttimer
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
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)
int 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)