From 5ebe91ca1f75526f95324f0bc16f38fec5b632f2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 7 Mar 2012 19:42:22 +0000 Subject: change camera zoom from short to float. --- source/blender/editors/space_view3d/view3d_edit.c | 4 +- source/blender/makesdna/DNA_view3d_types.h | 52 +++++++++++----------- source/blender/makesrna/intern/rna_space.c | 5 ++- .../BlenderRoutines/BL_KetsjiEmbedStart.cpp | 2 +- 4 files changed, 33 insertions(+), 30 deletions(-) diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 449ec953626..e3ab8cf7f11 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -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) { diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 0758e6e1713..610513ca860 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -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; diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 3b34ec235a3..70ed4ffbb0f 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -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); diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 493516aeef4..d8bb45707e5 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -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 { -- cgit v1.2.3