diff options
author | Jean-Luc Peurière <jlp@nerim.net> | 2007-07-31 21:45:26 +0400 |
---|---|---|
committer | Jean-Luc Peurière <jlp@nerim.net> | 2007-07-31 21:45:26 +0400 |
commit | a0c98b95d52c0f627e59edfb32705827b3c96070 (patch) | |
tree | c69b37f1f4bf5671a09aec2ed72a6010e0188489 /source | |
parent | df81fa977e12d8f6e5733e51d9be503b2cc67f14 (diff) |
transform mode commit
you can now translate or rotate a selected object
in the third method. either in object or edit mode.
Note : the method is not ideal, as we create a full
transform loop for each component of the transform.
However it is this way handled in same way as other
means of input
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/src/space.c | 4 | ||||
-rwxr-xr-x | source/blender/src/transform.c | 94 | ||||
-rw-r--r-- | source/blender/src/view.c | 19 |
3 files changed, 116 insertions, 1 deletions
diff --git a/source/blender/src/space.c b/source/blender/src/space.c index cc3109cb57a..6250061f94c 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -1573,7 +1573,9 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) } else if (G.vd->ndofmode == 1) { viewmoveNDOFfly(1); } else { - ; + if (OBACT) { + ndof_transform(); + } } break; diff --git a/source/blender/src/transform.c b/source/blender/src/transform.c index 9e6c1b68937..d8bd30796f2 100755 --- a/source/blender/src/transform.c +++ b/source/blender/src/transform.c @@ -3106,4 +3106,98 @@ void BIF_TransformSetUndo(char *str) Trans.undostr= str; } +void ndof_do_transform(float *fval) +{ + char str[200]; + float fvec[3] = {0.0,0.0,0.0}; + char change = 0; + +// fprintf(stderr,"passing here %f %f %f \n",fval[3],fval[4],fval[5]); + + + if (fval[3] != 0.0 ) { + fvec[0] = 1.0; + initTransform(TFM_ROTATION, CTX_NONE); + applyRotation(&Trans, fval[3], fvec); + recalcData(&Trans); + change =1; + fvec[0] = 0.0; + drawSnapping(&Trans); + /* free data */ + postTrans(&Trans); + + /* aftertrans does insert ipos and action channels, and clears base flags, doesnt read transdata */ + special_aftertrans_update(&Trans); + + } + if (fval[4] != 0.0 ) { + fvec[1] = 1.0; + initTransform(TFM_ROTATION, CTX_NONE); + applyRotation(&Trans, fval[4], fvec); + recalcData(&Trans); + change =1; + fvec[1] = 0.0; + drawSnapping(&Trans); + /* free data */ + postTrans(&Trans); + + /* aftertrans does insert ipos and action channels, and clears base flags, doesnt read transdata */ + special_aftertrans_update(&Trans); + + } + if (fval[5] != 0.0 ) { + fvec[2] = 1.0; + initTransform(TFM_ROTATION, CTX_NONE); + applyRotation(&Trans, fval[5], fvec); + recalcData(&Trans); + change =1; + fvec[2] = 0.0; + drawSnapping(&Trans); + /* free data */ + postTrans(&Trans); + + /* aftertrans does insert ipos and action channels, and clears base flags, doesnt read transdata */ + special_aftertrans_update(&Trans); + + } + + + if ((fval[0] != 0.0 )|( fval[1] != 0.0 )| (fval[2] != 0.0)) { + initTransform(TFM_TRANSLATION, CTX_NONE); + Trans.vec[0] = fval[0]; + Trans.vec[1] = fval[1]; + Trans.vec[2] = fval[2]; + + applyTranslation(&Trans, Trans.vec); + + /* evil hack - redo translation if cliiping needeed */ + if (Trans.flag & T_CLIP_UV && clipUVTransform(&Trans, Trans.vec, 0)) + applyTranslation(&Trans, Trans.vec); + + recalcData(&Trans); + change =1; + drawSnapping(&Trans); + /* free data */ + postTrans(&Trans); + + /* aftertrans does insert ipos and action channels, and clears base flags, doesnt read transdata */ + special_aftertrans_update(&Trans); + + } + + + + if (change) { + ; + } + + /* send events out for redraws */ + viewRedrawPost(&Trans); + + if(Trans.undostr) BIF_undo_push(Trans.undostr); + else BIF_undo_push(transform_to_undostr(&Trans)); + + Trans.undostr= NULL; + +}
\ No newline at end of file diff --git a/source/blender/src/view.c b/source/blender/src/view.c index 029222963b6..c2aaee81ff0 100644 --- a/source/blender/src/view.c +++ b/source/blender/src/view.c @@ -2214,3 +2214,22 @@ void smooth_view_to_camera(View3D *v3d) v3d->persp=2; } } + +void ndof_transform(void) +{ + float fval[7]; + + getndof(fval); + + if (G.vd->ndoffilter) + filterNDOFvalues(fval); + + fval[0] = fval[0] * (1.0f/1024.0f); + fval[1] = -fval[1] * (1.0f/1024.0f); // axis inversion + fval[2] = -fval[2] * (1.0f/1024.0f); // axis inversion + fval[3] = fval[3] * (1.0f/8024.0f); + fval[4] = fval[4] * (1.0f/8024.0f); + fval[5] = fval[5] * (1.0f/8024.0f); + + ndof_do_transform(fval); +} |