diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-12-21 03:40:47 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-12-21 03:45:01 +0300 |
commit | 9dde3e42a7c5bc5f7896fd30e2b3a5859d6857bf (patch) | |
tree | 11a429ba243ab47e526b7a9dbae5b3527edcb0c3 /source/blender/draw/engines/workbench | |
parent | c8dfe763e521925c59522dc0abe0539727052807 (diff) |
3D View: add object color drawing option
Has some advantages over existing options.
- Using material links color to rendering with no way to vary colors
if objects share a material.
- Random gives no control, objects may randomly have the same color,
duplicating an object often changes it's color.
Diffstat (limited to 'source/blender/draw/engines/workbench')
3 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c index 99c33697617..c3b469674d3 100644 --- a/source/blender/draw/engines/workbench/workbench_deferred.c +++ b/source/blender/draw/engines/workbench/workbench_deferred.c @@ -832,7 +832,8 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob) DRW_shgroup_call_object_add(material->shgrp, geom_array[i], ob); } } - else if (ELEM(wpd->shading.color_type, V3D_SHADING_SINGLE_COLOR, V3D_SHADING_RANDOM_COLOR)) { + else if (ELEM(wpd->shading.color_type, + V3D_SHADING_SINGLE_COLOR, V3D_SHADING_OBJECT_COLOR, V3D_SHADING_RANDOM_COLOR)) { /* Draw solid color */ material = get_or_create_material_data(vedata, ob, NULL, NULL, wpd->shading.color_type); if (is_sculpt_mode) { diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c index 7a0a5e20864..ca02cc2b5ea 100644 --- a/source/blender/draw/engines/workbench/workbench_forward.c +++ b/source/blender/draw/engines/workbench/workbench_forward.c @@ -528,7 +528,9 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob) /* Fallback from not drawn OB_TEXTURE mode or just OB_SOLID mode */ if (!is_drawn) { - if (ELEM(wpd->shading.color_type, V3D_SHADING_SINGLE_COLOR, V3D_SHADING_RANDOM_COLOR)) { + if (ELEM(wpd->shading.color_type, + V3D_SHADING_SINGLE_COLOR, V3D_SHADING_OBJECT_COLOR, V3D_SHADING_RANDOM_COLOR)) + { /* No material split needed */ struct GPUBatch *geom = DRW_cache_object_surface_get(ob); if (geom) { diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c index 5360cf3683b..faca4b401dc 100644 --- a/source/blender/draw/engines/workbench/workbench_materials.c +++ b/source/blender/draw/engines/workbench/workbench_materials.c @@ -37,6 +37,10 @@ void workbench_material_update_data(WORKBENCH_PrivateData *wpd, Object *ob, Mate hsv_to_rgb_v(hsv, data->diffuse_color); copy_v3_v3(data->base_color, data->diffuse_color); } + else if (color_type == V3D_SHADING_OBJECT_COLOR) { + copy_v3_v3(data->diffuse_color, ob->col); + copy_v3_v3(data->base_color, data->diffuse_color); + } else { /* V3D_SHADING_MATERIAL_COLOR */ if (mat) { |