From 1ea472a9037d5df5000fef7785ed87ed4eb21ea6 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 29 Sep 2007 03:52:25 +0000 Subject: [PATCH] Bugfix: For transform in UV/Image editor (and soon, the IPO editor), transformations on 'local' axes (i.e. GXX, or GYY) won't work. Therefore, I've disabled this for those cases. Note: A small part of the IPO editor transform-code port is in this commit too. --- source/blender/src/transform.c | 46 ++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/source/blender/src/transform.c b/source/blender/src/transform.c index dae288293ab..00d987142fd 100644 --- a/source/blender/src/transform.c +++ b/source/blender/src/transform.c @@ -267,16 +267,26 @@ void convertViewVec(TransInfo *t, float *vec, short dx, short dy) } else if(t->spacetype==SPACE_IMAGE) { float divx, divy, aspx, aspy; - + transform_aspect_ratio_tface_uv(&aspx, &aspy); - + divx= G.v2d->mask.xmax-G.v2d->mask.xmin; divy= G.v2d->mask.ymax-G.v2d->mask.ymin; - + vec[0]= aspx*(G.v2d->cur.xmax-G.v2d->cur.xmin)*(dx)/divx; vec[1]= aspy*(G.v2d->cur.ymax-G.v2d->cur.ymin)*(dy)/divy; vec[2]= 0.0f; } + else if(t->spacetype==SPACE_IPO) { + float divx, divy; + + divx= G.v2d->mask.xmax-G.v2d->mask.xmin; + divy= G.v2d->mask.ymax-G.v2d->mask.ymin; + + vec[0]= (G.v2d->cur.xmax-G.v2d->cur.xmin)*(dx) / (divx); + vec[1]= (G.v2d->cur.ymax-G.v2d->cur.ymin)*(dy) / (divy); + vec[2]= 0.0f; + } } void projectIntView(TransInfo *t, float *vec, int *adr) @@ -638,14 +648,19 @@ static void transformEvent(unsigned short event, short val) { case XKEY: if ((Trans.flag & T_NO_CONSTRAINT)==0) { if (cmode == 'X') { - if (Trans.con.mode & CON_USER) { + if (Trans.flag & T_2D_EDIT) { stopConstraint(&Trans); } else { - if (G.qual == 0) - setUserConstraint(&Trans, (CON_AXIS0), "along %s X"); - else if ((G.qual == LR_SHIFTKEY) && ((Trans.flag & T_2D_EDIT)==0)) - setUserConstraint(&Trans, (CON_AXIS1|CON_AXIS2), "locking %s X"); + if (Trans.con.mode & CON_USER) { + stopConstraint(&Trans); + } + else { + if (G.qual == 0) + setUserConstraint(&Trans, (CON_AXIS0), "along %s X"); + else if (G.qual == LR_SHIFTKEY) + setUserConstraint(&Trans, (CON_AXIS1|CON_AXIS2), "locking %s X"); + } } } else { @@ -660,14 +675,19 @@ static void transformEvent(unsigned short event, short val) { case YKEY: if ((Trans.flag & T_NO_CONSTRAINT)==0) { if (cmode == 'Y') { - if (Trans.con.mode & CON_USER) { + if (Trans.flag & T_2D_EDIT) { stopConstraint(&Trans); } else { - if (G.qual == 0) - setUserConstraint(&Trans, (CON_AXIS1), "along %s Y"); - else if ((G.qual == LR_SHIFTKEY) && ((Trans.flag & T_2D_EDIT)==0)) - setUserConstraint(&Trans, (CON_AXIS0|CON_AXIS2), "locking %s Y"); + if (Trans.con.mode & CON_USER) { + stopConstraint(&Trans); + } + else { + if (G.qual == 0) + setUserConstraint(&Trans, (CON_AXIS1), "along %s Y"); + else if (G.qual == LR_SHIFTKEY) + setUserConstraint(&Trans, (CON_AXIS0|CON_AXIS2), "locking %s Y"); + } } } else {