diff options
author | Mike Erwin <significant.bit@gmail.com> | 2011-07-22 01:40:04 +0400 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2011-07-22 01:40:04 +0400 |
commit | 407a2a8439f61922139a3c5d1607818234924fe1 (patch) | |
tree | 16621723461af6ae26f3774c3bc2235b76bd0968 /source | |
parent | 2258afc1be78a2cd629f0efb8e5d69acc4c58d2c (diff) |
tweaked ephemeral ndof data types
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_fly.c | 18 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 5 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_view3d_types.h | 7 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 16 |
4 files changed, 21 insertions, 25 deletions
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 6955aefcb9e..1122438da96 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -929,8 +929,15 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly) wmNDOFMotionData* ndof = fly->ndof; const float dt = ndof->dt; RegionView3D* rv3d = fly->rv3d; + const int flag = U.ndof_flag; - const int shouldRotate = 1, shouldTranslate = 1; + const int shouldRotate = TRUE, + shouldTranslate = TRUE; + + // const int shouldRotate = flag & NDOF_SHOULD_ROTATE, + // shouldTranslate = flag & (NDOF_SHOULD_PAN | NDOF_SHOULD_ZOOM); + // might also be something in FlyInfo that restricts motion + // if so, change these ^^ float view_inv[4]; invert_qt_qt(view_inv, rv3d->viewquat); @@ -955,7 +962,7 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly) // transform motion from view to world coordinates mul_qt_v3(view_inv, trans); - if (U.ndof_flag & NDOF_FLY_HELICOPTER) + if (flag & NDOF_FLY_HELICOPTER) // could also use RNA to get a simple boolean value { // replace world z component with device y (yes it makes sense) @@ -981,9 +988,9 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly) // apply rotation to view axis_angle_to_quat(rotation, axis, angle); - mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rotation); + mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rotation); - if (U.ndof_flag & NDOF_LOCK_HORIZON) + if (flag & NDOF_LOCK_HORIZON) // force an upright viewpoint // TODO: make this less... sudden { @@ -992,6 +999,7 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly) // find new inverse since viewquat has changed invert_qt_qt(view_inv, rv3d->viewquat); + // could apply reverse rotation to existing view_inv to save a few cycles // transform view vectors to world coordinates mul_qt_v3(view_inv, view_horizon); @@ -1007,7 +1015,7 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly) // rotate view so view horizon = world horizon axis_angle_to_quat(rotation, view_direction, angle); - mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rotation); + mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rotation); } rv3d->view = RV3D_VIEW_USER; diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index a94c10a7aa0..6fbdb9842d6 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -365,7 +365,6 @@ typedef struct UserDef { short recent_files; /* maximum number of recently used files to remember */ short smooth_viewtx; /* miliseconds to spend spinning the view */ short glreslimit; -/* short ndof_pan, ndof_rotate; */ short curssize; short color_picker_type; short ipo_new; /* interpolation mode for newly added F-Curves */ @@ -586,11 +585,11 @@ extern UserDef U; /* from blenkernel blender.c */ #define NDOF_FLY_HELICOPTER (1 << 1) #define NDOF_LOCK_HORIZON (1 << 2) /* the following might not need to be saved between sessions, - but they do need to live somewhere accessible... + but they do need to live somewhere accessible... */ #define NDOF_SHOULD_PAN (1 << 3) #define NDOF_SHOULD_ZOOM (1 << 4) #define NDOF_SHOULD_ROTATE (1 << 5) -*/ + #ifdef __cplusplus } diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 7379493003d..27ffc6d856b 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -190,11 +190,10 @@ typedef struct View3D { /* drawflags, denoting state */ short zbuf, transp, xray; - char ndofmode; /* mode of transform for 6DOF devices -1 not found, 0 normal, 1 fly, 2 ob transform */ - char ndoffilter; /* filter for 6DOF devices 0 normal, 1 dominant */ - + char pad3[2]; + void *properties_storage; /* Nkey panel stores stuff here (runtime only!) */ - + /* XXX depricated? */ struct bGPdata *gpd; /* Grease-Pencil Data (annotation layers) */ diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 664cb7732f9..50b5e99804c 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2739,24 +2739,14 @@ static void rna_def_userdef_input(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Drag Threshold", "Amount of pixels you have to drag before dragging UI items happens"); /* 3D mouse settings */ -/* - prop= RNA_def_property(srna, "ndof_pan_speed", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "ndof_pan"); - RNA_def_property_range(prop, 0, 200); - RNA_def_property_ui_text(prop, "NDof Pan Speed", "The overall panning speed of an NDOF device, as percent of standard"); - - prop= RNA_def_property(srna, "ndof_rotate_speed", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "ndof_rotate"); - RNA_def_property_range(prop, 0, 200); - RNA_def_property_ui_text(prop, "NDof Rotation Speed", "The overall rotation speed of an NDOF device, as percent of standard"); -*/ prop= RNA_def_property(srna, "ndof_sensitivity", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.25f, 4.0f); - RNA_def_property_ui_text(prop, "3D Mouse Sensitivity", "Baseline sensitivity of the 3D Mouse"); + RNA_def_property_ui_text(prop, "Sensitivity", "Overall sensitivity of the 3D Mouse"); prop= RNA_def_property(srna, "ndof_show_guide", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_SHOW_GUIDE); - RNA_def_property_ui_text(prop, "Show 3D Mouse Guide", "Visualize the center and axis of rotation (or projected position in fly mode)"); + RNA_def_property_ui_text(prop, "Show Navigation Guide", "Display the center and axis during rotation"); + /* TODO: update description when fly-mode visuals are in place ("projected position in fly mode")*/ prop= RNA_def_property(srna, "ndof_lock_horizon", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_LOCK_HORIZON); |