From 8c6350f9262581fe405020449f6a8d06a2a9aaa0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 14 Nov 2012 14:47:45 +0000 Subject: fix [#33169] Interface destroyed after Text Object Edit --- source/blender/editors/space_view3d/drawobject.c | 61 +++++++++++++++--------- 1 file changed, 39 insertions(+), 22 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index f100f003ff5..729f810eb87 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -3600,9 +3600,12 @@ static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, B return 0; } -/* returns 1 when nothing was drawn */ -static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, - const short dt, const short dflag, const unsigned char ob_wire_col[4]) +/** + * Only called by #drawDispList + * \return 1 when nothing was drawn + */ +static int drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, + const short dt, const short dflag, const unsigned char ob_wire_col[4]) { Object *ob = base->object; ListBase *lb = NULL; @@ -3610,20 +3613,9 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas Curve *cu; const short render_only = (v3d->flag2 & V3D_RENDER_OVERRIDE); const short solid = (dt > OB_WIRE); - int retval = 0; - - /* backface culling */ - if (v3d->flag2 & V3D_BACKFACE_CULLING) { - /* not all displists use same in/out normal direction convention */ - glEnable(GL_CULL_FACE); - glCullFace((ob->type == OB_MBALL) ? GL_BACK : GL_FRONT); - } if (drawCurveDerivedMesh(scene, v3d, rv3d, base, dt) == 0) { - if (v3d->flag2 & V3D_BACKFACE_CULLING) - glDisable(GL_CULL_FACE); - - return 0; + return FALSE; } switch (ob->type) { @@ -3635,7 +3627,9 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas if (solid) { dl = lb->first; - if (dl == NULL) return 1; + if (dl == NULL) { + return TRUE; + } if (dl->nors == NULL) BKE_displist_normals_add(lb); index3_nors_incr = 0; @@ -3669,9 +3663,11 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas } else { if (!render_only || (render_only && BKE_displist_has_faces(lb))) { + int retval; draw_index_wire = 0; retval = drawDispListwire(lb); draw_index_wire = 1; + return retval; } } break; @@ -3681,7 +3677,9 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas if (solid) { dl = lb->first; - if (dl == NULL) return 1; + if (dl == NULL) { + return TRUE; + } if (dl->nors == NULL) BKE_displist_normals_add(lb); @@ -3697,7 +3695,7 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas } } else { - retval = drawDispListwire(lb); + return drawDispListwire(lb); } break; case OB_MBALL: @@ -3705,7 +3703,9 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas if (BKE_mball_is_basis(ob)) { lb = &ob->disp; if (lb->first == NULL) BKE_displist_make_mball(scene, ob); - if (lb->first == NULL) return 1; + if (lb->first == NULL) { + return TRUE; + } if (solid) { @@ -3722,14 +3722,31 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas } else { /* MetaBalls use DL_INDEX4 type of DispList */ - retval = drawDispListwire(lb); + return drawDispListwire(lb); } } break; } - - if (v3d->flag2 & V3D_BACKFACE_CULLING) + + return FALSE; +} +static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, + const short dt, const short dflag, const unsigned char ob_wire_col[4]) +{ + int retval; + + /* backface culling */ + if (v3d->flag2 & V3D_BACKFACE_CULLING) { + /* not all displists use same in/out normal direction convention */ + glEnable(GL_CULL_FACE); + glCullFace((base->object->type == OB_MBALL) ? GL_BACK : GL_FRONT); + } + + retval = drawDispList_nobackface(scene, v3d, rv3d, base, dt, dflag, ob_wire_col); + + if (v3d->flag2 & V3D_BACKFACE_CULLING) { glDisable(GL_CULL_FACE); + } return retval; } -- cgit v1.2.3