diff options
Diffstat (limited to 'source/blender/editors/space_clip/clip_utils.c')
-rw-r--r-- | source/blender/editors/space_clip/clip_utils.c | 71 |
1 files changed, 46 insertions, 25 deletions
diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c index e901b9f8026..272d99c2b0e 100644 --- a/source/blender/editors/space_clip/clip_utils.c +++ b/source/blender/editors/space_clip/clip_utils.c @@ -43,8 +43,8 @@ #include "BKE_tracking.h" #include "BKE_depsgraph.h" -#include "BIF_gl.h" -#include "BIF_glutil.h" +#include "GPU_immediate.h" +#include "GPU_matrix.h" #include "WM_api.h" #include "WM_types.h" @@ -52,7 +52,6 @@ #include "ED_screen.h" #include "ED_clip.h" - #include "UI_interface.h" #include "UI_resources.h" #include "UI_view2d.h" @@ -63,7 +62,7 @@ void clip_graph_tracking_values_iterate_track( SpaceClip *sc, MovieTrackingTrack *track, void *userdata, void (*func)(void *userdata, MovieTrackingTrack *track, MovieTrackingMarker *marker, int coord, int scene_framenr, float val), - void (*segment_start)(void *userdata, MovieTrackingTrack *track, int coord), + void (*segment_start)(void *userdata, MovieTrackingTrack *track, int coord, bool is_point), void (*segment_end)(void *userdata, int coord)) { MovieClip *clip = ED_space_clip_get_clip(sc); @@ -92,8 +91,14 @@ void clip_graph_tracking_values_iterate_track( } if (!open) { - if (segment_start) - segment_start(userdata, track, coord); + if (segment_start) { + if ((i + 1) == track->markersnr) { + segment_start(userdata, track, coord, true); + } + else { + segment_start(userdata, track, coord, (track->markers[i + 1].flag & MARKER_DISABLED)); + } + } open = true; prevval = marker->pos[coord]; @@ -124,7 +129,7 @@ void clip_graph_tracking_values_iterate( SpaceClip *sc, bool selected_only, bool include_hidden, void *userdata, void (*func)(void *userdata, MovieTrackingTrack *track, MovieTrackingMarker *marker, int coord, int scene_framenr, float val), - void (*segment_start)(void *userdata, MovieTrackingTrack *track, int coord), + void (*segment_start)(void *userdata, MovieTrackingTrack *track, int coord, bool is_point), void (*segment_end)(void *userdata, int coord)) { MovieClip *clip = ED_space_clip_get_clip(sc); @@ -238,31 +243,35 @@ void clip_view_center_to_point(SpaceClip *sc, float x, float y) void clip_draw_cfra(SpaceClip *sc, ARegion *ar, Scene *scene) { + /* Draw a light green line to indicate current frame */ View2D *v2d = &ar->v2d; - float xscale, yscale; + float x = (float)(sc->user.framenr * scene->r.framelen); - /* Draw a light green line to indicate current frame */ - UI_ThemeColor(TH_CFRAME); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); - float x = (float)(sc->user.framenr * scene->r.framelen); + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + immUniformThemeColor(TH_CFRAME); + glLineWidth(2.0f); - glLineWidth(2.0); + immBegin(PRIM_LINES, 2); + immVertex2f(pos, x, v2d->cur.ymin); + immVertex2f(pos, x, v2d->cur.ymax); + immEnd(); - glBegin(GL_LINES); - glVertex2f(x, v2d->cur.ymin); - glVertex2f(x, v2d->cur.ymax); - glEnd(); + 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 */ - UI_view2d_scale_get(v2d, &xscale, &yscale); - glScalef(1.0f / xscale, 1.0f, 1.0f); + 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 */ - glScalef(xscale, 1.0, 1.0); + gpuPopMatrix(); } void clip_draw_sfra_efra(View2D *v2d, Scene *scene) @@ -272,15 +281,27 @@ void clip_draw_sfra_efra(View2D *v2d, Scene *scene) /* currently clip editor supposes that editing clip length is equal to scene frame range */ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); - glColor4f(0.0f, 0.0f, 0.0f, 0.4f); - glRectf(v2d->cur.xmin, v2d->cur.ymin, (float)SFRA, v2d->cur.ymax); - glRectf((float)EFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + + immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f); + immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, (float)SFRA, v2d->cur.ymax); + immRectf(pos, (float)EFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); + glDisable(GL_BLEND); - UI_ThemeColorShade(TH_BACK, -60); + immUniformThemeColorShade(TH_BACK, -60); /* thin lines where the actual frames are */ - fdrawline((float)SFRA, v2d->cur.ymin, (float)SFRA, v2d->cur.ymax); - fdrawline((float)EFRA, v2d->cur.ymin, (float)EFRA, v2d->cur.ymax); + glLineWidth(1.0f); + + immBegin(PRIM_LINES, 4); + immVertex2f(pos, (float)SFRA, v2d->cur.ymin); + immVertex2f(pos, (float)SFRA, v2d->cur.ymax); + immVertex2f(pos, (float)EFRA, v2d->cur.ymin); + immVertex2f(pos, (float)EFRA, v2d->cur.ymax); + immEnd(); + + immUnbindProgram(); } |