10#include <fmt/format.h>
63 ot->
name =
"Pack Linked Libraries";
64 ot->
idname =
"FILE_OT_pack_libraries";
66 "Store all data-blocks linked from other .blend files in the current .blend file. "
67 "Library references are preserved so the linked data-blocks can be unpacked again";
99 IFACE_(
"Restore Packed Linked Data to Their Original Locations"),
100 IFACE_(
"Will create directories so that all paths are valid."),
109 ot->
name =
"Unpack Linked Libraries";
110 ot->
idname =
"FILE_OT_unpack_libraries";
111 ot->
description =
"Restore all packed linked data-blocks to their original locations";
145 ot->
name =
"Automatically Pack Resources";
146 ot->
idname =
"FILE_OT_autopack_toggle";
147 ot->
description =
"Automatically pack all external files into the .blend file";
179 for (ima = bmain->
images.first(); ima; ima =
static_cast<Image *
>(ima->id.next)) {
189 IFACE_(
"Pack all used external files into this .blend file"),
190 IFACE_(
"Warning: Some images are modified and these changes will be lost."),
202 ot->
name =
"Pack Resources";
203 ot->
idname =
"FILE_OT_pack_all";
204 ot->
description =
"Pack all used external files into this .blend";
221 {
PF_USE_LOCAL,
"USE_LOCAL", 0,
"Use files in current directory (create when necessary)",
""},
225 "Write files to current directory (overwrite existing files)",
230 "Use files in original location (create when necessary)",
235 "Write files to original location (overwrite existing files)",
237 {
PF_KEEP,
"KEEP", 0,
"Disable auto-pack, keep all packed files",
""},
238 {
PF_REMOVE,
"REMOVE", 0,
"Remove Pack",
""},
240 {0,
nullptr, 0,
nullptr,
nullptr},
265 if (count.
total() == 0) {
271 const std::string title = fmt::format(
278 layout.
op_enum(
"FILE_OT_unpack_all",
"method");
280 popup_menu_end(
C, pup);
288 ot->
name =
"Unpack Resources";
289 ot->
idname =
"FILE_OT_unpack_all";
290 ot->
description =
"Unpack all files packed into this .blend to external ones";
311 {
PF_USE_LOCAL,
"USE_LOCAL", 0,
"Use file from current directory (create when necessary)",
""},
315 "Write file to current directory (overwrite existing file)",
320 "Use file in original location (create when necessary)",
325 "Write file to original location (overwrite existing file)",
328 {0,
nullptr, 0,
nullptr,
nullptr},
380 popup_menu_end(
C, pup);
388 ot->
name =
"Unpack Item";
389 ot->
idname =
"FILE_OT_unpack_item";
390 ot->
description =
"Unpack this file to an external file";
403 ot->
srna,
"id_name",
nullptr,
BKE_ST_MAXNAME,
"ID Name",
"Name of ID block to unpack");
410 "Identifier type of ID block",
426 if (blendfile_path[0] ==
'\0') {
444 ot->
name =
"Make Paths Relative";
445 ot->
idname =
"FILE_OT_make_paths_relative";
446 ot->
description =
"Make all paths to external files relative to current .blend";
466 if (blendfile_path[0] ==
'\0') {
484 ot->
name =
"Make Paths Absolute";
485 ot->
idname =
"FILE_OT_make_paths_absolute";
486 ot->
description =
"Make all paths to external files absolute";
516 ot->
name =
"Report Missing Files";
517 ot->
idname =
"FILE_OT_report_missing_files";
518 ot->
description =
"Report all missing external files";
565 ot->
name =
"Find Missing Files";
566 ot->
idname =
"FILE_OT_find_missing_files";
567 ot->
description =
"Try to find missing external files";
581 "Find all files in the search path (not just missing)");
604#define INFO_TIMEOUT 5.0f
605#define ERROR_TIMEOUT 10.0f
606#define FLASH_TIMEOUT 1.0f
607#define COLLAPSE_TIMEOUT 0.25f
627 bool send_notifier =
false;
633 if (time_duration > timeout) {
646 const float progress =
powf(time_duration / timeout, 2.0f);
647 const float flash_progress =
powf(time_duration / flash_timeout, 2.0);
650 if (flash_progress <= 1.0f) {
652 send_notifier =
true;
660 send_notifier =
true;
673 ot->
name =
"Update Reports Display";
674 ot->
idname =
"INFO_OT_reports_display_update";
675 ot->
description =
"Update the display of reports in Blender UI (internal use)";
#define ID_IS_EDITABLE(_id)
Read Blender memory allocation and freeing.
void relations_refresh_all(Scene *scene)
PopupMenu * popup_menu_begin(bContext *C, const char *title, int icon) ATTR_NONNULL()
void WM_main_add_notifier(uint type, void *reference)
void FILE_OT_unpack_all(wmOperatorType *ot)
static wmOperatorStatus pack_all_invoke(bContext *C, wmOperator *op, const wmEvent *)
Report * BKE_reports_last_displayable(ReportList *reports)
void FILE_OT_pack_all(wmOperatorType *ot)
static const EnumPropertyItem unpack_all_method_items[]
int BKE_packedfile_unpack_all_libraries(Main *bmain, ReportList *reports)
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)
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()
bool BKE_image_is_dirty(Image *image)
static wmOperatorStatus unpack_all_exec(bContext *C, wmOperator *op)
static wmOperatorStatus pack_libraries_exec(bContext *C, wmOperator *op)
void FILE_OT_unpack_item(wmOperatorType *ot)
static wmOperatorStatus find_missing_files_exec(bContext *C, wmOperator *op)
void FILE_OT_make_paths_relative(wmOperatorType *ot)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
int RNA_int_get(PointerRNA *ptr, const char *name)
void FILE_OT_unpack_libraries(wmOperatorType *ot)
void BKE_packedfile_id_unpack(Main *bmain, ID *id, ReportList *reports, enum ePF_FileStatus how)
void BKE_bpath_missing_files_find(Main *bmain, const char *searchpath, ReportList *reports, bool find_all, BPathSummary *r_summary=nullptr)
void BKE_bpath_relative_convert(Main *bmain, const char *basedir, ReportList *reports, BPathSummary *r_summary=nullptr)
static wmOperatorStatus make_paths_relative_exec(bContext *C, wmOperator *op)
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)
void BKE_bpath_summary_report(const BPathSummary &summary, ReportList *reports)
PackedFileCount BKE_packedfile_count_all(Main *bmain)
const char * BKE_main_blendfile_path(const Main *bmain) ATTR_NONNULL()
static wmOperatorStatus pack_all_exec(bContext *C, wmOperator *op)
void BKE_packedfile_pack_all_libraries(Main *bmain, ReportList *reports)
static wmOperatorStatus make_paths_absolute_exec(bContext *C, wmOperator *op)
void BKE_packedfile_unpack_all(Main *bmain, ReportList *reports, enum ePF_FileStatus how)
void FILE_OT_pack_libraries(wmOperatorType *ot)
void BKE_report(ReportList *reports, eReportType type, const char *message)
wmWindowManager * CTX_wm_manager(const bContext *C)
void INFO_OT_reports_display_update(wmOperatorType *ot)
static wmOperatorStatus unpack_item_exec(bContext *C, wmOperator *op)
void BKE_packedfile_pack_all(Main *bmain, ReportList *reports, bool verbose)
static wmOperatorStatus autopack_toggle_exec(bContext *C, wmOperator *op)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
wmOperatorStatus WM_operator_confirm_ex(bContext *C, wmOperator *op, const char *title, const char *message, const char *confirm_text, ui::AlertIcon icon, bool cancel_default)
static wmOperatorStatus unpack_libraries_exec(bContext *C, wmOperator *op)
static wmOperatorStatus update_reports_display_invoke(bContext *C, wmOperator *, const wmEvent *event)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
static wmOperatorStatus report_missing_files_exec(bContext *C, wmOperator *op)
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)
static wmOperatorStatus find_missing_files_invoke(bContext *C, wmOperator *op, const wmEvent *)
Main * CTX_data_main(const bContext *C)
void FILE_OT_find_missing_files(wmOperatorType *ot)
static const EnumPropertyItem unpack_item_method_items[]
void WM_event_timer_remove(wmWindowManager *wm, wmWindow *, wmTimer *timer)
static wmOperatorStatus unpack_all_invoke(bContext *C, wmOperator *op, const wmEvent *)
std::string RNA_string_get(PointerRNA *ptr, const char *name)
void BKE_bpath_absolute_convert(Main *bmain, const char *basedir, ReportList *reports, BPathSummary *r_summary=nullptr)
void BKE_bpath_missing_files_check(Main *bmain, ReportList *reports)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
ReportList * CTX_wm_reports(const bContext *C)
void WM_cursor_wait(bool val)
void FILE_OT_autopack_toggle(wmOperatorType *ot)
void WM_event_add_fileselect(bContext *C, wmOperator *op)
void FILE_OT_report_missing_files(wmOperatorType *ot)
void FILE_OT_make_paths_absolute(wmOperatorType *ot)
ListBaseT< ID > * which_libbase(Main *bmain, short type)
static wmOperatorStatus unpack_libraries_invoke(bContext *C, wmOperator *op, const wmEvent *)
static wmOperatorStatus unpack_item_invoke(bContext *C, wmOperator *op, const wmEvent *)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
ListBaseT< Image > images
ListBaseT< Scene > scenes
void operator_context_set(wm::OpCallContext opcontext)
void op_enum(StringRefNull opname, StringRefNull propname, IDProperty *properties, wm::OpCallContext context, eUI_Item_Flag flag, const int active=-1)
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
struct wmOperatorType * type