diff options
author | Julian Eisel <julian@blender.org> | 2020-06-02 18:31:59 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-06-02 18:59:08 +0300 |
commit | bd3ab27410efc1b3f41eaeda0e9a0ea92749297e (patch) | |
tree | 9a330dad02edb035d71e7e08a3dbfe697f2523fe /source/blender/editors/object/object_relations.c | |
parent | 174332688936911d777ae39d540637edeed1561b (diff) |
Library Overrides: Don't move collections to Scene Collection when overriding
When using the "Make Library Override" operator on instance collections, keep
the overriden collection in the parent collection of the instance empty.
Previoulsy the collection would be added to the scene collection, which was
confusing and not what users expected. It was placed there for a reason after
all.
Part of T76555.
Reviewed by: Andy Goralczyk, Bastien Montange.
Differential Revision: https://developer.blender.org/D7626
Diffstat (limited to 'source/blender/editors/object/object_relations.c')
-rw-r--r-- | source/blender/editors/object/object_relations.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index d0f9b75f277..ca3a559ca1d 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -2516,7 +2516,8 @@ static int make_override_library_exec(bContext *C, wmOperator *op) ViewLayer *view_layer = CTX_data_view_layer(C); Collection *new_collection = (Collection *)collection->id.newid; - BKE_collection_child_add(bmain, scene->master_collection, new_collection); + BKE_collection_add_from_object(bmain, scene, obcollection, new_collection); + FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (new_collection, new_ob) { if (new_ob != NULL && new_ob->id.override_library != NULL) { if ((base = BKE_view_layer_base_find(view_layer, new_ob)) == NULL) { @@ -2524,14 +2525,7 @@ static int make_override_library_exec(bContext *C, wmOperator *op) base = BKE_view_layer_base_find(view_layer, new_ob); DEG_id_tag_update_ex(bmain, &new_ob->id, ID_RECALC_TRANSFORM | ID_RECALC_BASE_FLAGS); } - /* parent to 'collection' empty */ - /* Disabled for now, according to some artist this is probably not really useful anyway. - * And it breaks things like objects parented to bones - * (most likely due to missing proper setting of inverse parent matrix?)... */ - /* Note: we might even actually want to get rid of that instantiating empty... */ - if (0 && new_ob->parent == NULL) { - new_ob->parent = obcollection; - } + if (new_ob == (Object *)obact->id.newid) { /* TODO: is setting active needed? */ BKE_view_layer_base_select_and_set_active(view_layer, base); |