dont draw object centers when drawing the depth buffer, grease pencil would get its...
authorCampbell Barton <ideasman42@gmail.com>
Sun, 3 Jan 2010 01:55:20 +0000 (01:55 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 3 Jan 2010 01:55:20 +0000 (01:55 +0000)
Also fix own error with drawing grease pencil depths, wasnt setting v3d->zbuf back to its original value.

source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_draw.c

index c689b4d338fce1ab6f8e33ab5b380ba25b8f0dae..66790d9b7f08bb01452a51d180f8cd725524c492 100644 (file)
@@ -798,25 +798,28 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob)
        curcol[3]= 0.6;
        glColor4fv(curcol);
        
-       if(ob->id.us>1) {
-               if (ob==OBACT || (ob->flag & SELECT)) glColor4ub(0x88, 0xFF, 0xFF, 155);
-               else glColor4ub(0x77, 0xCC, 0xCC, 155);
-       }
-       
-       /* Inner Circle */
-       VECCOPY(vec, ob->obmat[3]);
-       glEnable(GL_BLEND);
-       drawcircball(GL_LINE_LOOP, vec, lampsize, imat);
-       glDisable(GL_BLEND);
-       drawcircball(GL_POLYGON, vec, lampsize, imat);
-       
-       /* restore */
-       if(ob->id.us>1)
-               glColor4fv(curcol);
+       if(lampsize > 0.0f) {
+
+               if(ob->id.us>1) {
+                       if (ob==OBACT || (ob->flag & SELECT)) glColor4ub(0x88, 0xFF, 0xFF, 155);
+                       else glColor4ub(0x77, 0xCC, 0xCC, 155);
+               }
+               
+               /* Inner Circle */
+               VECCOPY(vec, ob->obmat[3]);
+               glEnable(GL_BLEND);
+               drawcircball(GL_LINE_LOOP, vec, lampsize, imat);
+               glDisable(GL_BLEND);
+               drawcircball(GL_POLYGON, vec, lampsize, imat);
                
-       /* Outer circle */
-       circrad = 3.0f*lampsize;
-       drawcircball(GL_LINE_LOOP, vec, circrad, imat);
+               /* restore */
+               if(ob->id.us>1)
+                       glColor4fv(curcol);
+                       
+               /* Outer circle */
+               circrad = 3.0f*lampsize;
+               drawcircball(GL_LINE_LOOP, vec, circrad, imat);
+       }
        
        setlinestyle(3);
 
@@ -6154,7 +6157,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
                        } 
                        else if((flag & DRAW_CONSTCOLOR)==0) {
                                /* we don't draw centers for duplicators and sets */
-                               drawcentercircle(v3d, rv3d, ob->obmat[3], do_draw_center, ob->id.lib || ob->id.us>1);
+                               if(U.obcenter_dia > 0) {
+                    /* check > 0 otherwise grease pencil can draw into the circle select which is annoying. */
+                    drawcentercircle(v3d, rv3d, ob->obmat[3], do_draw_center, ob->id.lib || ob->id.us>1);
+                               }
                        }
                }
        }
index 4e9d92e8c1713e30a258fbe318d5342b81f1c967..fc0af608dce0330a808ab386cc95e0800ed8325e 100644 (file)
@@ -1645,6 +1645,7 @@ void view3d_update_depths(ARegion *ar, View3D *v3d)
 
 void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d)
 {
+       short zbuf= v3d->zbuf;
        RegionView3D *rv3d= ar->regiondata;
 
        setwinmatrixview3d(ar, v3d, NULL);      /* 0= no pick rect */
@@ -1662,7 +1663,9 @@ void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d)
        glEnable(GL_DEPTH_TEST);
 
        draw_gpencil_3dview_ext(scene, ar, 1);
-       return;
+       
+       v3d->zbuf= zbuf;
+
 }
 
 void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
@@ -1670,17 +1673,16 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
        RegionView3D *rv3d= ar->regiondata;
        Base *base;
        Scene *sce;
-       short zbuf, flag;
-       float glalphaclip;
+       short zbuf= v3d->zbuf;
+       short flag= v3d->flag;
+       float glalphaclip= U.glalphaclip;
+       int obcenter_dia= U.obcenter_dia;
        /* temp set drawtype to solid */
        
        /* Setting these temporarily is not nice */
-       zbuf = v3d->zbuf;
-       flag = v3d->flag;
-       glalphaclip = U.glalphaclip;
-       
-       U.glalphaclip = 0.5; /* not that nice but means we wont zoom into billboards */
        v3d->flag &= ~V3D_SELECT_OUTLINE;
+       U.glalphaclip = 0.5; /* not that nice but means we wont zoom into billboards */
+       U.obcenter_dia= 0;
        
        setwinmatrixview3d(ar, v3d, NULL);      /* 0= no pick rect */
        setviewmatrixview3d(scene, v3d, rv3d);  /* note: calls where_is_object for camera... */
@@ -1764,6 +1766,7 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
        v3d->zbuf = zbuf;
        U.glalphaclip = glalphaclip;
        v3d->flag = flag;
+       U.obcenter_dia= obcenter_dia;
 }
 
 typedef struct View3DShadow {