diff options
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r-- | source/blender/editors/transform/transform_generics.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 99aff4530ab..359f6425126 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1523,7 +1523,6 @@ void calculateCenterCursor2D(TransInfo *t) if (t->spacetype == SPACE_IMAGE) { SpaceImage *sima = (SpaceImage *)t->sa->spacedata.first; - /* only space supported right now but may change */ if (t->options & CTX_MASK) { ED_space_image_get_aspect(sima, &aspx, &aspy); } @@ -1532,17 +1531,37 @@ void calculateCenterCursor2D(TransInfo *t) } cursor = sima->cursor; } + else if (t->spacetype == SPACE_CLIP) { + SpaceClip *space_clip = (SpaceClip *) t->sa->spacedata.first; + if (t->options & CTX_MOVIECLIP) { + ED_space_clip_get_aspect_dimension_aware(space_clip, &aspx, &aspy); + } + else { + ED_space_clip_get_aspect(space_clip, &aspx, &aspy); + } + cursor = space_clip->cursor; + } if (cursor) { if (t->options & CTX_MASK) { float co[2]; float frame_size[2]; - 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); + 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); + } + 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); + } + else { + BLI_assert(!"Shall not happen"); + } t->center[0] = co[0] * aspx; t->center[1] = co[1] * aspy; @@ -1621,7 +1640,7 @@ void calculateCenter(TransInfo *t) calculateCenterMedian(t); break; case V3D_CURSOR: - if (t->spacetype == SPACE_IMAGE) + if (ELEM(t->spacetype, SPACE_IMAGE, SPACE_CLIP)) calculateCenterCursor2D(t); else if (t->spacetype == SPACE_IPO) calculateCenterCursorGraph2D(t); |