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:
Diffstat (limited to 'source/blender/editors/space_nla/nla_draw.c')
-rw-r--r--source/blender/editors/space_nla/nla_draw.c64
1 files changed, 18 insertions, 46 deletions
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 8121bfe9dc8..623646040d8 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -121,6 +121,8 @@ static void nla_action_draw_keyframes(AnimData *adt, bAction *act, float y, floa
VertexFormat *format = immVertexFormat();
unsigned int pos_id = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+
immUniformColor4fv(color);
/* - draw a rect from the first to the last frame (no extra overlaps for now)
@@ -175,67 +177,37 @@ static void nla_actionclip_draw_markers(NlaStrip *strip, float yminc, float ymax
if (!(act && act->markers.first))
return;
- float color[4];
- UI_GetThemeColorShade4fv(TH_STRIP_SELECT, shade, color);
-
+ const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
if (dashed) {
- VertexFormat *format = immVertexFormat();
- const uint shdr_dashed_pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- const uint shdr_dashed_origin = VertexFormat_add_attrib(format, "line_origin", COMP_F32, 2, KEEP_FLOAT);
-
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
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);
- immUniform4fv("color1", color);
- immUniform4f("color2", 0.0f, 0.0f, 0.0f, 0.0f);
+ immUniform1i("num_colors", 0); /* "simple" mode */
immUniform1f("dash_width", 6.0f);
- immUniform1f("dash_width_on", 3.0f);
-
- immBeginAtMost(PRIM_LINES, BLI_listbase_count(&act->markers) * 2);
- for (TimeMarker *marker = act->markers.first; marker; marker = marker->next) {
- if ((marker->frame > strip->actstart) && (marker->frame < strip->actend)) {
- float frame = nlastrip_get_frame(strip, marker->frame, NLATIME_CONVERT_MAP);
-
- /* just a simple line for now */
- /* XXX: draw a triangle instead... */
- immAttrib2f(shdr_dashed_origin, frame, yminc + 1);
- immVertex2f(shdr_dashed_pos, frame, yminc + 1);
- immVertex2f(shdr_dashed_pos, frame, ymaxc - 1);
- }
- }
- immEnd();
-
- immUnbindProgram();
-
- glDisable(GL_BLEND);
+ immUniform1f("dash_factor", 0.5f);
}
else {
- const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+ }
+ immUniformThemeColorShade(TH_STRIP_SELECT, shade);
- immUniformColor4fv(color);
-
- immBeginAtMost(PRIM_LINES, BLI_listbase_count(&act->markers) * 2);
- for (TimeMarker *marker = act->markers.first; marker; marker = marker->next) {
- if ((marker->frame > strip->actstart) && (marker->frame < strip->actend)) {
- float frame = nlastrip_get_frame(strip, marker->frame, NLATIME_CONVERT_MAP);
+ immBeginAtMost(PRIM_LINES, BLI_listbase_count(&act->markers) * 2);
+ for (TimeMarker *marker = act->markers.first; marker; marker = marker->next) {
+ if ((marker->frame > strip->actstart) && (marker->frame < strip->actend)) {
+ float frame = nlastrip_get_frame(strip, marker->frame, NLATIME_CONVERT_MAP);
- /* just a simple line for now */
- /* XXX: draw a triangle instead... */
- immVertex2f(shdr_pos, frame, yminc + 1);
- immVertex2f(shdr_pos, frame, ymaxc - 1);
- }
+ /* just a simple line for now */
+ /* XXX: draw a triangle instead... */
+ immVertex2f(shdr_pos, frame, yminc + 1);
+ immVertex2f(shdr_pos, frame, ymaxc - 1);
}
- immEnd();
-
- immUnbindProgram();
}
+ immEnd();
+
+ immUnbindProgram();
}
/* Markers inside a NLA-Strip */