diff options
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 14 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 11 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 6 |
3 files changed, 28 insertions, 3 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 0c07df9fd01..aabacadf3db 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1019,6 +1019,8 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *op, wmEvent *event) if (has_rotation) { + const int invert = U.ndof_flag & NDOF_ORBIT_INVERT_AXES; + rv3d->view = RV3D_VIEW_USER; if (U.flag & USER_TRACKBALL) { @@ -1027,8 +1029,8 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *op, wmEvent *event) float view_inv[4], view_inv_conj[4]; ndof_to_quat(ndof, rot); - // scale by rot_sensitivity? - // mul_qt_fl(rot, rot_sensitivity); + // mul_qt_fl(rot, rot_sensitivity * (invert ? -1.f : 1.f)); + // ^^ no apparent effect invert_qt_qt(view_inv, rv3d->viewquat); copy_qt_qt(view_inv_conj, view_inv); @@ -1038,6 +1040,10 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *op, wmEvent *event) mul_qt_qtqt(rot, view_inv, rot); mul_qt_qtqt(rot, rot, view_inv_conj); + // if (invert) + // invert_qt(rot); + // ^^ argh!! this does something crazy + // apply rotation mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot); @@ -1053,12 +1059,16 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *op, wmEvent *event) /* Perform the up/down rotation */ angle = rot_sensitivity * dt * ndof->rx; + if (invert) + angle = -angle; rot[0] = cos(angle); mul_v3_v3fl(rot+1, xvec, sin(angle)); mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot); /* Perform the orbital rotation */ angle = rot_sensitivity * dt * ndof->ry; + if (invert) + angle = -angle; rot[0] = cos(angle); rot[1] = rot[2] = 0.0; rot[3] = sin(angle); diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 6fbdb9842d6..12f8cd656a0 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -589,6 +589,17 @@ extern UserDef U; /* from blenkernel blender.c */ #define NDOF_SHOULD_PAN (1 << 3) #define NDOF_SHOULD_ZOOM (1 << 4) #define NDOF_SHOULD_ROTATE (1 << 5) +/* orbit navigation modes + only two options, so it's sort of a hyrbrid bool/enum + if ((U.ndof_flag & NDOF_ORBIT_MODE) == NDOF_OM_OBJECT)... */ +/* +#define NDOF_ORBIT_MODE (1 << 6) +#define NDOF_OM_TARGETCAMERA 0 +#define NDOF_OM_OBJECT NDOF_ORBIT_MODE +*/ +/* actually... users probably don't care about what the mode + is called, just that it feels right */ +#define NDOF_ORBIT_INVERT_AXES (1 << 6) #ifdef __cplusplus diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 50b5e99804c..7a9193571fd 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2748,13 +2748,17 @@ static void rna_def_userdef_input(BlenderRNA *brna) 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_orbit_invert_axes", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ORBIT_INVERT_AXES); + RNA_def_property_ui_text(prop, "Invert Axes", "Toggle between moving the viewpoint or moving the scene being viewed"); + prop= RNA_def_property(srna, "ndof_lock_horizon", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_LOCK_HORIZON); RNA_def_property_ui_text(prop, "Lock Horizon", "Keep horizon level while flying with 3D Mouse"); prop= RNA_def_property(srna, "ndof_fly_helicopter", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_FLY_HELICOPTER); - RNA_def_property_ui_text(prop, "Helicopter Fly Mode", ""); + RNA_def_property_ui_text(prop, "Helicopter Mode", "Device up/down directly controls your Z position"); prop= RNA_def_property(srna, "mouse_double_click_time", PROP_INT, PROP_NONE); |