bugfix [#23830] Border selecting bones in editmode bug
authorCampbell Barton <ideasman42@gmail.com>
Wed, 15 Sep 2010 13:07:36 +0000 (13:07 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 15 Sep 2010 13:07:36 +0000 (13:07 +0000)
was missing a call to glLoadName(-1); so drawing commands after the bone were taken into account with the selection.

made some other minor changes that dont change functionality.

source/blender/editors/include/ED_armature.h
source/blender/editors/space_view3d/drawarmature.c

index 52db36e188db5f3504e076a1bd56df53b00cf0c7..5df04435abeabca02e02320c29a13fa0e79a62e6 100644 (file)
@@ -78,12 +78,12 @@ typedef struct EditBone
        short segments;
 } EditBone;
 
-#define        BONESEL_ROOT    0x10000000
-#define        BONESEL_TIP             0x20000000
-#define        BONESEL_BONE    0x40000000
+#define        BONESEL_ROOT    (1<<28)
+#define        BONESEL_TIP             (1<<29)
+#define        BONESEL_BONE    (1<<30)
 #define BONESEL_ANY            (BONESEL_TIP|BONESEL_ROOT|BONESEL_BONE)
 
-#define BONESEL_NOSEL  0x80000000      /* Indicates a negative number */
+#define BONESEL_NOSEL  (1<<31) /* Indicates a negative number */
 
 /* useful macros */
 #define EBONE_VISIBLE(arm, ebone) ((arm->layer & ebone->layer) && !(ebone->flag & BONE_HIDDEN_A))
index adff6ffdc65a227e9d60670fb6f172577d61f548..50798429801be0a954a5250894e9f9f7e1ae64fd 100644 (file)
@@ -310,7 +310,7 @@ static void drawsolidcube_size(float xsize, float ysize, float zsize)
 
        if(displist==0) {
                displist= glGenLists(1);
-               glNewList(displist, GL_COMPILE_AND_EXECUTE);
+               glNewList(displist, GL_COMPILE);
 
                glBegin(GL_QUADS);
                n[0]= -1.0;
@@ -340,19 +340,17 @@ static void drawsolidcube_size(float xsize, float ysize, float zsize)
 
                glEndList();
        }
-       else glCallList(displist);
-       
+
+       glCallList(displist);
 }
 
 static void drawcube_size(float xsize, float ysize, float zsize)
 {
        static GLuint displist=0;
        
-       glScalef(xsize, ysize, zsize);
-       
        if(displist == 0) {
                displist= glGenLists(1);
-               glNewList(displist, GL_COMPILE_AND_EXECUTE);
+               glNewList(displist, GL_COMPILE);
                
                glBegin(GL_LINE_STRIP);
                glVertex3fv(cube[0]); glVertex3fv(cube[1]);glVertex3fv(cube[2]); glVertex3fv(cube[3]);
@@ -368,7 +366,9 @@ static void drawcube_size(float xsize, float ysize, float zsize)
                
                glEndList();
        }
-       else glCallList(displist);
+
+       glScalef(xsize, ysize, zsize);
+       glCallList(displist);
        
 }
 
@@ -381,7 +381,7 @@ static void draw_bonevert(void)
                GLUquadricObj   *qobj;
                
                displist= glGenLists(1);
-               glNewList(displist, GL_COMPILE_AND_EXECUTE);
+               glNewList(displist, GL_COMPILE);
                        
                glPushMatrix();
                
@@ -400,8 +400,8 @@ static void draw_bonevert(void)
                glPopMatrix();
                glEndList();
        }
-       else 
-               glCallList(displist);
+
+       glCallList(displist);
 }
 
 static void draw_bonevert_solid(void)
@@ -412,7 +412,7 @@ static void draw_bonevert_solid(void)
                GLUquadricObj   *qobj;
                
                displist= glGenLists(1);
-               glNewList(displist, GL_COMPILE_AND_EXECUTE);
+               glNewList(displist, GL_COMPILE);
                
                qobj    = gluNewQuadric();
                gluQuadricDrawStyle(qobj, GLU_FILL); 
@@ -423,8 +423,8 @@ static void draw_bonevert_solid(void)
                
                glEndList();
        }
-       else 
-               glCallList(displist);
+
+       glCallList(displist);
 }
 
 static void draw_bone_octahedral()
@@ -435,7 +435,7 @@ static void draw_bone_octahedral()
                float vec[6][3];        
                
                displist= glGenLists(1);
-               glNewList(displist, GL_COMPILE_AND_EXECUTE);
+               glNewList(displist, GL_COMPILE);
                
                vec[0][0]= vec[0][1]= vec[0][2]= 0.0f;
                vec[5][0]= vec[5][2]= 0.0f; vec[5][1]= 1.0f;
@@ -467,8 +467,8 @@ static void draw_bone_octahedral()
                
                glEndList();
        }
-       else 
-               glCallList(displist);
+
+       glCallList(displist);
 }      
 
 static void draw_bone_solid_octahedral(void)
@@ -479,7 +479,7 @@ static void draw_bone_solid_octahedral(void)
                float vec[6][3], nor[3];        
                
                displist= glGenLists(1);
-               glNewList(displist, GL_COMPILE_AND_EXECUTE);
+               glNewList(displist, GL_COMPILE);
                
                vec[0][0]= vec[0][1]= vec[0][2]= 0.0f;
                vec[5][0]= vec[5][2]= 0.0f; vec[5][1]= 1.0f;
@@ -529,8 +529,8 @@ static void draw_bone_solid_octahedral(void)
                
                glEndList();
        }
-       else 
-               glCallList(displist);
+
+       glCallList(displist);
 }      
 
 /* *************** Armature drawing, bones ******************* */
@@ -1933,7 +1933,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
                
                if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
 
-               for (eBone=arm->edbo->first, index=0; eBone; eBone=eBone->next, index++) {
+               for (eBone=arm->edbo->first; eBone; eBone=eBone->next) {
                        if (eBone->layer & arm->layer) {
                                if ((eBone->flag & (BONE_HIDDEN_A|BONE_NO_DEFORM))==0) {
                                        if (eBone->flag & (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL))
@@ -1949,7 +1949,6 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
        
        /* if solid we draw it first */
        if ((dt > OB_WIRE) && (arm->drawtype!=ARM_LINE)) {
-               index= 0;
                for (eBone=arm->edbo->first, index=0; eBone; eBone=eBone->next, index++) {
                        if (eBone->layer & arm->layer) {
                                if ((eBone->flag & BONE_HIDDEN_A)==0) {
@@ -2043,6 +2042,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
        }
        
        /* restore */
+       if(index!=-1) glLoadName(-1);
        if (arm->drawtype==ARM_LINE);
        else if (dt>OB_WIRE) bglPolygonOffset(rv3d->dist, 0.0f);
        
@@ -2054,7 +2054,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
                        
                        if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
                        
-                       for (eBone=arm->edbo->first, index=0; eBone; eBone=eBone->next, index++) {
+                       for (eBone=arm->edbo->first; eBone; eBone=eBone->next) {
                                if(eBone->layer & arm->layer) {
                                        if ((eBone->flag & BONE_HIDDEN_A)==0) {