diff options
author | Sebastian Herholz <sebastian.herholz@intel.com> | 2022-11-09 11:13:08 +0300 |
---|---|---|
committer | Sebastian Herholz <sebastian.herholz@intel.com> | 2022-11-09 11:13:08 +0300 |
commit | 98398f5a5da09955543efa47a84b51d5a03b8574 (patch) | |
tree | 2c7f0edaafa7b62fcaa4ab30583a54c8877d8221 /source/blender/blenloader/intern/readblenentry.cc | |
parent | 3e3ec87846b264a87b50431abb4180e4f0f2193c (diff) | |
parent | 638bf05a23e1ef7dddd3b5d42d9521d8849a4375 (diff) |
Merge branch 'master' into cycles_path_guidingcycles_path_guiding
Diffstat (limited to 'source/blender/blenloader/intern/readblenentry.cc')
-rw-r--r-- | source/blender/blenloader/intern/readblenentry.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readblenentry.cc b/source/blender/blenloader/intern/readblenentry.cc index 55ac2d31277..ead796c0e28 100644 --- a/source/blender/blenloader/intern/readblenentry.cc +++ b/source/blender/blenloader/intern/readblenentry.cc @@ -138,11 +138,15 @@ LinkNode *BLO_blendhandle_get_datablock_info(BlendHandle *bh, BHead *bhead; int tot = 0; + const int sdna_nr_preview_image = DNA_struct_find_nr(fd->filesdna, "PreviewImage"); + for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) { if (bhead->code == ENDB) { break; } if (bhead->code == ofblocktype) { + BHead *id_bhead = bhead; + const char *name = blo_bhead_id_name(fd, bhead) + 2; AssetMetaData *asset_meta_data = blo_bhead_id_asset_data_address(fd, bhead); @@ -165,6 +169,17 @@ LinkNode *BLO_blendhandle_get_datablock_info(BlendHandle *bh, STRNCPY(info->name, name); info->asset_data = asset_meta_data; + bool has_preview = false; + /* See if we can find a preview in the data of this ID. */ + for (BHead *data_bhead = blo_bhead_next(fd, id_bhead); data_bhead->code == DATA; + data_bhead = blo_bhead_next(fd, data_bhead)) { + if (data_bhead->SDNAnr == sdna_nr_preview_image) { + has_preview = true; + break; + } + } + info->no_preview_found = !has_preview; + BLI_linklist_prepend(&infos, info); tot++; } |