[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44713] trunk/blender/source/blender/ editors/space_view3d/view3d_edit.c: Another mango request: Ctrl-MMB zoom in camera view

Campbell Barton ideasman42 at gmail.com
Wed Mar 7 20:42:52 CET 2012


dna handles these kinds of conversions,
short -> float committed r44718.

On Thu, Mar 8, 2012 at 6:15 AM, Sergey Sharybin <sergey.vfx at gmail.com> wrote:
> It's feels "stepped" because it's internally an integer value which doesn't
> allow to do smooth zooming. Not sure if it's possible to change this thing
> to float safety, will investigate this further.
>
> On Wed, Mar 7, 2012 at 7:45 PM, Daniel Salazar - 3Developer.com <
> zanqdo at gmail.com> wrote:
>
>> nice, however feels a bit "stepped"
>>
>> Daniel Salazar
>> patazstudio.com
>>
>>
>>
>> On Wed, Mar 7, 2012 at 12:34 PM, Sergey Sharybin <sergey.vfx at gmail.com>
>> wrote:
>> > Revision: 44713
>> >
>> http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44713
>> > Author:   nazgul
>> > Date:     2012-03-07 18:34:16 +0000 (Wed, 07 Mar 2012)
>> > Log Message:
>> > -----------
>> > Another mango request: Ctrl-MMB zoom in camera view
>> > It makes it much easier to zoom in camera view using the tablet.
>> >
>> > Modified Paths:
>> > --------------
>> >    trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
>> >
>> > Modified: trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
>> > ===================================================================
>> > --- trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
>> 2012-03-07 18:27:12 UTC (rev 44712)
>> > +++ trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
>> 2012-03-07 18:34:16 UTC (rev 44713)
>> > @@ -356,7 +356,7 @@
>> >        float viewquat[4]; /* working copy of rv3d->viewquat */
>> >        float trackvec[3];
>> >        float mousevec[3]; /* dolly only */
>> > -       float reverse, dist0;
>> > +       float reverse, dist0, camzoom0;
>> >        float grid, far;
>> >        short axis_snap; /* view rotate only */
>> >
>> > @@ -416,6 +416,7 @@
>> >        ED_view3d_camera_lock_init(vod->v3d, vod->rv3d);
>> >
>> >        vod->dist0= rv3d->dist;
>> > +       vod->camzoom0= rv3d->camzoom;
>> >        copy_qt_qt(vod->viewquat, rv3d->viewquat);
>> >        copy_qt_qt(vod->oldquat, rv3d->viewquat);
>> >        vod->origx= vod->oldx= event->x;
>> > @@ -1468,7 +1469,18 @@
>> >  static void viewzoom_apply(ViewOpsData *vod, int x, int y, const short
>> viewzoom, const short zoom_invert)
>> >  {
>> >        float zfac=1.0;
>> > +       short use_cam_zoom;
>> >
>> > +       use_cam_zoom = (vod->rv3d->persp==RV3D_CAMOB) &&
>> !(vod->rv3d->is_persp && ED_view3d_camera_lock_check(vod->v3d, vod->rv3d));
>> > +
>> > +       if (use_cam_zoom) {
>> > +               float delta;
>> > +               delta = (x - vod->origx + y - vod->origy) / 10.0f;
>> > +               vod->rv3d->camzoom = vod->camzoom0 + delta;
>> > +
>> > +               if (vod->rv3d->camzoom > RV3D_CAMZOOM_MAX)
>> > +                       vod->rv3d->camzoom = RV3D_CAMZOOM_MAX;
>> > +       }
>> >        if (viewzoom==USER_ZOOM_CONT) {
>> >                double time= PIL_check_seconds_timer();
>> >                float time_step= (float)(time - vod->timer_lastdraw);
>> > @@ -1516,12 +1528,20 @@
>> >                        SWAP(float, len1, len2);
>> >                }
>> >
>> > -               zfac = vod->dist0 * (2.0f * ((len2/len1)-1.0f) + 1.0f) /
>> vod->rv3d->dist;
>> > +               if (use_cam_zoom) {
>> > +                       zfac = vod->camzoom0 * (2.0f *
>> ((len2/len1)-1.0f) + 1.0f) / vod->rv3d->camzoom;
>> > +                       zfac = 0;
>> > +               }
>> > +               else {
>> > +                       zfac = vod->dist0 * (2.0f * ((len2/len1)-1.0f) +
>> 1.0f) / vod->rv3d->dist;
>> > +               }
>> >        }
>> >
>> > -       if (zfac != 1.0f && zfac*vod->rv3d->dist > 0.001f * vod->grid &&
>> > -                       zfac * vod->rv3d->dist < 10.0f * vod->far)
>> > -               view_zoom_mouseloc(vod->ar, zfac, vod->oldx, vod->oldy);
>> > +       if (!use_cam_zoom) {
>> > +               if (zfac != 1.0f && zfac*vod->rv3d->dist > 0.001f *
>> vod->grid &&
>> > +                               zfac * vod->rv3d->dist < 10.0f *
>> vod->far)
>> > +                       view_zoom_mouseloc(vod->ar, zfac, vod->oldx,
>> vod->oldy);
>> > +       }
>> >
>> >        /* these limits were in old code too */
>> >        if (vod->rv3d->dist<0.001f * vod->grid) vod->rv3d->dist= 0.001f *
>> vod->grid;
>> >
>> > _______________________________________________
>> > Bf-blender-cvs mailing list
>> > Bf-blender-cvs at blender.org
>> > http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>> _______________________________________________
>> Bf-committers mailing list
>> Bf-committers at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-committers
>>
>
>
>
> --
> With best regards, Sergey Sharybin
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers



-- 
- Campbell


More information about the Bf-committers mailing list