fix for crash drawing weights in lattice editmode.
authorCampbell Barton <ideasman42@gmail.com>
Wed, 21 Apr 2010 14:46:32 +0000 (14:46 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 21 Apr 2010 14:46:32 +0000 (14:46 +0000)
source/blender/editors/space_view3d/drawobject.c

index d47992810f3c8990d45c3dadd73346baa388abd8..cc3b572835afbdc0693ffb2b91458747949685a9 100644 (file)
@@ -1405,14 +1405,16 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob)
        Lattice *lt= ob->data;
        DispList *dl;
        int u, v, w;
-       int use_wcol= 0;
+       int use_wcol= 0, is_edit= (lt->editlatt != NULL);
 
        /* now we default make displist, this will modifiers work for non animated case */
        if(ob->disp.first==NULL)
                lattice_calc_modifiers(scene, ob);
        dl= find_displist(&ob->disp, DL_VERTS);
        
-       if(lt->editlatt) {
+       if(is_edit) {
+               lt= lt->editlatt;
+
                cpack(0x004000);
                
                if(ob->defbase.first && lt->dvert) {
@@ -1421,8 +1423,6 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob)
                }
        }
        
-       if(lt->editlatt) lt= lt->editlatt;
-       
        glBegin(GL_LINES);
        for(w=0; w<lt->pntsw; w++) {
                int wxt = (w==0 || w==lt->pntsw-1);
@@ -1452,7 +1452,7 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob)
        if(use_wcol)
                glShadeModel(GL_FLAT);
 
-       if( ((Lattice *)ob->data)->editlatt ) {
+       if(is_edit) {
                if(v3d->zbuf) glDisable(GL_DEPTH_TEST);
                
                lattice_draw_verts(lt, dl, 0);