Fix T86050: use material count from correct data block

See comment in code for more details.

Differential Revision: https://developer.blender.org/D10615
This commit is contained in:
Jacques Lucke
2021-03-04 15:27:33 +01:00
parent a988099ee4
commit 3de5fbba3a

View File

@@ -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: