102 if (
G.filepath_last_library[0] !=
'\0') {
105 else if (blendfile_path[0] !=
'\0') {
165 const char *filepath,
168 const bool do_append)
172 if (!group || !name) {
186 "Can't append data-block '%s' of type '%s'",
193 "Can't link data-block '%s' of type '%s'",
223 filepath, libname, &group, &name);
237 if (!is_librarypath_valid) {
268 if (scene && scene->id.lib) {
271 "Scene '%s' is linked, instantiation of objects is disabled",
307 if (libraries.
add(libname, lib_idx)) {
327 lib_idx = libraries.
lookup(libname);
399 STRNCPY(
G.filepath_last_library, root);
414 ot->
srna,
"link", is_link,
"Link",
"Link the objects or data-blocks rather than appending");
422 "Try to re-use previously matching appended data-blocks instead of appending a new copy");
428 "Don't add asset meta-data or tags from the original data-block");
438 "Put new objects on the active collection");
443 "instance_collections",
445 "Instance Collections",
446 "Create instances for collections, rather than adding them directly to the scene");
451 "instance_object_data",
453 "Instance Object Data",
454 "Create instances for object data which are not referenced by any objects");
508 "Set \"Fake User\" for appended items (except objects and collections)");
514 "Localize all appended data, including those indirectly linked from other libraries");
528 const char *filepath,
547 lapp_context,
id_name, id_code,
nullptr);
577 const char *filepath,
584 bmain, scene, view_layer, v3d, filepath, id_code,
id_name,
flag);
591 const char *filepath,
598 bmain, scene, view_layer, v3d, filepath, id_code,
id_name,
flag);
618 if (
lib->runtime.parent) {
621 "Cannot relocate indirectly linked library '%s'",
622 lib->runtime.filepath_abs);
639 reports,
RPT_ERROR,
"'%s' is not a valid library filepath",
lib->runtime.filepath_abs);
646 "Trying to reload library '%s' from invalid path '%s'",
648 lib->runtime.filepath_abs);
691 if (
lib ==
nullptr) {
705 if (
lib->runtime.parent && !do_reload) {
708 "Cannot relocate indirectly linked library '%s'",
709 lib->runtime.filepath_abs);
726 "Trying to reload or relocate library '%s' to invalid path '%s'",
735 "Cannot relocate library '%s' to current blend file '%s'",
746 CLOG_INFO(&
LOG, 4,
"We are supposed to reload '%s' lib (%d)",
lib->filepath,
lib->id.us);
757 &
LOG, 4,
"We are supposed to relocate '%s' lib to new '%s' one",
lib->filepath, libname);
785 CLOG_INFO(&
LOG, 4,
"\tCandidate new lib to reload datablocks from: %s", filepath);
791 CLOG_INFO(&
LOG, 4,
"\tCandidate new lib to reload datablocks from: %s", filepath);
807 STRNCPY(
G.filepath_last_library, root);
834 ot->
name =
"Relocate Library";
836 ot->
description =
"Relocate the given library to one or several others";
865 ot->
name =
"Reload Library";
bool BKE_blendfile_library_path_explode(const char *path, char *r_dir, char **r_group, char **r_name)
bool BKE_blendfile_extension_check(const char *str)
void BKE_blendfile_link_append_context_finalize(BlendfileLinkAppendContext *lapp_context)
void BKE_blendfile_link(BlendfileLinkAppendContext *lapp_context, ReportList *reports)
void BKE_blendfile_library_relocate(BlendfileLinkAppendContext *lapp_context, ReportList *reports, Library *library, bool do_reload)
void BKE_blendfile_link_append_context_library_add(BlendfileLinkAppendContext *lapp_context, const char *libname, BlendHandle *blo_handle)
bool BKE_blendfile_link_append_context_is_empty(BlendfileLinkAppendContext *lapp_context)
BlendfileLinkAppendContextItem * BKE_blendfile_link_append_context_item_add(BlendfileLinkAppendContext *lapp_context, const char *idname, short idcode, void *userdata)
void BKE_blendfile_link_append_context_free(BlendfileLinkAppendContext *lapp_context)
void BKE_blendfile_append(BlendfileLinkAppendContext *lapp_context, ReportList *reports)
void BKE_blendfile_link_append_context_flag_set(BlendfileLinkAppendContext *lapp_context, int flag, bool do_set)
void BKE_blendfile_link_append_context_item_library_index_enable(BlendfileLinkAppendContext *lapp_context, BlendfileLinkAppendContextItem *item, int library_index)
void BKE_blendfile_link_append_instantiate_loose(BlendfileLinkAppendContext *lapp_context, ReportList *reports)
void BKE_blendfile_link_append_context_embedded_blendfile_set(BlendfileLinkAppendContext *lapp_context, const void *blendfile_mem, int blendfile_memsize)
BlendfileLinkAppendContext * BKE_blendfile_link_append_context_new(LibraryLink_Params *params)
void BKE_blendfile_link_append_context_init_done(BlendfileLinkAppendContext *lapp_context)
ID * BKE_blendfile_link_append_context_item_newid_get(BlendfileLinkAppendContext *lapp_context, BlendfileLinkAppendContextItem *item)
Scene * CTX_data_scene(const bContext *C)
Object * CTX_data_edit_object(const bContext *C)
Main * CTX_data_main(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
bool BKE_idtype_idcode_is_linkable(short idcode)
short BKE_idtype_idcode_from_name(const char *idtype_name)
bool BKE_idtype_idcode_is_only_appendable(short idcode)
void BKE_view_layer_base_deselect_all(const Scene *scene, ViewLayer *view_layer)
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()
void BKE_main_lib_objects_recalc_all(Main *bmain)
void BKE_main_id_tag_all(Main *mainvar, int tag, bool value)
const char * BKE_main_blendfile_path(const Main *bmain) ATTR_NONNULL()
const char * BKE_main_blendfile_path_from_global()
General operations, lookup, etc. for materials.
General operations, lookup, etc. for blender objects.
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
API for Blender-side Rigid Body stuff.
int BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
#define BLI_path_join(...)
void void BLI_path_split_dir_part(const char *filepath, char *dir, size_t dir_maxncpy) ATTR_NONNULL(1
#define STRNCPY(dst, src)
external readfile function prototypes.
@ BLO_LIBLINK_APPEND_RECURSIVE
@ BLO_LIBLINK_USE_PLACEHOLDERS
@ BLO_LIBLINK_APPEND_ASSET_DATA_CLEAR
@ BLO_LIBLINK_OBDATA_INSTANCE
@ BLO_LIBLINK_APPEND_SET_FAKEUSER
@ BLO_LIBLINK_FORCE_INDIRECT
@ BLO_LIBLINK_APPEND_LOCAL_ID_REUSE
@ BLO_LIBLINK_COLLECTION_INSTANCE
void BLO_library_link_params_init_with_context(LibraryLink_Params *params, Main *bmain, int flag, int id_tag_extra, Scene *scene, ViewLayer *view_layer, const View3D *v3d)
#define CLOG_WARN(clg_ref,...)
#define CLOG_INFO(clg_ref, level,...)
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
ID and Library types, which are fundamental for SDNA.
Object groups, one object can be in many groups at once.
Object is a sort of wrapper for general info.
#define FILE_MAX_LIBEXTRA
@ RPT_ERROR_INVALID_INPUT
int datatoc_startup_blend_size
const char datatoc_startup_blend[]
void IMB_colormanagement_check_file_config(Main *bmain)
Read Guarded memory(de)allocation.
#define RNA_BEGIN(sptr, itemptr, propname)
bool add(const Key &key, const Value &value)
const Value & lookup(const Key &key) const
std::string id_name(void *id)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop)
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_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
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
static DynamicLibrary lib
void WM_event_add_fileselect(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
static int wm_lib_relocate_exec(bContext *C, wmOperator *op)
void WM_lib_reload(Library *lib, bContext *C, ReportList *reports)
static bool wm_link_append_poll(bContext *C)
static int wm_lib_relocate_exec_do(bContext *C, wmOperator *op, bool do_reload)
static int wm_link_append_flag(wmOperator *op)
static int wm_lib_relocate_invoke(bContext *C, wmOperator *op, const wmEvent *)
static bool wm_link_append_item_poll(ReportList *reports, const char *filepath, const char *group, const char *name, const bool do_append)
static int wm_link_append_exec(bContext *C, wmOperator *op)
void WM_OT_lib_relocate(wmOperatorType *ot)
static int wm_link_append_invoke(bContext *C, wmOperator *op, const wmEvent *)
static ID * wm_file_link_append_datablock_ex(Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, const char *filepath, const short id_code, const char *id_name, const int flag)
ID * WM_file_append_datablock(Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, const char *filepath, const short id_code, const char *id_name, int flag)
static void wm_link_append_properties_common(wmOperatorType *ot, bool is_link)
void WM_OT_append(wmOperatorType *ot)
ID * WM_file_link_datablock(Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, const char *filepath, const short id_code, const char *id_name, int flag)
static int wm_lib_reload_exec(bContext *C, wmOperator *op)
void WM_OT_lib_reload(wmOperatorType *ot)
void WM_OT_link(wmOperatorType *ot)
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)
bool WM_operator_winactive(bContext *C)