Assets: Generate light preview when making light object an asset

We already supported previews for lights, just didn't actually use them
when making a light object an asset. They were only used when making the
light data itself an asset.
This commit is contained in:
Julian Eisel 2021-11-22 21:02:46 +01:00
parent 34615cd269
commit 481f032f5c
Notes: blender-bot 2023-02-14 10:35:28 +01:00
Referenced by commit 03c9563582, Fix T93431: Crash when empty is marked as asset
Referenced by issue #93431, Asset Browser: Crash on add Empty or collection instance
1 changed files with 8 additions and 0 deletions

View File

@ -2041,6 +2041,14 @@ void UI_icon_render_id(
return;
}
/* For objects, first try if a preview can created via the object data. */
if (GS(id->name) == ID_OB) {
Object *ob = (Object *)id;
if (ED_preview_id_is_supported(ob->data)) {
id = ob->data;
}
}
if (!ED_preview_id_is_supported(id)) {
return;
}