Fix mask transform when display aspect is not 1:1
Requires some more intense testing.
This commit is contained in:
parent
bef5cb3aa2
commit
dcf2a071a0
Notes:
blender-bot
2023-02-14 10:35:25 +01:00
Referenced by issue #40354, Camera Tracks in the Dope Sheet can't be deselected
|
@ -1133,7 +1133,7 @@ void BKE_mask_coord_to_movieclip(MovieClip *clip, MovieClipUser *user, float r_c
|
|||
BKE_movieclip_get_size_fl(clip, user, frame_size);
|
||||
BKE_movieclip_get_aspect(clip, &aspx, &aspy);
|
||||
|
||||
frame_size[1] /= (aspy / aspx);
|
||||
frame_size[1] *= (aspy / aspx);
|
||||
|
||||
BKE_mask_coord_to_frame(r_co, co, frame_size);
|
||||
}
|
||||
|
@ -1147,7 +1147,7 @@ void BKE_mask_coord_to_image(Image *image, ImageUser *iuser, float r_co[2], cons
|
|||
BKE_image_get_size_fl(image, iuser, frame_size);
|
||||
BKE_image_get_aspect(image, &aspx, &aspy);
|
||||
|
||||
frame_size[1] /= (aspy / aspx);
|
||||
frame_size[1] *= (aspy / aspx);
|
||||
|
||||
BKE_mask_coord_to_frame(r_co, co, frame_size);
|
||||
}
|
||||
|
|
|
@ -334,7 +334,6 @@ void projectIntViewEx(TransInfo *t, const float vec[3], int adr[2], const eV3DPr
|
|||
SpaceImage *sima = t->sa->spacedata.first;
|
||||
|
||||
if (t->options & CTX_MASK) {
|
||||
/* not working quite right, TODO (see below too) */
|
||||
float aspx, aspy;
|
||||
float v[2];
|
||||
|
||||
|
@ -347,9 +346,6 @@ void projectIntViewEx(TransInfo *t, const float vec[3], int adr[2], const eV3DPr
|
|||
|
||||
BKE_mask_coord_to_image(sima->image, &sima->iuser, v, v);
|
||||
|
||||
v[0] = v[0] / aspx;
|
||||
v[1] = v[1] / aspy;
|
||||
|
||||
ED_image_point_pos__reverse(sima, t->ar, v, v);
|
||||
|
||||
adr[0] = v[0];
|
||||
|
@ -405,7 +401,6 @@ void projectIntViewEx(TransInfo *t, const float vec[3], int adr[2], const eV3DPr
|
|||
MovieClip *clip = ED_space_clip_get_clip(sc);
|
||||
|
||||
if (clip) {
|
||||
/* not working quite right, TODO (see above too) */
|
||||
float aspx, aspy;
|
||||
float v[2];
|
||||
|
||||
|
@ -418,9 +413,6 @@ void projectIntViewEx(TransInfo *t, const float vec[3], int adr[2], const eV3DPr
|
|||
|
||||
BKE_mask_coord_to_movieclip(sc->clip, &sc->user, v, v);
|
||||
|
||||
v[0] = v[0] / aspx;
|
||||
v[1] = v[1] / aspy;
|
||||
|
||||
ED_clip_point_stable_pos__reverse(sc, t->ar, v, v);
|
||||
|
||||
adr[0] = v[0];
|
||||
|
|
|
@ -6628,6 +6628,8 @@ static void MaskHandleToTransData(MaskSplinePoint *point, eMaskWhichHandle which
|
|||
td->flag = 0;
|
||||
td->loc = td2d->loc;
|
||||
mul_v2_m3v2(td->center, parent_matrix, bezt->vec[1]);
|
||||
td->center[0] *= asp[0];
|
||||
td->center[1] *= asp[1];
|
||||
copy_v3_v3(td->iloc, td->loc);
|
||||
|
||||
memset(td->axismtx, 0, sizeof(td->axismtx));
|
||||
|
@ -6689,6 +6691,8 @@ static void MaskPointToTransData(Scene *scene, MaskSplinePoint *point,
|
|||
td->flag = 0;
|
||||
td->loc = td2d->loc;
|
||||
mul_v2_m3v2(td->center, parent_matrix, bezt->vec[1]);
|
||||
td->center[0] *= asp[0];
|
||||
td->center[1] *= asp[1];
|
||||
copy_v3_v3(td->iloc, td->loc);
|
||||
|
||||
memset(td->axismtx, 0, sizeof(td->axismtx));
|
||||
|
|
|
@ -1567,19 +1567,14 @@ void calculateCenterCursor2D(TransInfo *t, float r_center[2])
|
|||
if (cursor) {
|
||||
if (t->options & CTX_MASK) {
|
||||
float co[2];
|
||||
float frame_size[2];
|
||||
|
||||
if (t->spacetype == SPACE_IMAGE) {
|
||||
SpaceImage *sima = (SpaceImage *)t->sa->spacedata.first;
|
||||
ED_space_image_get_size_fl(sima, frame_size);
|
||||
BKE_mask_coord_from_frame(co, cursor, frame_size);
|
||||
ED_space_image_get_aspect(sima, &aspx, &aspy);
|
||||
BKE_mask_coord_from_image(sima->image, &sima->iuser, co, cursor);
|
||||
}
|
||||
else if (t->spacetype == SPACE_CLIP) {
|
||||
SpaceClip *space_clip = (SpaceClip *) t->sa->spacedata.first;
|
||||
ED_space_clip_get_size_fl(space_clip, frame_size);
|
||||
BKE_mask_coord_from_frame(co, cursor, frame_size);
|
||||
ED_space_clip_get_aspect(space_clip, &aspx, &aspy);
|
||||
BKE_mask_coord_from_movieclip(space_clip->clip, &space_clip->user, co, cursor);
|
||||
}
|
||||
else {
|
||||
BLI_assert(!"Shall not happen");
|
||||
|
|
Loading…
Reference in New Issue