Fix #20374: Limit selection to visible would not work anymore after trying to
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 17 Dec 2009 14:38:30 +0000 (14:38 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 17 Dec 2009 14:38:30 +0000 (14:38 +0000)
select once but not selecting correctly, due the need backbuffer flag not being
reset correctly in the 3d view.

source/blender/blenloader/intern/readfile.c
source/blender/editors/mesh/editface.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/makesdna/DNA_view3d_types.h
source/blender/windowmanager/intern/wm_draw.c

index 2631a1aa219663da2ef88228de64ad753da5fbae..232af442a854205ea001b73055258737a2779324 100644 (file)
@@ -5059,6 +5059,7 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
                        if (sl->spacetype==SPACE_VIEW3D) {
                                View3D *v3d= (View3D*) sl;
                                v3d->bgpic= newdataadr(fd, v3d->bgpic);
+                               v3d->flag |= V3D_INVALID_BACKBUF;
                                if(v3d->bgpic)
                                        v3d->bgpic->iuser.ok= 1;
                                if(v3d->gpd) {
index d7df018acd7802b78f151e1d8d73e0a4c7e18fdc..0e1ac1aa7e8a46538a3313198c5bf7daf060d1b4 100644 (file)
@@ -127,7 +127,7 @@ int facesel_face_pick(struct bContext *C, Mesh *me, short *mval, unsigned int *i
        if (!me || me->totface==0)
                return 0;
 
-// XXX         if (v3d->flag & V3D_NEEDBACKBUFDRAW) {
+// XXX         if (v3d->flag & V3D_INVALID_BACKBUF) {
 // XXX drawview.c!             check_backbuf();
 // XXX         persp(PERSP_VIEW);
 // XXX         }
index 19667beaaf98292e8f486613b61c8fa9515e9e5d..a680a3bd40d4d550c2b095f01c3f0739d21bd673 100644 (file)
@@ -1113,11 +1113,11 @@ void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
        else if((base && (base->object->mode & OB_MODE_PARTICLE_EDIT)) && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT));
        else if(scene->obedit && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT));
        else {
-               v3d->flag &= ~V3D_NEEDBACKBUFDRAW;
+               v3d->flag &= ~V3D_INVALID_BACKBUF;
                return;
        }
 
-       if( !(v3d->flag & V3D_NEEDBACKBUFDRAW) ) return;
+       if( !(v3d->flag & V3D_INVALID_BACKBUF) ) return;
 
 //     if(test) {
 //             if(qtest()) {
@@ -1162,7 +1162,7 @@ void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
                draw_object_backbufsel(scene, v3d, rv3d, base->object);
        }
 
-       v3d->flag &= ~V3D_NEEDBACKBUFDRAW;
+       v3d->flag &= ~V3D_INVALID_BACKBUF;
 
        G.f &= ~G_BACKBUFSEL;
        v3d->zbuf= FALSE; 
@@ -1183,7 +1183,7 @@ void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
 
 void view3d_validate_backbuf(ViewContext *vc)
 {
-       if(vc->v3d->flag & V3D_NEEDBACKBUFDRAW)
+       if(vc->v3d->flag & V3D_INVALID_BACKBUF)
                backdrawview3d(vc->scene, vc->ar, vc->v3d);
 }
 
@@ -2188,24 +2188,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
        
        /* XXX here was the blockhandlers for floating panels */
 
-       if(ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)) {
-               v3d->flag |= V3D_NEEDBACKBUFDRAW;
-               // XXX addafterqueue(ar->win, BACKBUFDRAW, 1);
-       }
-
-       if((ob && ob->mode & OB_MODE_PARTICLE_EDIT) && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT)) {
-               v3d->flag |= V3D_NEEDBACKBUFDRAW;
-               // XXX addafterqueue(ar->win, BACKBUFDRAW, 1);
-       }
-
-       // test for backbuf select
-       if(scene->obedit && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT)) {
-               
-               v3d->flag |= V3D_NEEDBACKBUFDRAW;
-               // XXX if(afterqtest(ar->win, BACKBUFDRAW)==0) {
-               //      addafterqueue(ar->win, BACKBUFDRAW, 1);
-               //}
-       }
+       v3d->flag |= V3D_INVALID_BACKBUF;
 }
 
 
index d8a8ec063d02c9f688de451310078f81b37e9087..5326c17688dbefe4a64356b328c62a02a91200c3 100644 (file)
@@ -190,7 +190,7 @@ typedef struct View3D {
 #define V3D_DISPIMAGE          1
 #define V3D_DISPBGPIC          2
 #define V3D_HIDE_HELPLINES     4
-#define V3D_NEEDBACKBUFDRAW    8
+#define V3D_INVALID_BACKBUF    8
 #define V3D_EDITMODE           16
 #define V3D_VERTEXPAINT                32
 #define V3D_FACESELECT         64
index 3335efeb16685c98c37fdfd7b7de7969893598aa..b9e6ca2d28153652e89c110ce43b1efa5f2630f6 100644 (file)
@@ -34,6 +34,7 @@
 #include "DNA_screen_types.h"
 #include "DNA_windowmanager_types.h"
 #include "DNA_userdef_types.h"
+#include "DNA_view3d_types.h"
 
 #include "MEM_guardedalloc.h"
 
@@ -90,6 +91,12 @@ static void wm_paintcursor_draw(bContext *C, ARegion *ar)
        }
 }
 
+static void wm_area_mark_invalid_backbuf(ScrArea *sa)
+{
+       if(sa->spacetype == SPACE_VIEW3D)
+               ((View3D*)sa->spacedata.first)->flag |= V3D_INVALID_BACKBUF;
+}
+
 /********************** draw all **************************/
 /* - reference method, draw all each time                 */
 
@@ -113,6 +120,7 @@ static void wm_method_draw_full(bContext *C, wmWindow *win)
                        }
                }
                
+               wm_area_mark_invalid_backbuf(sa);
                CTX_wm_area_set(C, NULL);
        }
 
@@ -230,6 +238,7 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win)
                        }
                }
                
+               wm_area_mark_invalid_backbuf(sa);
                CTX_wm_area_set(C, NULL);
        }
 
@@ -553,6 +562,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
                        }
                }
                
+               wm_area_mark_invalid_backbuf(sa);
                CTX_wm_area_set(C, NULL);
        }