[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11449] branches/ndof/source/blender/src: transform mode commit
Martin Poirier
theeth at yahoo.com
Tue Jul 31 19:53:23 CEST 2007
The three rotation pass could be regrouped in a single
InitTransform/PostTrans pass, just call
applyRotation(&Trans, fval[i], fvec) once for each
non-zero rotation.
Martin
--- JLuc Peuriere <jlp at nerim.net> wrote:
> Revision: 11449
>
>
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11449
> Author: lukep
> Date: 2007-07-31 19:45:26 +0200 (Tue, 31 Jul
> 2007)
>
> Log Message:
> -----------
> 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
>
> Modified Paths:
> --------------
> branches/ndof/source/blender/src/space.c
> branches/ndof/source/blender/src/transform.c
> branches/ndof/source/blender/src/view.c
>
> Modified: branches/ndof/source/blender/src/space.c
>
===================================================================
> --- branches/ndof/source/blender/src/space.c
> 2007-07-31 16:56:08 UTC (rev 11448)
> +++ branches/ndof/source/blender/src/space.c
> 2007-07-31 17:45:26 UTC (rev 11449)
> @@ -1573,7 +1573,9 @@
> } else if (G.vd->ndofmode == 1) {
> viewmoveNDOFfly(1);
> } else {
> - ;
> + if (OBACT) {
> + ndof_transform();
> + }
> }
>
> break;
>
> Modified:
> branches/ndof/source/blender/src/transform.c
>
===================================================================
> --- branches/ndof/source/blender/src/transform.c
> 2007-07-31 16:56:08 UTC (rev 11448)
> +++ branches/ndof/source/blender/src/transform.c
> 2007-07-31 17:45:26 UTC (rev 11449)
> @@ -3106,4 +3106,98 @@
> 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
>
> Modified: branches/ndof/source/blender/src/view.c
>
===================================================================
> --- branches/ndof/source/blender/src/view.c
> 2007-07-31 16:56:08 UTC (rev 11448)
> +++ branches/ndof/source/blender/src/view.c
> 2007-07-31 17:45:26 UTC (rev 11449)
> @@ -2214,3 +2214,22 @@
> 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);
> +}
>
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
>
http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>
____________________________________________________________________________________
Yahoo! oneSearch: Finally, mobile search
that gives answers, not web links.
http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC
More information about the Bf-committers
mailing list