[Bf-blender-cvs] [5205a0f671a] blender2.8: Fix incorrect matrix stack push/pop

Campbell Barton noreply at git.blender.org
Mon May 14 13:30:40 CEST 2018


Commit: 5205a0f671a96c548a0c9832e00e7746e5153fb8
Author: Campbell Barton
Date:   Mon May 14 13:03:04 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB5205a0f671a96c548a0c9832e00e7746e5153fb8

Fix incorrect matrix stack push/pop

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

M	source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c

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

diff --git a/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c
index a6964359595..73520d1801d 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c
@@ -127,12 +127,12 @@ static void button2d_draw_intern(
 	manipulator_color_get(mpr, highlight, color);
 	WM_manipulator_calc_matrix_final(mpr, matrix_final);
 
+	bool need_to_pop = true;
 	gpuPushMatrix();
 	gpuMultMatrix(matrix_final);
 
-	glEnable(GL_BLEND);
-
 	if (select == false) {
+		glEnable(GL_BLEND);
 		if (button->shape_batch[0] != NULL) {
 			glEnable(GL_LINE_SMOOTH);
 			glLineWidth(1.0f);
@@ -147,21 +147,22 @@ static void button2d_draw_intern(
 				GWN_batch_draw(button->shape_batch[i]);
 			}
 			glDisable(GL_LINE_SMOOTH);
-			gpuPopMatrix();
 		}
 		else if (button->icon != ICON_NONE) {
 			button2d_geom_draw_backdrop(mpr, color, select);
 			gpuPopMatrix();
+			need_to_pop = false;
 			UI_icon_draw(
 			        mpr->matrix_basis[3][0] - (ICON_DEFAULT_WIDTH / 2.0) * UI_DPI_FAC,
 			        mpr->matrix_basis[3][1] - (ICON_DEFAULT_HEIGHT / 2.0) * UI_DPI_FAC,
 			        button->icon);
 		}
-		else {
-			gpuPopMatrix();
-		}
+		glDisable(GL_BLEND);
+	}
+
+	if (need_to_pop) {
+		gpuPopMatrix();
 	}
-	glDisable(GL_BLEND);
 }
 
 static void manipulator_button2d_draw_select(const bContext *C, wmManipulator *mpr, int select_id)



More information about the Bf-blender-cvs mailing list