Fix T66629: Library override - fails when armature and mesh are in separate collections.
Some ugly very low-level collection code was using the generic LIB_TAG_DOIT tag... should never happen, that one is for rather high-level code to use, core process shall use own tags.
This commit is contained in:
parent
cee484a4c5
commit
ae7db53744
Notes:
blender-bot
2023-02-14 02:22:07 +01:00
Referenced by issue #66629, Library override - fails when armature and mesh are in separate collections
|
@ -1100,7 +1100,7 @@ void BKE_collection_parent_relations_rebuild(Collection *collection)
|
|||
static void collection_parents_rebuild_recursive(Collection *collection)
|
||||
{
|
||||
BKE_collection_parent_relations_rebuild(collection);
|
||||
collection->id.tag &= ~LIB_TAG_DOIT;
|
||||
collection->tag &= ~COLLECTION_TAG_RELATION_REBUILD;
|
||||
|
||||
for (CollectionChild *child = collection->children.first; child != NULL; child = child->next) {
|
||||
collection_parents_rebuild_recursive(child->collection);
|
||||
|
@ -1109,8 +1109,6 @@ static void collection_parents_rebuild_recursive(Collection *collection)
|
|||
|
||||
/**
|
||||
* Rebuild parent relationships from child ones, for all collections in given \a bmain.
|
||||
*
|
||||
* \note Uses LIB_TAG_DOIT internally...
|
||||
*/
|
||||
void BKE_main_collections_parent_relations_rebuild(Main *bmain)
|
||||
{
|
||||
|
@ -1119,7 +1117,7 @@ void BKE_main_collections_parent_relations_rebuild(Main *bmain)
|
|||
collection = collection->id.next) {
|
||||
BLI_freelistN(&collection->parents);
|
||||
|
||||
collection->id.tag |= LIB_TAG_DOIT;
|
||||
collection->tag |= COLLECTION_TAG_RELATION_REBUILD;
|
||||
}
|
||||
|
||||
/* Scene's master collections will be 'root' parent of most of our collections, so start with
|
||||
|
@ -1132,7 +1130,7 @@ void BKE_main_collections_parent_relations_rebuild(Main *bmain)
|
|||
* lib_link_collection_data() seems to assume that, so do the same here. */
|
||||
for (Collection *collection = bmain->collections.first; collection != NULL;
|
||||
collection = collection->id.next) {
|
||||
if (collection->id.tag & LIB_TAG_DOIT) {
|
||||
if (collection->tag & COLLECTION_TAG_RELATION_REBUILD) {
|
||||
/* Note: we do not have easy access to 'which collections is root' info in that case, which
|
||||
* means test for cycles in collection relationships may fail here. I don't think that is an
|
||||
* issue in practice here, but worth keeping in mind... */
|
||||
|
|
|
@ -6220,6 +6220,7 @@ static void direct_link_collection(FileData *fd, Collection *collection)
|
|||
collection->preview = direct_link_preview_image(fd, collection->preview);
|
||||
|
||||
collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE;
|
||||
collection->tag = 0;
|
||||
BLI_listbase_clear(&collection->object_cache);
|
||||
BLI_listbase_clear(&collection->parents);
|
||||
|
||||
|
|
|
@ -57,7 +57,9 @@ typedef struct Collection {
|
|||
float instance_offset[3];
|
||||
|
||||
short flag;
|
||||
char _pad[6];
|
||||
/* Runtime-only, always cleared on file load. */
|
||||
short tag;
|
||||
char _pad[4];
|
||||
|
||||
/* Runtime. Cache of objects in this collection and all its
|
||||
* children. This is created on demand when e.g. some physics
|
||||
|
@ -84,4 +86,12 @@ enum {
|
|||
COLLECTION_IS_MASTER = (1 << 5), /* Is master collection embedded in the scene. */
|
||||
};
|
||||
|
||||
/* Collection->tag */
|
||||
enum {
|
||||
/* That code (BKE_main_collections_parent_relations_rebuild and the like)
|
||||
* is called from very low-level places, like e.g ID remapping...
|
||||
* Using a generic tag like LIB_TAG_DOIT for this is just impossible, we need our very own. */
|
||||
COLLECTION_TAG_RELATION_REBUILD = (1 << 0),
|
||||
};
|
||||
|
||||
#endif /* __DNA_COLLECTION_TYPES_H__ */
|
||||
|
|
Loading…
Reference in New Issue