diff options
author | Julian Eisel <julian@blender.org> | 2021-11-22 22:00:47 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-11-22 23:12:36 +0300 |
commit | 34615cd269a6cd26cacbab3f10a7298fd577721d (patch) | |
tree | a5f3e7965b7557ce7229819155d9eac03a72f553 /source/blender/blenkernel | |
parent | e2b736aa406e3e87a839d2f96ac9a1718ec253e3 (diff) |
Fix grayed out preview generation button for light objects
Mistake in e7bea3fb6ed0.
We should only skip preview generation for objects that don't support
preview rendering, not completely forbid accessing preview data of such
IDs.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/icons.cc | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/source/blender/blenkernel/intern/icons.cc b/source/blender/blenkernel/intern/icons.cc index f820b345c59..9cf289935ab 100644 --- a/source/blender/blenkernel/intern/icons.cc +++ b/source/blender/blenkernel/intern/icons.cc @@ -359,30 +359,22 @@ void BKE_previewimg_id_copy(ID *new_id, const ID *old_id) PreviewImage **BKE_previewimg_id_get_p(const ID *id) { switch (GS(id->name)) { - case ID_OB: { - Object *ob = (Object *)id; - /* Currently, only object types with real geometry can be rendered as preview. */ - if (!OB_TYPE_IS_GEOMETRY(ob->type)) { - return nullptr; - } - return &ob->preview; - } - #define ID_PRV_CASE(id_code, id_struct) \ case id_code: { \ return &((id_struct *)id)->preview; \ } \ ((void)0) - ID_PRV_CASE(ID_MA, Material); - ID_PRV_CASE(ID_TE, Tex); - ID_PRV_CASE(ID_WO, World); - ID_PRV_CASE(ID_LA, Light); - ID_PRV_CASE(ID_IM, Image); - ID_PRV_CASE(ID_BR, Brush); - ID_PRV_CASE(ID_GR, Collection); - ID_PRV_CASE(ID_SCE, Scene); - ID_PRV_CASE(ID_SCR, bScreen); - ID_PRV_CASE(ID_AC, bAction); + ID_PRV_CASE(ID_OB, Object); + ID_PRV_CASE(ID_MA, Material); + ID_PRV_CASE(ID_TE, Tex); + ID_PRV_CASE(ID_WO, World); + ID_PRV_CASE(ID_LA, Light); + ID_PRV_CASE(ID_IM, Image); + ID_PRV_CASE(ID_BR, Brush); + ID_PRV_CASE(ID_GR, Collection); + ID_PRV_CASE(ID_SCE, Scene); + ID_PRV_CASE(ID_SCR, bScreen); + ID_PRV_CASE(ID_AC, bAction); #undef ID_PRV_CASE default: break; |