[Bf-blender-cvs] [9fe19437e9f] blender2.8: Getting rid of setlinestyle: markers' dashed line in VSE.

Bastien Montagne noreply at git.blender.org
Fri Apr 28 19:23:03 CEST 2017


Commit: 9fe19437e9fd664bce9fefd9bdd1a85c48a99d16
Author: Bastien Montagne
Date:   Thu Apr 27 15:49:10 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB9fe19437e9fd664bce9fefd9bdd1a85c48a99d16

Getting rid of setlinestyle: markers' dashed line in VSE.

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

M	source/blender/editors/animation/anim_markers.c

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

diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 9273ae11906..dcf52404a88 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -351,22 +351,31 @@ static void draw_marker(
 	if (flag & DRAW_MARKERS_LINES)
 #endif
 	{
-		unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
-		immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
-		setlinestyle(3);
-		
+		VertexFormat *format = immVertexFormat();
+		uint pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+		uint line_origin = VertexFormat_add_attrib(format, "line_origin", COMP_F32, 2, KEEP_FLOAT);
+
+		immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
+
+		float viewport_size[4];
+		glGetFloatv(GL_VIEWPORT, viewport_size);
+		immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
+
 		if (marker->flag & SELECT) {
-			immUniformColor4ub(255, 255, 255, 96);
+			immUniform4f("color1", 1.0f, 1.0f, 1.0f, 0.38f);
 		}
 		else {
-			immUniformColor4ub(0, 0, 0, 96);
+			immUniform4f("color1", 0.0f, 0.0f, 0.0f, 0.38f);
 		}
+		immUniform4f("color2", 0.0f, 0.0f, 0.0f, 0.0f);
+		immUniform1f("dash_width", 6.0f);
+		immUniform1f("dash_width_on", 3.0f);
 
 		immBegin(PRIM_LINES, 2);
+		immAttrib2f(line_origin, xpos + 0.5f, 12.0f);
 		immVertex2f(pos, xpos + 0.5f, 12.0f);
 		immVertex2f(pos, xpos + 0.5f, (v2d->cur.ymax + 12.0f) * yscale);
 		immEnd();
-		setlinestyle(0);
 
 		immUnbindProgram();
 	}




More information about the Bf-blender-cvs mailing list