diff options
author | Bastien Montagne <bastien@blender.org> | 2022-09-08 17:55:46 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-09-08 19:49:10 +0300 |
commit | 06a5741f427467d671986ca907d47b76d53f3f6e (patch) | |
tree | 84c052d4b4c81ad730e72f9412a54d8ffac14a36 /source/blender/blenkernel | |
parent | e5a7470638803fd0780f98d8b23052cc16ca8d7d (diff) |
Silence warnings/assert about invalid embedded IDs for older blendfiles.
there is no point in warning about files that are not supposed to be
'correct' in that regard.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/collection.c | 21 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/node.cc | 21 |
2 files changed, 28 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index dc04eb0dba3..41ec120519b 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -234,8 +234,13 @@ void BKE_collection_compat_blend_read_data(BlendDataReader *reader, SceneCollect void BKE_collection_blend_read_data(BlendDataReader *reader, Collection *collection, ID *owner_id) { /* Special case for this pointer, do not rely on regular `lib_link` process here. Avoids needs - * for do_versioning, and ensures coherence of data in any case. */ - BLI_assert((collection->id.flag & LIB_EMBEDDED_DATA) != 0 || owner_id == NULL); + * for do_versioning, and ensures coherence of data in any case. + * + * NOTE: Old versions are very often 'broken' here, just fix it silently in these cases. + */ + if (BLO_read_fileversion_get(reader) > 300) { + BLI_assert((collection->id.flag & LIB_EMBEDDED_DATA) != 0 || owner_id == NULL); + } BLI_assert(owner_id == NULL || owner_id->lib == collection->id.lib); if (owner_id != NULL && (collection->id.flag & LIB_EMBEDDED_DATA) == 0) { /* This is unfortunate, but currently a lot of existing files (including startup ones) have @@ -244,11 +249,13 @@ void BKE_collection_blend_read_data(BlendDataReader *reader, Collection *collect * NOTE: Using do_version is not a solution here, since this code will be called before any * do_version takes place. Keeping it here also ensures future (or unknown existing) similar * bugs won't go easily unnoticed. */ - CLOG_WARN(&LOG, - "Fixing root node tree '%s' owned by '%s' missing EMBEDDED tag, please consider " - "re-saving your (startup) file", - collection->id.name, - owner_id->name); + if (BLO_read_fileversion_get(reader) > 300) { + CLOG_WARN(&LOG, + "Fixing root node tree '%s' owned by '%s' missing EMBEDDED tag, please consider " + "re-saving your (startup) file", + collection->id.name, + owner_id->name); + } collection->id.flag |= LIB_EMBEDDED_DATA; } collection->owner_id = owner_id; diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index a78257a250b..fadcceae393 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -652,8 +652,13 @@ static void direct_link_node_socket(BlendDataReader *reader, bNodeSocket *sock) void ntreeBlendReadData(BlendDataReader *reader, ID *owner_id, bNodeTree *ntree) { /* Special case for this pointer, do not rely on regular `lib_link` process here. Avoids needs - * for do_versioning, and ensures coherence of data in any case. */ - BLI_assert((ntree->id.flag & LIB_EMBEDDED_DATA) != 0 || owner_id == nullptr); + * for do_versioning, and ensures coherence of data in any case. + * + * NOTE: Old versions are very often 'broken' here, just fix it silently in these cases. + */ + if (BLO_read_fileversion_get(reader) > 300) { + BLI_assert((ntree->id.flag & LIB_EMBEDDED_DATA) != 0 || owner_id == nullptr); + } BLI_assert(owner_id == NULL || owner_id->lib == ntree->id.lib); if (owner_id != nullptr && (ntree->id.flag & LIB_EMBEDDED_DATA) == 0) { /* This is unfortunate, but currently a lot of existing files (including startup ones) have @@ -662,11 +667,13 @@ void ntreeBlendReadData(BlendDataReader *reader, ID *owner_id, bNodeTree *ntree) * NOTE: Using do_version is not a solution here, since this code will be called before any * do_version takes place. Keeping it here also ensures future (or unknown existing) similar * bugs won't go easily unnoticed. */ - CLOG_WARN(&LOG, - "Fixing root node tree '%s' owned by '%s' missing EMBEDDED tag, please consider " - "re-saving your (startup) file", - ntree->id.name, - owner_id->name); + if (BLO_read_fileversion_get(reader) > 300) { + CLOG_WARN(&LOG, + "Fixing root node tree '%s' owned by '%s' missing EMBEDDED tag, please consider " + "re-saving your (startup) file", + ntree->id.name, + owner_id->name); + } ntree->id.flag |= LIB_EMBEDDED_DATA; } ntree->owner_id = owner_id; |