diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-04-02 18:33:47 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-04-03 01:39:42 +0400 |
commit | 03bd418d1610da28258d361180f6eae2d8be671c (patch) | |
tree | a5a40d8e533f2be067ed2c526f6c1858be306fb1 /source/blender/blenkernel | |
parent | a58814acf5567207478b030d1dafa6ad65b67496 (diff) |
Fix T39517,
Issue here is that "show diffuse" option does not respect its intended
purpose which is to be used only for masking.
There are a couple of caveats here:
Dyntopo and multires -always- have mask data enabled, and thus as soon
as one goes to dyntopo mode or adds a multires modifier he would get the
default grey color instead.
Matcaps would break when nodes asked for a diffuse material color (this
was broken before too). Solved by adding global material state for when
matcaps are enabled. Also matcaps don't always played well with VBOs
off.
Added a few more missing updates for mask operators to notify
show_diffuse property as changed. This was also needed on rebuilding
dyntopo pbvh.
Also make zero mask color duller again after artist feedback.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pbvh.c | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index cd624cf584c..b38e0e0527a 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -270,6 +270,8 @@ static PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm) BKE_pbvh_build_bmesh(cddm->pbvh, ob->sculpt->bm, ob->sculpt->bm_smooth_shading, ob->sculpt->bm_log); + + pbvh_show_diffuse_color_set(cddm->pbvh, ob->sculpt->show_diffuse_color); } diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 40974d7d4f8..c595ee56633 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -1925,5 +1925,20 @@ void pbvh_vertex_iter_init(PBVH *bvh, PBVHNode *node, void pbvh_show_diffuse_color_set(PBVH *bvh, bool show_diffuse_color) { - bvh->show_diffuse_color = show_diffuse_color; + bool has_mask = false; + + switch (bvh->type) { + case PBVH_GRIDS: + has_mask = (bvh->gridkey.has_mask != 0); + break; + case PBVH_FACES: + has_mask = (bvh->vdata && CustomData_get_layer(bvh->vdata, + CD_PAINT_MASK)); + break; + case PBVH_BMESH: + has_mask = (bvh->bm && (CustomData_get_offset(&bvh->bm->vdata, CD_PAINT_MASK) != -1)); + break; + } + + bvh->show_diffuse_color = !has_mask || show_diffuse_color; } |