diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-08-16 12:05:26 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-08-16 12:06:21 +0300 |
commit | 02e9dba07be7d912eefb30362512a93c91fe6296 (patch) | |
tree | 4785c0cc5def0b7687ee54cb7070bf23b625e1d8 /source/blender/editors/object | |
parent | 3c8e4e4180b680c6eefff9b3cab7bd091b19074f (diff) |
Static Override: fix part of the issues with new Collections.
Still a lot to work here, those are much more complicated to handle than
old Groups. :(
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_relations.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 78e44e52299..bce57f6d55d 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -2225,6 +2225,14 @@ static void make_override_static_tag_object(Object *obact, Object *ob) } } +static void make_override_static_tag_collections(Collection *collection) +{ + collection->id.tag |= LIB_TAG_DOIT; + for (CollectionChild *coll_child = collection->children.first; coll_child != NULL; coll_child = coll_child->next) { + make_override_static_tag_collections(coll_child->collection); + } +} + /* Set the object to override. */ static int make_override_static_invoke(bContext *C, wmOperator *op, const wmEvent *event) { @@ -2273,14 +2281,15 @@ static int make_override_static_exec(bContext *C, wmOperator *op) bool success = false; if (!ID_IS_LINKED(obact) && obact->dup_group != NULL && ID_IS_LINKED(obact->dup_group)) { - const ListBase dup_collection_objects = BKE_collection_object_cache_get(obact->dup_group); - Base *base = BLI_findlink(&dup_collection_objects, RNA_enum_get(op->ptr, "object")); Object *obcollection = obact; - obact = base->object; Collection *collection = obcollection->dup_group; - /* First, we make a static override of the linked collection itself. */ - collection->id.tag |= LIB_TAG_DOIT; + const ListBase dup_collection_objects = BKE_collection_object_cache_get(collection); + Base *base = BLI_findlink(&dup_collection_objects, RNA_enum_get(op->ptr, "object")); + obact = base->object; + + /* First, we make a static override of the linked collection itself, and all its children. */ + make_override_static_tag_collections(collection); /* Then, we make static override of the whole set of objects in the Collection. */ FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(collection, ob) |