Fix T41128: Box selection bug with armatures.

Calling `glLoadName()` was possible with '-1' value (65535 actually), in `draw_pose_bones()`...

Note I think bug exists since ages (at least, seems to be already present in 2008
when drawarmature.c was added in repo)!

Odd behavior reported (issue only affected objects once parented to the armature) was
due to ordering stuff, since only objects drawn *after* the armature were affected.
This commit is contained in:
Bastien Montagne 2014-07-21 15:49:16 +02:00
parent a7d8f602a6
commit 6a43ee6e38
Notes: blender-bot 2023-02-14 10:18:57 +01:00
Referenced by issue #41128, Box selection bug with armatures
1 changed files with 2 additions and 2 deletions

View File

@ -1815,7 +1815,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
/* very very confusing... but in object mode, solid draw, we cannot do glLoadName yet,
* stick bones and/or wire custom-shapes are drawn in next loop
*/
if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) == 0 && (draw_wire == false)) {
if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) == 0 && (draw_wire == false) && index != -1) {
/* object tag, for bordersel optim */
glLoadName(index & 0xFFFF);
index = -1;
@ -1881,7 +1881,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
index += 0x10000; /* pose bones count in higher 2 bytes only */
}
/* stick or wire bones have not been drawn yet so don't clear object selection in this case */
if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) == 0 && draw_wire) {
if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) == 0 && draw_wire && index != -1) {
/* object tag, for bordersel optim */
glLoadName(index & 0xFFFF);
index = -1;