diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-02-02 08:06:45 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-02-02 08:48:44 +0300 |
commit | 9afab7098519e5044664580dc1c3117918549383 (patch) | |
tree | 4f71ad11dde897d8936cfff3351dfbe8347a7d4d /source | |
parent | 3b92a9472c4cee8df98eb79e6be6b2f8b14c8b59 (diff) |
Partial Fix T47221: Sculpt Hide fails w/ texture drawing
Support for skipping hidden faces in sculpt mode w/ texture drawing.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawmesh.c | 65 |
2 files changed, 46 insertions, 27 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 90269724db6..0d3848f9787 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -498,7 +498,8 @@ static void cdDM_drawFacesTex_common( const MLoopCol *mloopcol; int i; int colType, start_element, tot_drawn; - bool use_tface = (uvflag & DM_DRAW_USE_ACTIVE_UV) != 0; + const bool use_hide = (uvflag & DM_DRAW_SKIP_HIDDEN) != 0; + const bool use_tface = (uvflag & DM_DRAW_USE_ACTIVE_UV) != 0; int totpoly; int next_actualFace; int mat_index; @@ -570,7 +571,10 @@ static void cdDM_drawFacesTex_common( if (i != totpoly - 1) next_actualFace = bufmat->polys[i + 1]; - if (drawParams) { + if (use_hide && (mpoly[actualFace].flag & ME_HIDE)) { + draw_option = DM_DRAW_OPTION_SKIP; + } + else if (drawParams) { MTexPoly *tp = use_tface && mtexpoly ? &mtexpoly[actualFace] : NULL; draw_option = drawParams(tp, (mloopcol != NULL), mpoly[actualFace].mat_nr); } diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 11ba6fb709b..5ded3a9518d 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -942,7 +942,6 @@ static void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d Object *ob, DerivedMesh *dm, const int draw_flags) { Mesh *me = ob->data; - DMDrawFlag uvflag = DM_DRAW_USE_ACTIVE_UV; /* correct for negative scale */ if (ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW); @@ -953,10 +952,6 @@ static void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - if (ob->mode & OB_MODE_TEXTURE_PAINT) { - uvflag = DM_DRAW_USE_TEXPAINT_UV; - } - if (ob->mode & OB_MODE_EDIT) { drawEMTFMapped_userData data; @@ -969,34 +964,54 @@ static void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, compareDrawOptionsEm, &data, 0); } - else if (draw_flags & DRAW_FACE_SELECT) { - if (ob->mode & OB_MODE_WEIGHT_PAINT) - dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions_facemask, GPU_object_material_bind, NULL, me, - DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH | DM_DRAW_SKIP_HIDDEN); + else if ((draw_flags & DRAW_FACE_SELECT) && + (ob->mode & OB_MODE_WEIGHT_PAINT)) + { + dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions_facemask, GPU_object_material_bind, NULL, me, + DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH | DM_DRAW_SKIP_HIDDEN); + } + else { + DMDrawFlag uvflag; + drawTFace_userData userData; + + if (ob->mode & OB_MODE_TEXTURE_PAINT) { + uvflag = DM_DRAW_USE_TEXPAINT_UV; + } else { - drawTFace_userData userData; + uvflag = DM_DRAW_USE_ACTIVE_UV; + } - userData.mpoly = DM_get_poly_data_layer(dm, CD_MPOLY); - userData.mtexpoly = DM_get_poly_data_layer(dm, CD_MTEXPOLY); - userData.me = me; - dm->drawMappedFacesTex(dm, me->mpoly ? draw_tface_mapped__set_draw : NULL, compareDrawOptions, &userData, uvflag); + if ((ob->mode & OB_MODE_SCULPT) && (ob == OBACT)) { + uvflag |= DM_DRAW_SKIP_HIDDEN; } - } - else { - drawTFace_userData userData; - - update_tface_color_layer(dm, !(ob->mode & OB_MODE_TEXTURE_PAINT)); - + + userData.mpoly = DM_get_poly_data_layer(dm, CD_MPOLY); userData.mtexpoly = DM_get_poly_data_layer(dm, CD_MTEXPOLY); - userData.me = NULL; - - dm->drawFacesTex(dm, draw_tface__set_draw, compareDrawOptions, &userData, uvflag); + + if (draw_flags & DRAW_FACE_SELECT) { + userData.me = me; + + dm->drawMappedFacesTex( + dm, me->mpoly ? draw_tface_mapped__set_draw : NULL, compareDrawOptions, + &userData, uvflag); + } + else { + userData.me = NULL; + + update_tface_color_layer(dm, !(ob->mode & OB_MODE_TEXTURE_PAINT)); + dm->drawFacesTex( + dm, draw_tface__set_draw, compareDrawOptions, + &userData, uvflag); + } } /* draw game engine text hack */ - if (BKE_bproperty_object_get(ob, "Text")) - draw_mesh_text(scene, ob, 0); + if (rv3d->rflag & RV3D_IS_GAME_ENGINE) { + if (BKE_bproperty_object_get(ob, "Text")) { + draw_mesh_text(scene, ob, 0); + } + } draw_textured_end(); |