Page MenuHome

Fix T94828: Appending collection with instancing links nested collections
ClosedPublic

Authored by Julian Eisel (Severin) on Jan 11 2022, 8:37 PM.

Diff Detail

Repository
rB Blender

Event Timeline

Julian Eisel (Severin) requested review of this revision.Jan 11 2022, 8:37 PM
Julian Eisel (Severin) created this revision.
Bastien Montagne (mont29) requested changes to this revision.Jan 12 2022, 9:43 AM

Fix is correct, but think this can be made more clear re logic of the code.

source/blender/blenkernel/intern/blendfile_link_append.c
687–697

Think this can be split in two, and then add a third condition, with appropriate comment about why. Something like that:

if (!do_add_collection) {
  continue;
}
/* When instantiated into view-layer, do not add collections if one of their parents is also instantiated. */
if (!do_instantiate_as_empty && loose_data_instantiate_collection_parents_check_recursive(collection)) {
  continue;
}
/* When instantiated as empties, do not add indirectly linked (i.e. non-user-selected) collections. */
if (do_instantiate_as_empty && (item->tag & LINK_APPEND_TAG_INDIRECT) != 0) {
  continue;
}
702–703

This change is not making logic of the code easier to follow, rather the opposite. Suggest to move that 'skip' case above with the other ones. Then you can just do if (do_instantiate_as_empty) here.

This revision now requires changes to proceed.Jan 12 2022, 9:43 AM
Julian Eisel (Severin) marked 2 inline comments as done.
  • Address points from review
source/blender/blenkernel/intern/blendfile_link_append.c
687–697

Agree, this makes things more readable.

This revision is now accepted and ready to land.Jan 17 2022, 3:45 PM