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-04-02 22:50:17 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-04-02 22:53:20 +0300
commita813e259d6309b25fbd0a6d506df810ad2b11395 (patch)
tree176f18e09e7036ac01ee4c2a93fc88bc3fa8c0b4 /source/blender/editors/object/object_relations.c
parentcf7dc769afb5c4e53a75716f0d54b541703e6877 (diff)
Fix T63220: Cannot make object single user after Duplicate Scene with Link Object Data.
Caused by own recent rB17c15798c35f33e (already a fix in that code). We cannot erase immediately master_collection's childrn list, as it is used in sub-code to check in how many scenes an object is instanciated. Further more, we only want to do the remove old/add new children collections in case we are actually duplicating them. Makes me even more eager to nuke that whole piece of code and rethink from scratch that kind of ID handling. Some day...
Diffstat (limited to 'source/blender/editors/object/object_relations.c')
-rw-r--r--source/blender/editors/object/object_relations.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index ec6c1059ed3..d069772a0ce 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1627,16 +1627,18 @@ static Collection *single_object_users_collection(
* However, this means its children need to be re-added manually here, otherwise their parent lists are empty
* (which will lead to crashes, see T63101). */
CollectionChild *child_next, *child = collection->children.first;
- if (is_master_collection) {
- BLI_listbase_clear(&collection->children);
- }
- for (; child; child = child_next) {
+ CollectionChild *orig_child_last = collection->children.last;
+ for (; child != NULL; child = child_next) {
child_next = child->next;
Collection *collection_child_new = single_object_users_collection(
bmain, scene, child->collection, flag, copy_collections, false);
- if (is_master_collection) {
+ if (is_master_collection && copy_collections && child->collection != collection_child_new) {
BKE_collection_child_add(bmain, collection, collection_child_new);
+ BLI_remlink(&collection->children, child);
MEM_freeN(child);
+ if (child == orig_child_last) {
+ break;
+ }
}
}