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:
authorBastien Montagne <montagne29@wanadoo.fr>2019-05-21 11:31:39 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-05-21 11:31:39 +0300
commit52643bb9e7deaaa2da96f202894e159509ce6eb2 (patch)
tree3611dbab32e56197d06b8c880fefcf5db16bc0dd
parent21d065af5d700a8353474b116fe9a54cb34b915b (diff)
Fix T64763: 'Make Proxy' creates Proxy within linked Collection.
`BKE_collection_object_add_from()` would not check wether collections were local or not... Trivial to fix. Note that here I assume we do not use that function in some special cases where we would like to edit linked datablocks. Think that is reasonable stance, though.
-rw-r--r--source/blender/blenkernel/intern/collection.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index 5dba4607c9f..d2ca304e973 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -705,18 +705,27 @@ bool BKE_collection_object_add(Main *bmain, Collection *collection, Object *ob)
}
/**
- * Add object to all scene collections that reference objects is in
- * (used to copy objects)
+ * Add object to all scene collections that reference object is in
+ * (used to copy objects).
*/
void BKE_collection_object_add_from(Main *bmain, Scene *scene, Object *ob_src, Object *ob_dst)
{
+ bool is_instantiated = false;
+
FOREACH_SCENE_COLLECTION_BEGIN (scene, collection) {
- if (BKE_collection_has_object(collection, ob_src)) {
+ if (!ID_IS_LINKED(collection) && BKE_collection_has_object(collection, ob_src)) {
collection_object_add(bmain, collection, ob_dst, 0, true);
+ is_instantiated = true;
}
}
FOREACH_SCENE_COLLECTION_END;
+ if (!is_instantiated) {
+ /* In case we could not find any non-linked collections in which instantiate our ob_dst,
+ * fallback to scene's master collection... */
+ collection_object_add(bmain, BKE_collection_master(scene), ob_dst, 0, true);
+ }
+
BKE_main_collection_sync(bmain);
}