diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-09-14 20:12:17 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-09-14 20:12:17 +0400 |
commit | 1bde4e3274042f08b60153f58273387801052a97 (patch) | |
tree | 39bb6f55ebebb9a4532d6d7a15dd6137a134aee6 /source/blender/src/transform_generics.c | |
parent | 6e38ff32bed6e28871545f352a41a9b7343ed34d (diff) |
2D Cursor in UV window
this can be placed by the moused and used for transforming around.
still need numeric location input but no room left in the image panel.
Diffstat (limited to 'source/blender/src/transform_generics.c')
-rw-r--r-- | source/blender/src/transform_generics.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/source/blender/src/transform_generics.c b/source/blender/src/transform_generics.c index 33ced3b292c..8e92fdda38a 100644 --- a/source/blender/src/transform_generics.c +++ b/source/blender/src/transform_generics.c @@ -464,6 +464,8 @@ void initTrans (TransInfo *t) if(t->spacetype==SPACE_VIEW3D) { if(G.vd->flag & V3D_ALIGN) t->flag |= T_V3D_ALIGN; t->around = G.vd->around; + } else if(t->spacetype==SPACE_IMAGE) { + t->around = G.v2d->around; } else t->around = V3D_CENTER; @@ -654,6 +656,19 @@ void calculateCenterCursor(TransInfo *t) calculateCenter2D(t); } +void calculateCenterCursor2D(TransInfo *t) +{ + float aspx=1.0, aspy=1.0; + + if(t->spacetype==SPACE_IMAGE) /* only space supported right now but may change */ + transform_aspect_ratio_tface_uv(&aspx, &aspy); + if (G.v2d) { + t->center[0] = G.v2d->cursor[0] * aspx; + t->center[1] = G.v2d->cursor[1] * aspy; + } + calculateCenter2D(t); +} + void calculateCenterMedian(TransInfo *t) { float partial[3] = {0.0f, 0.0f, 0.0f}; @@ -717,7 +732,10 @@ void calculateCenter(TransInfo *t) calculateCenterMedian(t); break; case V3D_CURSOR: - calculateCenterCursor(t); + if(t->spacetype==SPACE_IMAGE) + calculateCenterCursor2D(t); + else + calculateCenterCursor(t); break; case V3D_LOCAL: /* Individual element center uses median center for helpline and such */ |