UI: Fix time cursor number box styling for Clip Editor's Dopesheet/Graph views

This commit is contained in:
2018-05-10 17:56:12 +02:00
parent c20cc3cf14
commit be400a0789
5 changed files with 20 additions and 41 deletions

View File

@@ -281,9 +281,6 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene)
glDisable(GL_BLEND);
}
/* current frame */
clip_draw_cfra(sc, ar, scene);
}
void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar)

View File

@@ -349,7 +349,4 @@ void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene)
/* frame range */
clip_draw_sfra_efra(v2d, scene);
/* current frame */
clip_draw_cfra(sc, ar, scene);
}

View File

@@ -143,7 +143,6 @@ void clip_delete_plane_track(struct bContext *C, struct MovieClip *clip, struct
void clip_view_center_to_point(SpaceClip *sc, float x, float y);
void clip_draw_cfra(struct SpaceClip *sc, struct ARegion *ar, struct Scene *scene);
void clip_draw_sfra_efra(struct View2D *v2d, struct Scene *scene);
/* tracking_ops.c */

View File

@@ -264,39 +264,6 @@ void clip_view_center_to_point(SpaceClip *sc, float x, float y)
sc->yof = (y - 0.5f) * height * aspy;
}
void clip_draw_cfra(SpaceClip *sc, ARegion *ar, Scene *scene)
{
/* Draw a light green line to indicate current frame */
View2D *v2d = &ar->v2d;
float x = (float)(sc->user.framenr * scene->r.framelen);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor(TH_CFRAME);
glLineWidth(2.0f);
immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, x, v2d->cur.ymin);
immVertex2f(pos, x, v2d->cur.ymax);
immEnd();
immUnbindProgram();
UI_view2d_view_orthoSpecial(ar, v2d, 1);
/* because the frame number text is subject to the same scaling as the contents of the view */
float xscale;
UI_view2d_scale_get(v2d, &xscale, NULL);
gpuPushMatrix();
gpuScale2f(1.0f / xscale, 1.0f);
ED_region_cache_draw_curfra_label(sc->user.framenr, (float)sc->user.framenr * xscale, 18);
/* restore view transform */
gpuPopMatrix();
}
void clip_draw_sfra_efra(View2D *v2d, Scene *scene)
{
UI_view2d_view_ortho(v2d);

View File

@@ -51,6 +51,7 @@
#include "IMB_imbuf_types.h"
#include "ED_anim_api.h" /* for timeline cursor drawing */
#include "ED_mask.h"
#include "ED_space_api.h"
#include "ED_screen.h"
@@ -1245,6 +1246,7 @@ static void graph_region_draw(const bContext *C, ARegion *ar)
SpaceClip *sc = CTX_wm_space_clip(C);
Scene *scene = CTX_data_scene(C);
short unitx, unity;
short cfra_flag = 0;
if (sc->flag & SC_LOCK_TIMECURSOR)
ED_clip_graph_center_current_frame(scene, ar);
@@ -1258,6 +1260,10 @@ static void graph_region_draw(const bContext *C, ARegion *ar)
/* data... */
clip_draw_graph(sc, ar, scene);
/* current frame indicator line */
if (sc->flag & SC_SHOW_SECONDS) cfra_flag |= DRAWCFRA_UNIT_SECONDS;
ANIM_draw_cfra(C, v2d, cfra_flag);
/* reset view matrix */
UI_view2d_view_restore(C);
@@ -1267,6 +1273,11 @@ static void graph_region_draw(const bContext *C, ARegion *ar)
scrollers = UI_view2d_scrollers_calc(C, v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP);
UI_view2d_scrollers_draw(C, v2d, scrollers);
UI_view2d_scrollers_free(scrollers);
/* currnt frame indicator */
if (sc->flag & SC_SHOW_SECONDS) cfra_flag |= DRAWCFRA_UNIT_SECONDS;
UI_view2d_view_orthoSpecial(ar, v2d, 1);
ANIM_draw_cfra_number(C, v2d, cfra_flag);
}
static void dopesheet_region_draw(const bContext *C, ARegion *ar)
@@ -1277,7 +1288,7 @@ static void dopesheet_region_draw(const bContext *C, ARegion *ar)
View2D *v2d = &ar->v2d;
View2DGrid *grid;
View2DScrollers *scrollers;
short unit = 0;
short unit = 0, cfra_flag = 0;
if (clip)
BKE_tracking_dopesheet_update(&clip->tracking);
@@ -1298,6 +1309,10 @@ static void dopesheet_region_draw(const bContext *C, ARegion *ar)
/* data... */
clip_draw_dopesheet_main(sc, ar, scene);
/* current frame indicator line */
if (sc->flag & SC_SHOW_SECONDS) cfra_flag |= DRAWCFRA_UNIT_SECONDS;
ANIM_draw_cfra(C, v2d, cfra_flag);
/* reset view matrix */
UI_view2d_view_restore(C);
@@ -1305,6 +1320,10 @@ static void dopesheet_region_draw(const bContext *C, ARegion *ar)
scrollers = UI_view2d_scrollers_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
UI_view2d_scrollers_draw(C, v2d, scrollers);
UI_view2d_scrollers_free(scrollers);
/* currnt frame number indicator */
UI_view2d_view_orthoSpecial(ar, v2d, 1);
ANIM_draw_cfra_number(C, v2d, cfra_flag);
}
static void clip_preview_region_draw(const bContext *C, ARegion *ar)