Esempio n. 1
0
/* Markers inside an action strip */
static void nla_actionclip_draw_markers(NlaStrip *strip, float yminc, float ymaxc)
{
	bAction *act = strip->act;
	TimeMarker *marker;
	
	if (ELEM(NULL, strip->act, strip->act->markers.first))
		return;
	
	for (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...
			fdrawline(frame, yminc + 1, frame, ymaxc - 1);
		}
	}
}
Esempio n. 2
0
/* Markers inside an action strip */
static void nla_actionclip_draw_markers(
    NlaStrip *strip, float yminc, float ymaxc, int shade, const bool dashed)
{
  const bAction *act = strip->act;

  if (ELEM(NULL, act, act->markers.first)) {
    return;
  }

  const uint shdr_pos = GPU_vertformat_attr_add(
      immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
  if (dashed) {
    immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);

    float viewport_size[4];
    GPU_viewport_size_get_f(viewport_size);
    immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);

    immUniform1i("colors_len", 0); /* "simple" mode */
    immUniform1f("dash_width", 6.0f);
    immUniform1f("dash_factor", 0.5f);
  }
  else {
    immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
  }
  immUniformThemeColorShade(TH_STRIP_SELECT, shade);

  immBeginAtMost(GPU_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);
    }
  }
  immEnd();

  immUnbindProgram();
}