change camera zoom from short to float.
authorCampbell Barton <ideasman42@gmail.com>
Wed, 7 Mar 2012 19:42:22 +0000 (19:42 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 7 Mar 2012 19:42:22 +0000 (19:42 +0000)
source/blender/editors/space_view3d/view3d_edit.c
source/blender/makesdna/DNA_view3d_types.h
source/blender/makesrna/intern/rna_space.c
source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp

index 449ec953626f75762b2ed65667ee08fb6dd4ff78..e3ab8cf7f1125cd0711804a1d3b638010b8f58de 100644 (file)
@@ -1633,7 +1633,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
        if (delta < 0) {
                /* this min and max is also in viewmove() */
                if (use_cam_zoom) {
-                       rv3d->camzoom-= 10;
+                       rv3d->camzoom -= 10.0f;
                        if (rv3d->camzoom < RV3D_CAMZOOM_MIN) rv3d->camzoom= RV3D_CAMZOOM_MIN;
                }
                else if (rv3d->dist < 10.0f * v3d->far) {
@@ -1642,7 +1642,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
        }
        else {
                if (use_cam_zoom) {
-                       rv3d->camzoom+= 10;
+                       rv3d->camzoom += 10.0f;
                        if (rv3d->camzoom > RV3D_CAMZOOM_MAX) rv3d->camzoom= RV3D_CAMZOOM_MAX;
                }
                else if (rv3d->dist> 0.001f * v3d->grid) {
index 0758e6e1713a71d8a7c1f172ace5749b67abaa6d..610513ca86003a8d3c11f518dcf7502e9c05c56e 100644 (file)
@@ -94,42 +94,45 @@ typedef struct RegionView3D {
        float viewmatob[4][4];
        float persmatob[4][4];
 
-       /* transform widget matrix */
-       float twmat[4][4];
 
-       float viewquat[4];                      /* view rotation, must be kept normalized */
-       float dist;                                     /* distance from 'ofs' along -viewinv[2] vector, where result is negative as is 'ofs' */
-       float zfac;                                     /* initgrabz() result */
-       float camdx, camdy;                     /* camera view offsets, 1.0 = viewplane moves entire width/height */
-       float pixsize;                          /* runtime only */
-       float ofs[3];                           /* view center & orbit pivot, negative of worldspace location,
-                                                                * also matches -viewinv[3][0:3] in ortho mode.*/
-       short camzoom;                          /* viewport zoom on the camera frame, see BKE_screen_view3d_zoom_to_fac */
-       short twdrawflag;
-       char is_persp;                          /* check if persp/ortho view, since 'persp' cant be used for this since
-                                                                * it can have cameras assigned as well. (only set in setwinmatrixview3d) */
-       char pad[3];
-       
-       short rflag, viewlock;
-       short persp;
-       short view;
-       
        /* user defined clipping planes */
        float clip[6][4];
        float clip_local[6][4]; /* clip in object space, means we can test for clipping in editmode without first going into worldspace */
-       struct BoundBox *clipbb;        
-       
+       struct BoundBox *clipbb;
+
        struct bGPdata *gpd;            /* Grease-Pencil Data (annotation layers) */
-       
+
        struct RegionView3D *localvd; /* allocated backup of its self while in localview */
        struct RenderInfo *ri;
        struct RenderEngine *render_engine;
        struct ViewDepths *depths;
-       
+
        /* animated smooth view */
        struct SmoothViewStore *sms;
        struct wmTimer *smooth_timer;
+
+
+       /* transform widget matrix */
+       float twmat[4][4];
+
+       float viewquat[4];                      /* view rotation, must be kept normalized */
+       float dist;                                     /* distance from 'ofs' along -viewinv[2] vector, where result is negative as is 'ofs' */
+       float zfac;                                     /* initgrabz() result */
+       float camdx, camdy;                     /* camera view offsets, 1.0 = viewplane moves entire width/height */
+       float pixsize;                          /* runtime only */
+       float ofs[3];                           /* view center & orbit pivot, negative of worldspace location,
+                                                                * also matches -viewinv[3][0:3] in ortho mode.*/
+       float camzoom;                          /* viewport zoom on the camera frame, see BKE_screen_view3d_zoom_to_fac */
+       char is_persp;                          /* check if persp/ortho view, since 'persp' cant be used for this since
+                                                                * it can have cameras assigned as well. (only set in setwinmatrixview3d) */
+       char persp;
+       char view;
+       char viewlock;
+
+       short twdrawflag;
+       short rflag;
        
+
        /* last view */
        float lviewquat[4];
        short lpersp, lview; /* lpersp can never be set to 'RV3D_CAMOB' */
@@ -137,11 +140,10 @@ typedef struct RegionView3D {
        
        float twangle[3];
 
+
        /* active rotation from NDOF or elsewhere */
        float rot_angle;
        float rot_axis[3];
-       
-       char pad2[4];
 
 } RegionView3D;
 
index 3b34ec235a33cd7cadf9fe951166a6119f06ab63..70ed4ffbb0f97080f911e35f207b5f1fdca021d4 100644 (file)
@@ -1728,9 +1728,10 @@ static void rna_def_space_view3d(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Distance", "Distance to the view location");
        RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-       prop = RNA_def_property(srna, "view_camera_zoom", PROP_INT, PROP_UNSIGNED);
-       RNA_def_property_int_sdna(prop, NULL, "camzoom");
+       prop = RNA_def_property(srna, "view_camera_zoom", PROP_FLOAT, PROP_UNSIGNED);
+       RNA_def_property_float_sdna(prop, NULL, "camzoom");
        RNA_def_property_ui_text(prop, "Camera Zoom", "Zoom factor in camera view");
+       RNA_def_property_range(prop, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
        RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
        prop = RNA_def_property(srna, "view_camera_offset", PROP_FLOAT, PROP_NONE);
index 493516aeef4fd0424d1391886b98fa5aaa21e6e9..d8bb45707e504bac3541fb9878d0f753909601ae 100644 (file)
@@ -269,7 +269,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
                                draw_letterbox = 1;
                        }
                        else {
-                               camzoom = 1.0 / BKE_screen_view3d_zoom_to_fac(rv3d->camzoom);
+                               camzoom = 1.0f / BKE_screen_view3d_zoom_to_fac(rv3d->camzoom);
                        }
                }
                else {