Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/windowmanager/intern/wm_files_link.c')
-rw-r--r--source/blender/windowmanager/intern/wm_files_link.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c
index 6ccc5d79962..6ed9dcd4cdc 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -135,7 +135,10 @@ static short wm_link_append_flag(wmOperator *op)
flag |= FILE_LINK;
}
if (RNA_boolean_get(op->ptr, "instance_collections")) {
- flag |= FILE_GROUP_INSTANCE;
+ flag |= FILE_COLLECTION_INSTANCE;
+ }
+ if (RNA_boolean_get(op->ptr, "instance_object_data")) {
+ flag |= FILE_OBDATA_INSTANCE;
}
return flag;
@@ -156,8 +159,9 @@ typedef struct WMLinkAppendData {
LinkNodePair items;
int num_libraries;
int num_items;
- /** Combines #eFileSel_Params_Flag from DNA_space_types.h and
- * BLO_LibLinkFlags from BLO_readfile.h */
+ /**
+ * Combines #eFileSel_Params_Flag from DNA_space_types.h & #eBLOLibLinkFlags from BLO_readfile.h
+ */
int flag;
/* Internal 'private' data */
@@ -250,7 +254,11 @@ static void wm_link_do(WMLinkAppendData *lapp_data,
}
/* here appending/linking starts */
- mainl = BLO_library_link_begin(bmain, &bh, libname);
+ struct LibraryLink_Params liblink_params;
+ BLO_library_link_params_init_with_context(
+ &liblink_params, bmain, flag, scene, view_layer, v3d);
+
+ mainl = BLO_library_link_begin(&bh, libname, &liblink_params);
lib = mainl->curlib;
BLI_assert(lib);
UNUSED_VARS_NDEBUG(lib);
@@ -276,7 +284,7 @@ static void wm_link_do(WMLinkAppendData *lapp_data,
continue;
}
- new_id = BLO_library_link_named_part_ex(mainl, &bh, item->idcode, item->name, flag);
+ new_id = BLO_library_link_named_part(mainl, &bh, item->idcode, item->name, &liblink_params);
if (new_id) {
/* If the link is successful, clear item's libs 'todo' flags.
@@ -286,7 +294,7 @@ static void wm_link_do(WMLinkAppendData *lapp_data,
}
}
- BLO_library_link_end(mainl, &bh, flag, bmain, scene, view_layer, v3d);
+ BLO_library_link_end(mainl, &bh, &liblink_params);
BLO_blendhandle_close(bh);
}
}
@@ -389,13 +397,13 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
if (scene && scene->id.lib) {
BKE_reportf(op->reports,
RPT_WARNING,
- "Scene '%s' is linked, instantiation of objects & groups is disabled",
+ "Scene '%s' is linked, instantiation of objects is disabled",
scene->id.name + 2);
- flag &= ~FILE_GROUP_INSTANCE;
+ flag &= ~(FILE_COLLECTION_INSTANCE | FILE_OBDATA_INSTANCE);
scene = NULL;
}
- /* We need to add nothing from BLO_LibLinkFlags to flag here. */
+ /* We need to add nothing from #eBLOLibLinkFlags to flag here. */
/* from here down, no error returns */
@@ -562,6 +570,14 @@ static void wm_link_append_properties_common(wmOperatorType *ot, bool is_link)
"Instance Collections",
"Create instances for collections, rather than adding them directly to the scene");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+
+ prop = RNA_def_boolean(
+ ot->srna,
+ "instance_object_data",
+ true,
+ "Instance Object Data",
+ "Create instances for object data which are not referenced by any objects");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
void WM_OT_link(wmOperatorType *ot)