diff options
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/intern/draw_pbvh.cc | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/source/blender/draw/intern/draw_pbvh.cc b/source/blender/draw/intern/draw_pbvh.cc index 4170285e1d9..6b807222079 100644 --- a/source/blender/draw/intern/draw_pbvh.cc +++ b/source/blender/draw/intern/draw_pbvh.cc @@ -860,10 +860,30 @@ struct PBVHBatches { const char *prefix = "a"; if (ELEM(type, CD_PROP_COLOR, CD_PROP_BYTE_COLOR)) { + Mesh query_mesh; + + /* Check if we have args->me; if not use get_cdata to build something we + * can query for color attributes. + */ + if (args->me) { + memcpy(static_cast<void *>(&query_mesh), + static_cast<const void *>(args->me), + sizeof(Mesh)); + } + else { + BKE_id_attribute_copy_domains_temp(ID_ME, + get_cdata(ATTR_DOMAIN_POINT, args), + nullptr, + get_cdata(ATTR_DOMAIN_CORNER, args), + nullptr, + nullptr, + &query_mesh.id); + } + prefix = "c"; - CustomDataLayer *render = BKE_id_attributes_render_color_get(&args->me->id); - CustomDataLayer *active = BKE_id_attributes_active_color_get(&args->me->id); + CustomDataLayer *render = BKE_id_attributes_render_color_get(&query_mesh.id); + CustomDataLayer *active = BKE_id_attributes_active_color_get(&query_mesh.id); is_render = render && layer && STREQ(render->name, layer->name); is_active = active && layer && STREQ(active->name, layer->name); |