Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/src/editarmature.c4
-rw-r--r--source/blender/src/editview.c12
-rw-r--r--source/blender/src/view.c9
3 files changed, 15 insertions, 10 deletions
diff --git a/source/blender/src/editarmature.c b/source/blender/src/editarmature.c
index 5c9664d4148..e52a61b1b19 100644
--- a/source/blender/src/editarmature.c
+++ b/source/blender/src/editarmature.c
@@ -708,7 +708,7 @@ static void *get_nearest_bone (short findunsel)
glInitNames();
hits= view3d_opengl_select(buffer, MAXPICKBUF, 0, 0, 0, 0);
- if (hits)
+ if (hits>0)
return get_bone_from_selectbuffer(BASACT, buffer, hits, findunsel);
return NULL;
@@ -951,7 +951,7 @@ static EditBone * get_nearest_editbonepoint (int findunsel, int *selmask)
hits= view3d_opengl_select(buffer, MAXPICKBUF, mval[0]-12, mval[1]-12, mval[0]+12, mval[1]+12);
/* See if there are any selected bones in this group */
- if (hits) {
+ if (hits>0) {
if(hits==1) {
if (!(buffer[3] & BONESEL_NOSEL))
diff --git a/source/blender/src/editview.c b/source/blender/src/editview.c
index 225854b1fff..29e08dce7b1 100644
--- a/source/blender/src/editview.c
+++ b/source/blender/src/editview.c
@@ -1220,17 +1220,17 @@ static short mixed_bones_object_selectbuffer(unsigned int *buffer, short *mval)
short has_bones15=0, has_bones9=0, has_bones5=0;
hits15= view3d_opengl_select(buffer, MAXPICKBUF, mval[0]-14, mval[1]-14, mval[0]+14, mval[1]+14);
- if(hits15) {
+ if(hits15>0) {
for(a=0; a<hits15; a++) if(buffer[4*a+3] & 0xFFFF0000) has_bones15= 1;
offs= 4*hits15;
hits9= view3d_opengl_select(buffer+offs, MAXPICKBUF-offs, mval[0]-9, mval[1]-9, mval[0]+9, mval[1]+9);
- if(hits9) {
+ if(hits9>0) {
for(a=0; a<hits9; a++) if(buffer[offs+4*a+3] & 0xFFFF0000) has_bones9= 1;
offs+= 4*hits9;
hits5= view3d_opengl_select(buffer+offs, MAXPICKBUF-offs, mval[0]-5, mval[1]-5, mval[0]+5, mval[1]+5);
- if(hits5) {
+ if(hits5>0) {
for(a=0; a<hits5; a++) if(buffer[offs+4*a+3] & 0xFFFF0000) has_bones5= 1;
}
}
@@ -1249,12 +1249,12 @@ static short mixed_bones_object_selectbuffer(unsigned int *buffer, short *mval)
return hits15;
}
- if(hits5) {
+ if(hits5>0) {
offs= 4*hits15 + 4*hits9;
memcpy(buffer, buffer+offs, 4*offs);
return hits5;
}
- if(hits9) {
+ if(hits9>0) {
offs= 4*hits15;
memcpy(buffer, buffer+offs, 4*offs);
return hits9;
@@ -1789,7 +1789,7 @@ void borderselect(void)
does it incorrectly.
*/
- if (hits) { /* no need to loop if there's no hit */
+ if (hits>0) { /* no need to loop if there's no hit */
base= FIRSTBASE;
col = vbuffer + 3;
while(base && hits) {
diff --git a/source/blender/src/view.c b/source/blender/src/view.c
index 56166037e7f..3e052dde07c 100644
--- a/source/blender/src/view.c
+++ b/source/blender/src/view.c
@@ -1026,6 +1026,10 @@ void setcameratoview3d(void)
}
/* IGLuint-> GLuint*/
+/* Warning: be sure to account for a negative return value
+ * This is an error, "Too many objects in select buffer"
+ * and no action should be taken (can crash blender) if this happens
+ */
short view3d_opengl_select(unsigned int *buffer, unsigned int bufsize, short x1, short y1, short x2, short y2)
{
rctf rect;
@@ -1113,7 +1117,6 @@ short view3d_opengl_select(unsigned int *buffer, unsigned int bufsize, short x1
glPopName(); /* see above (pushname) */
hits= glRenderMode(GL_RENDER);
- if(hits<0) error("Too many objects in select buffer");
G.f &= ~G_PICKSEL;
setwinmatrixview3d(curarea->winx, curarea->winy, NULL);
@@ -1127,7 +1130,9 @@ short view3d_opengl_select(unsigned int *buffer, unsigned int bufsize, short x1
if(G.vd->flag & V3D_CLIPPING)
view3d_clr_clipping();
-
+
+ if(hits<0) error("Too many objects in select buffer");
+
return hits;
}