From 3de5fbba3a984fab1a3f69fea3a62e620f55d4b7 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Thu, 4 Mar 2021 15:27:33 +0100 Subject: Fix T86050: use material count from correct data block See comment in code for more details. Differential Revision: https://developer.blender.org/D10615 --- source/blender/draw/intern/draw_cache.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index fcd626eb92b..f902a95a19a 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -935,8 +935,15 @@ GPUVertBuf *DRW_cache_object_pos_vertbuf_get(Object *ob) int DRW_cache_object_material_count_get(struct Object *ob) { + short type = ob->type; + Mesh *me = BKE_object_get_evaluated_mesh(ob); - short type = (me != NULL) ? OB_MESH : ob->type; + if (me != NULL && type != OB_POINTCLOUD) { + /* Some object types (e.g. curves) can have a Curve in ob->data, but will be rendered as mesh. + * For point clouds this never happens. Ideally this check would happen at another level and we + * would just have to care about ob->data here. */ + type = OB_MESH; + } switch (type) { case OB_MESH: -- cgit v1.2.3