diff options
author | Luca Rood <dev@lucarood.com> | 2017-02-23 19:35:16 +0300 |
---|---|---|
committer | Luca Rood <dev@lucarood.com> | 2017-02-23 22:12:08 +0300 |
commit | 2e83814e186f0d6746f0ce18123d6a5a67e07a64 (patch) | |
tree | 58d8d6703ee2ac85969511ce3d3f612ed4735dd4 /source/blender/editors/space_clip | |
parent | ef60979029793c04dab2df051b965a86eeb299f6 (diff) |
OpenGl immediate mode: clip_draw.c and clip_graph_draw.c fixes
Fixed little typo in clip_draw.c and special case assert in
clip_graph_draw.c (track segments with single point).
Part of T49043
Diffstat (limited to 'source/blender/editors/space_clip')
-rw-r--r-- | source/blender/editors/space_clip/clip_draw.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_graph_draw.c | 33 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_intern.h | 4 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_utils.c | 14 |
4 files changed, 35 insertions, 18 deletions
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 670ed2f29eb..6c1dc8c7335 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -889,7 +889,7 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo float tilt_ctrl[2]; if (!outline) { - immUniformColor3fv((track->search_flag & SELECT) ? scol : col); + immUniformColor3fv((track->pat_flag & SELECT) ? scol : col); } /* pattern's corners sliding squares */ diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c index b373358b49c..7afa2ae8145 100644 --- a/source/blender/editors/space_clip/clip_graph_draw.c +++ b/source/blender/editors/space_clip/clip_graph_draw.c @@ -72,7 +72,7 @@ static void tracking_segment_point_cb(void *userdata, MovieTrackingTrack *UNUSED immVertex2f(data->pos, scene_framenr, val); } -static void tracking_segment_start_cb(void *userdata, MovieTrackingTrack *track, int coord) +static void tracking_segment_start_cb(void *userdata, MovieTrackingTrack *track, int coord, bool is_point) { TrackMotionCurveUserData *data = (TrackMotionCurveUserData *) userdata; float col[4] = {0.0f, 0.0f, 0.0f, 0.0f}; @@ -90,8 +90,13 @@ static void tracking_segment_start_cb(void *userdata, MovieTrackingTrack *track, immUniformColor4fv(col); - /* Graph can be composed of smaller segments, if any marker is disabled */ - immBeginAtMost(GL_LINE_STRIP, track->markersnr); + if (is_point) { + immBeginAtMost(GL_POINTS, 1); + } + else { + /* Graph can be composed of smaller segments, if any marker is disabled */ + immBeginAtMost(GL_LINE_STRIP, track->markersnr); + } } static void tracking_segment_end_cb(void *UNUSED(userdata), int UNUSED(coord)) @@ -220,7 +225,7 @@ static void tracking_error_segment_point_cb(void *userdata, } } -static void tracking_error_segment_start_cb(void *userdata, MovieTrackingTrack *track, int coord) +static void tracking_error_segment_start_cb(void *userdata, MovieTrackingTrack *track, int coord, bool is_point) { if (coord == 1) { TrackErrorCurveUserData *data = (TrackErrorCurveUserData *) userdata; @@ -237,8 +242,13 @@ static void tracking_error_segment_start_cb(void *userdata, MovieTrackingTrack * immUniformColor4fv(col); - /* Graph can be composed of smaller segments, if any marker is disabled */ - immBeginAtMost(GL_LINE_STRIP, track->markersnr); + if (is_point) { /* This probably never happens here, but just in case... */ + immBeginAtMost(GL_POINTS, 1); + } + else { + /* Graph can be composed of smaller segments, if any marker is disabled */ + immBeginAtMost(GL_LINE_STRIP, track->markersnr); + } } } @@ -323,11 +333,12 @@ void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene) UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL); UI_view2d_grid_free(grid); - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + if (clip) { + unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + glPointSize(3.0f); - if (clip) { if (sc->flag & SC_SHOW_GRAPH_TRACKS_MOTION) { draw_tracks_motion_curves(v2d, sc, pos); } @@ -339,9 +350,9 @@ void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene) if (sc->flag & SC_SHOW_GRAPH_FRAMES) { draw_frame_curves(sc, pos); } - } - immUnbindProgram(); + immUnbindProgram(); + } /* frame range */ clip_draw_sfra_efra(v2d, scene); diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h index 14393c6968b..ffc7a41f0aa 100644 --- a/source/blender/editors/space_clip/clip_intern.h +++ b/source/blender/editors/space_clip/clip_intern.h @@ -125,12 +125,12 @@ void ED_clip_tool_props_register(struct ARegionType *art); /* clip_utils.c */ void clip_graph_tracking_values_iterate_track(struct SpaceClip *sc, struct MovieTrackingTrack *track, void *userdata, void (*func)(void *userdata, struct MovieTrackingTrack *track, struct MovieTrackingMarker *marker, int coord, int scene_framenr, float val), - void (*segment_start)(void *userdata, struct MovieTrackingTrack *track, int coord), + void (*segment_start)(void *userdata, struct MovieTrackingTrack *track, int coord, bool is_point), void (*segment_end)(void *userdata, int coord)); void clip_graph_tracking_values_iterate(struct SpaceClip *sc, bool selected_only, bool include_hidden, void *userdata, void (*func)(void *userdata, struct MovieTrackingTrack *track, struct MovieTrackingMarker *marker, int coord, int scene_framenr, float val), - void (*segment_start)(void *userdata, struct MovieTrackingTrack *track, int coord), + void (*segment_start)(void *userdata, struct MovieTrackingTrack *track, int coord, bool is_point), void (*segment_end)(void *userdata, int coord)); void clip_graph_tracking_iterate(struct SpaceClip *sc, bool selected_only, bool include_hidden, void *userdata, diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c index 6026036c05d..560cf1f905a 100644 --- a/source/blender/editors/space_clip/clip_utils.c +++ b/source/blender/editors/space_clip/clip_utils.c @@ -61,7 +61,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); @@ -90,8 +90,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]; @@ -122,7 +128,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); |