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:
authorCampbell Barton <ideasman42@gmail.com>2012-06-12 00:50:57 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-06-12 00:50:57 +0400
commit234a0d8c513e0124ba569868c501668519ab958b (patch)
tree4a58b410be6da5694759748b7794da60bac31f52
parent21e4b12e7a1b821e0eab2c1223e8519a0e85df5e (diff)
fix for crash drawing grease pencil attached to a tracking marker.
also fix for use of uninitialized variable for ED_clip_point_undistorted_pos().
-rw-r--r--source/blender/editors/include/ED_clip.h4
-rw-r--r--source/blender/editors/space_clip/clip_draw.c8
-rw-r--r--source/blender/editors/space_clip/clip_editor.c24
3 files changed, 20 insertions, 16 deletions
diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h
index 1d42954a416..649266beec7 100644
--- a/source/blender/editors/include/ED_clip.h
+++ b/source/blender/editors/include/ED_clip.h
@@ -69,9 +69,9 @@ struct ImBuf *ED_space_clip_get_stable_buffer(struct SpaceClip *sc, float loc[2]
void ED_clip_update_frame(const struct Main *mainp, int cfra);
int ED_clip_view_selection(struct SpaceClip *sc, struct ARegion *ar, int fit);
-void ED_clip_point_undistorted_pos(SpaceClip * sc, float co[2], float nco[2]);
+void ED_clip_point_undistorted_pos(SpaceClip * sc, const float co[2], float r_co[2]);
void ED_clip_point_stable_pos(struct bContext *C, float x, float y, float *xr, float *yr);
-void ED_clip_point_stable_pos__reverse(SpaceClip * sc, ARegion *ar, float co[2], float nco[2]);
+void ED_clip_point_stable_pos__reverse(SpaceClip * sc, ARegion *ar, const float co[2], float r_co[2]);
void ED_clip_mouse_pos(struct bContext *C, struct wmEvent *event, float co[2]);
int ED_space_clip_texture_buffer_supported(struct SpaceClip *sc);
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index a9b23d5b939..655a09ec90c 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -1467,9 +1467,11 @@ void clip_draw_grease_pencil(bContext *C, int onlyv2d)
if (track) {
int framenr = sc->user.framenr;
- MovieTrackingMarker *marker = BKE_tracking_exact_marker(track, framenr);
-
- glTranslatef(marker->pos[0], marker->pos[1], 0.0f);
+ /* don't get the exact marker since it may not exist for the frame */
+ MovieTrackingMarker *marker = BKE_tracking_get_marker(track, framenr);
+ if (marker) {
+ glTranslatef(marker->pos[0], marker->pos[1], 0.0f);
+ }
}
}
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 504d96df072..b24ff58e590 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -425,9 +425,9 @@ int ED_clip_view_selection(SpaceClip *sc, ARegion *ar, int fit)
return TRUE;
}
-void ED_clip_point_undistorted_pos(SpaceClip *sc, float co[2], float nco[2])
+void ED_clip_point_undistorted_pos(SpaceClip *sc, const float co[2], float r_co[2])
{
- copy_v2_v2(nco, co);
+ copy_v2_v2(r_co, co);
if (sc->user.render_flag & MCLIP_PROXY_RENDER_UNDISTORT) {
MovieClip *clip = ED_space_clip(sc);
@@ -436,13 +436,13 @@ void ED_clip_point_undistorted_pos(SpaceClip *sc, float co[2], float nco[2])
ED_space_clip_size(sc, &width, &height);
- nco[0] *= width;
- nco[1] *= height * aspy;
+ r_co[0] *= width;
+ r_co[1] *= height * aspy;
- BKE_tracking_invert_intrinsics(&clip->tracking, nco, nco);
+ BKE_tracking_invert_intrinsics(&clip->tracking, r_co, r_co);
- nco[0] /= width;
- nco[1] /= height * aspy;
+ r_co[0] /= width;
+ r_co[1] /= height * aspy;
}
}
@@ -451,7 +451,7 @@ void ED_clip_point_stable_pos(bContext *C, float x, float y, float *xr, float *y
ARegion *ar = CTX_wm_region(C);
SpaceClip *sc = CTX_wm_space_clip(C);
int sx, sy, width, height;
- float zoomx, zoomy, pos[3] = {0.0f, 0.0f, 0.0f}, imat[4][4];
+ float zoomx, zoomy, pos[3], imat[4][4];
ED_space_clip_zoom(sc, ar, &zoomx, &zoomy);
ED_space_clip_size(sc, &width, &height);
@@ -460,6 +460,7 @@ void ED_clip_point_stable_pos(bContext *C, float x, float y, float *xr, float *y
pos[0] = (x - sx) / zoomx;
pos[1] = (y - sy) / zoomy;
+ pos[2] = 0.0f;
invert_m4_m4(imat, sc->stabmat);
mul_v3_m4v3(pos, imat, pos);
@@ -484,7 +485,7 @@ void ED_clip_point_stable_pos(bContext *C, float x, float y, float *xr, float *y
* \brief the reverse of ED_clip_point_stable_pos(), gets the marker region coords.
* better name here? view_to_track / track_to_view or so?
*/
-void ED_clip_point_stable_pos__reverse(SpaceClip *sc, ARegion *ar, float co[2], float nco[2])
+void ED_clip_point_stable_pos__reverse(SpaceClip *sc, ARegion *ar, const float co[2], float r_co[2])
{
float zoomx, zoomy;
float pos[3];
@@ -496,12 +497,13 @@ void ED_clip_point_stable_pos__reverse(SpaceClip *sc, ARegion *ar, float co[2],
ED_space_clip_zoom(sc, ar, &zoomx, &zoomy);
ED_clip_point_undistorted_pos(sc, co, pos);
+ pos[2] = 0.0f;
/* untested */
mul_v3_m4v3(pos, sc->stabmat, pos);
- nco[0] = (pos[0] * width * zoomx) + (float)sx;
- nco[1] = (pos[1] * height * zoomy) + (float)sy;
+ r_co[0] = (pos[0] * width * zoomx) + (float)sx;
+ r_co[1] = (pos[1] * height * zoomy) + (float)sy;
}
void ED_clip_mouse_pos(bContext *C, wmEvent *event, float co[2])