change camera zoom from short to float.

This commit is contained in:
Campbell Barton
2012-03-07 19:42:22 +00:00
parent e5464db95d
commit 5ebe91ca1f
4 changed files with 33 additions and 30 deletions

View 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) {

View File

@@ -94,6 +94,24 @@ typedef struct RegionView3D {
float viewmatob[4][4];
float persmatob[4][4];
/* 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 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];
@@ -104,32 +122,17 @@ typedef struct RegionView3D {
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;
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 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 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;
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;

View 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);

View 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 {