[Bf-blender-cvs] [69bf7a4] master: Fix armature stick draw, unpack-alignment was set but never restored

Campbell Barton noreply at git.blender.org
Wed Jun 8 21:55:59 CEST 2016


Commit: 69bf7a44aac3e9a66b69fa1a93f7a5a04f360e5c
Author: Campbell Barton
Date:   Thu Jun 9 04:53:04 2016 +1000
Branches: master
https://developer.blender.org/rB69bf7a44aac3e9a66b69fa1a93f7a5a04f360e5c

Fix armature stick draw, unpack-alignment was set but never restored

Drawing a single stick bone set the alignment to 1, applying this setting to the rest of Blender.

===================================================================

M	source/blender/editors/space_view3d/drawarmature.c

===================================================================

diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index f7c1e2e..1306e83 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -986,10 +986,11 @@ static GLubyte bm_dot7[] = {0x0, 0x38, 0x7C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38};
 static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned int id,
                            bPoseChannel *pchan, EditBone *ebone)
 {
+	/* call this once, avoid constant changing */
+	BLI_assert(glaGetOneInt(GL_UNPACK_ALIGNMENT) == 1);
+
 	float length;
 	
-	glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-	
 	if (pchan) 
 		length = pchan->bone->length;
 	else 
@@ -2699,6 +2700,11 @@ bool draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 	if (v3d->flag2 & V3D_RENDER_OVERRIDE)
 		return true;
 
+	/* needed for 'draw_line_bone' which draws pixel. */
+	if (arm->drawtype == ARM_LINE) {
+		glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+	}
+
 	if (dt > OB_WIRE) {
 		/* we use color for solid lighting */
 		if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) {
@@ -2774,5 +2780,9 @@ bool draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 	/* restore */
 	glFrontFace(GL_CCW);
 
+	if (arm->drawtype == ARM_LINE) {
+		glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+	}
+
 	return retval;
 }




More information about the Bf-blender-cvs mailing list