From 925f21342709522afa334218e97e0b31f87f1516 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Wed, 7 Mar 2012 12:48:52 +0000 Subject: Code cleanup: simplify the DerivedMesh.drawMappedFaces interface. This function pointer's 'setDrawOptions' parameter took a slightly different type than the other drawing callbacks. In particular, it could set a 'drawSmooth' value to indicate that smoothing should always be enabled, overriding the face flag. However, all callbacks either did not set this value, or set it unconditionally to 1. Replaced this by adding a new 'flag' parameter to drawFacesMapped, which can be set to DM_DRAW_ALWAYS_SMOOTH where appropriate. Also removed the 'useColors' parameter and replaced it with another flag value, DM_DRAW_USE_COLORS. Removed the 'wpaint__setSolidDrawOptions' callback, was only being used to set the shading to smooth. --- source/blender/editors/space_view3d/drawmesh.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'source/blender/editors/space_view3d/drawmesh.c') diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 9ad7a196113..fabd3f92573 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -576,7 +576,7 @@ static int draw_em_tf_mapped__set_draw(void *userData, int index) } } -static int wpaint__setSolidDrawOptions_material(void *userData, int index, int *drawSmooth_r) +static int wpaint__setSolidDrawOptions_material(void *userData, int index) { Mesh *me = (Mesh*)userData; @@ -587,17 +587,15 @@ static int wpaint__setSolidDrawOptions_material(void *userData, int index, int * } } - *drawSmooth_r = 1; return 1; } /* when face select is on, use face hidden flag */ -static int wpaint__setSolidDrawOptions_facemask(void *userData, int index, int *drawSmooth_r) +static int wpaint__setSolidDrawOptions_facemask(void *userData, int index) { Mesh *me = (Mesh*)userData; MPoly *mp = &me->mpoly[index]; if (mp->flag & ME_HIDE) return 0; - *drawSmooth_r = 1; return 1; } @@ -783,7 +781,8 @@ void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec } else if (draw_flags & DRAW_FACE_SELECT) { if (ob->mode & OB_MODE_WEIGHT_PAINT) - dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions_facemask, GPU_enable_material, NULL, me, 1); + dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions_facemask, GPU_enable_material, NULL, me, + DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH); else dm->drawMappedFacesTex(dm, me->mpoly ? draw_tface_mapped__set_draw : NULL, NULL, me); } @@ -940,10 +939,8 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o if (ob->mode & OB_MODE_WEIGHT_PAINT) { /* weight paint mode exception */ - int useColors= 1; - dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions_material, - GPU_enable_material, NULL, ob->data, useColors); + GPU_enable_material, NULL, ob->data, DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH); } else { Mesh *me= ob->data; -- cgit v1.2.3