From 1776cb92441b180c733ce13bbfcb1058bb46e6ae Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 17 Feb 2014 12:58:50 +0600 Subject: Fix T38670: Mask transform without a movieclip crashes Disable transform and mask display when there's no active clip. It's not a matter of returning fallback dimensions if there's no slip, it's also matter of making it so stabilization and distortion routines are aware of clip == NULL which is really crappy. Also almost all the operators are disabled in clip editor without active clip already anyway. Also tweaked header UI a bit to not display mask stuff when there's no active clip, --- source/blender/editors/transform/transform.c | 34 +++++++++++++++++----------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'source/blender/editors/transform/transform.c') diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 4269e18734e..e5c8877f076 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -414,26 +414,34 @@ void projectIntViewEx(TransInfo *t, const float vec[3], int adr[2], const eV3DPr SpaceClip *sc = t->sa->spacedata.first; if (t->options & CTX_MASK) { - /* not working quite right, TODO (see above too) */ - float aspx, aspy; - float v[2]; + MovieClip *clip = ED_space_clip_get_clip(sc); - ED_space_clip_get_aspect(sc, &aspx, &aspy); + if (clip) { + /* not working quite right, TODO (see above too) */ + float aspx, aspy; + float v[2]; - copy_v2_v2(v, vec); + ED_space_clip_get_aspect(sc, &aspx, &aspy); - v[0] = v[0] / aspx; - v[1] = v[1] / aspy; + copy_v2_v2(v, vec); - BKE_mask_coord_to_movieclip(sc->clip, &sc->user, v, v); + v[0] = v[0] / aspx; + v[1] = v[1] / aspy; - v[0] = v[0] / aspx; - v[1] = v[1] / aspy; + BKE_mask_coord_to_movieclip(sc->clip, &sc->user, v, v); - ED_clip_point_stable_pos__reverse(sc, t->ar, v, v); + v[0] = v[0] / aspx; + v[1] = v[1] / aspy; - adr[0] = v[0]; - adr[1] = v[1]; + ED_clip_point_stable_pos__reverse(sc, t->ar, v, v); + + adr[0] = v[0]; + adr[1] = v[1]; + } + else { + adr[0] = 0; + adr[1] = 0; + } } else if (t->options & CTX_MOVIECLIP) { float v[2], aspx, aspy; -- cgit v1.2.3