diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_library.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/blender.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 10 | ||||
-rw-r--r-- | source/blender/editors/object/object_relations.c | 2 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_library.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 4 |
6 files changed, 16 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index 7af126faa6a..9c5e5e5f208 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -116,7 +116,7 @@ void BKE_main_lib_objects_recalc_all(struct Main *bmain); /* (MAX_ID_NAME - 2) + 3 */ void BKE_id_ui_prefix(char name[66 + 1], const struct ID *id); -void BKE_library_make_local(struct Main *bmain, struct Library *lib, bool untagged_only); +void BKE_library_make_local(struct Main *bmain, struct Library *lib, bool untagged_only, bool set_fake); typedef void (*BKE_library_free_window_manager_cb)(struct bContext *, struct wmWindowManager *); typedef void (*BKE_library_free_notifier_reference_cb)(const void *); diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 8b447379d01..ef9cce349ca 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -1080,7 +1080,7 @@ int BKE_copybuffer_paste(bContext *C, const char *libname, ReportList *reports) /* append, rather than linking */ lib = BLI_findstring(&bmain->library, libname, offsetof(Library, filepath)); - BKE_library_make_local(bmain, lib, true); + BKE_library_make_local(bmain, lib, true, false); /* important we unset, otherwise these object wont * link into other scenes from this blend file */ diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index bfee7c10400..736b2f69442 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1760,7 +1760,7 @@ void BKE_main_id_tag_all(struct Main *mainvar, const bool tag) /* if lib!=NULL, only all from lib local * bmain is almost certainly G.main */ -void BKE_library_make_local(Main *bmain, Library *lib, bool untagged_only) +void BKE_library_make_local(Main *bmain, Library *lib, bool untagged_only, bool set_fake) { ListBase *lbarray[MAX_LIBARRAY]; ID *id, *idn; @@ -1797,7 +1797,15 @@ void BKE_library_make_local(Main *bmain, Library *lib, bool untagged_only) id->tag &= ~(LIB_TAG_EXTERN | LIB_TAG_INDIRECT | LIB_TAG_NEW); } } + + if (set_fake) { + if (!ELEM( GS(id->name), ID_OB, ID_GR)) { + /* do not set fake user on objects, groups (instancing) */ + id_fake_user_set(id); + } + } } + id = idn; } } diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 32a7806907b..b390fc1bfea 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -2220,7 +2220,7 @@ static int make_local_exec(bContext *C, wmOperator *op) "Orphan library objects added to the current scene to avoid loss"); } - BKE_library_make_local(bmain, NULL, false); /* NULL is all libs */ + BKE_library_make_local(bmain, NULL, false, false); /* NULL is all libs */ WM_event_add_notifier(C, NC_WINDOW, NULL); return OPERATOR_FINISHED; } diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c index d241a766b83..3561f2b2fbd 100644 --- a/source/blender/python/intern/bpy_library.c +++ b/source/blender/python/intern/bpy_library.c @@ -416,7 +416,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args)) /* append, rather than linking */ if ((self->flag & FILE_LINK) == 0) { - BKE_library_make_local(bmain, lib, true); + BKE_library_make_local(bmain, lib, true, false); } } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 7ee5f363e4b..ca36c11de4d 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2700,7 +2700,8 @@ static int wm_link_append_exec(bContext *C, wmOperator *op) /* append, rather than linking */ if ((flag & FILE_LINK) == 0) { - BKE_library_make_local(bmain, NULL, true); + bool set_fake = RNA_boolean_get(op->ptr, "set_fake"); + BKE_library_make_local(bmain, NULL, true, set_fake); } /* important we unset, otherwise these object wont @@ -2779,6 +2780,7 @@ static void WM_OT_append(wmOperatorType *ot) FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA); wm_link_append_properties_common(ot, false); + RNA_def_boolean(ot->srna, "set_fake", false, "Fake User", "Set Fake User for appended items (except Objects and Groups)"); } /* *************** recover last session **************** */ |