diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-07-01 06:45:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-07-01 06:45:19 +0300 |
commit | 45b221834184e6bdc28e83338014ddea6eb1fad0 (patch) | |
tree | e94e3b767571ad403324172ef996e179d61d84af | |
parent | b71c27a446407448cb19660eb1564fe1d12c8281 (diff) |
User Prefs for NDOF dead-zone
D1344 with edits
-rw-r--r-- | intern/ghost/GHOST_C-api.h | 10 | ||||
-rw-r--r-- | intern/ghost/GHOST_ISystem.h | 6 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_C-api.cpp | 7 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_NDOFManagerWin32.cpp | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_NDOFManagerX11.cpp | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_System.cpp | 9 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_System.h | 10 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_userpref.py | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_blender.h | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/resources.c | 4 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 11 | ||||
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 3 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 5 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_init_exit.c | 3 |
15 files changed, 76 insertions, 7 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index 8a80a51a77b..7715979d8bf 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -434,6 +434,16 @@ extern GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle, GHOST_TButtonMask mask, int *isDown); +/*************************************************************************************** + * Access to 3D mouse. + ***************************************************************************************/ + +/** + * Sets 3D mouse deadzone + * \param deadzone Deadzone of the 3D mouse (both for rotation and pan) relative to full range + */ +extern void GHOST_setNDOFDeadZone(float deadzone); + /*************************************************************************************** * Drag'n'drop operations diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h index 25908a54872..33540f3069d 100644 --- a/intern/ghost/GHOST_ISystem.h +++ b/intern/ghost/GHOST_ISystem.h @@ -379,6 +379,12 @@ public: virtual GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool& isDown) const = 0; /** + * Sets 3D mouse deadzone + * \param deadzone: Deadzone of the 3D mouse (both for rotation and pan) relative to full range + */ + virtual void setNDOFDeadZone(float deadzone) = 0; + + /** * Toggles console * \param action * - 0: Hides diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp index 8d01e8ac3a6..af992bf5a3c 100644 --- a/intern/ghost/intern/GHOST_C-api.cpp +++ b/intern/ghost/intern/GHOST_C-api.cpp @@ -413,6 +413,13 @@ GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle, } +void GHOST_setNDOFDeadZone(float deadzone) +{ + GHOST_ISystem *system = GHOST_ISystem::getSystem(); + system->setNDOFDeadZone(deadzone); +} + + void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, GHOST_TInt8 canAccept) { GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; diff --git a/intern/ghost/intern/GHOST_NDOFManagerWin32.cpp b/intern/ghost/intern/GHOST_NDOFManagerWin32.cpp index 6c1627905e0..7ccd2e602b4 100644 --- a/intern/ghost/intern/GHOST_NDOFManagerWin32.cpp +++ b/intern/ghost/intern/GHOST_NDOFManagerWin32.cpp @@ -30,7 +30,7 @@ GHOST_NDOFManagerWin32::GHOST_NDOFManagerWin32(GHOST_System& sys) : GHOST_NDOFManager(sys) { - setDeadZone(0.1f); + /* pass */ } // whether multi-axis functionality is available (via the OS or driver) diff --git a/intern/ghost/intern/GHOST_NDOFManagerX11.cpp b/intern/ghost/intern/GHOST_NDOFManagerX11.cpp index 75e476c287f..753321be58e 100644 --- a/intern/ghost/intern/GHOST_NDOFManagerX11.cpp +++ b/intern/ghost/intern/GHOST_NDOFManagerX11.cpp @@ -33,8 +33,6 @@ GHOST_NDOFManagerX11::GHOST_NDOFManagerX11(GHOST_System& sys) : GHOST_NDOFManager(sys), m_available(false) { - setDeadZone(0.1f); /* how to calibrate on Linux? throw away slight motion! */ - if (spnav_open() != -1) { m_available = true; diff --git a/intern/ghost/intern/GHOST_System.cpp b/intern/ghost/intern/GHOST_System.cpp index baa1bdff79a..1698d2f0f31 100644 --- a/intern/ghost/intern/GHOST_System.cpp +++ b/intern/ghost/intern/GHOST_System.cpp @@ -295,6 +295,15 @@ GHOST_TSuccess GHOST_System::getButtonState(GHOST_TButtonMask mask, bool& isDown return success; } +void GHOST_System::setNDOFDeadZone(float deadzone) +{ +#ifdef WITH_INPUT_NDOF + this->m_ndofManager->setDeadZone(deadzone); +#else + (void)deadzone; +#endif +} + GHOST_TSuccess GHOST_System::init() { m_timerManager = new GHOST_TimerManager(); diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h index 4f689ce43c9..9dcba11527c 100644 --- a/intern/ghost/intern/GHOST_System.h +++ b/intern/ghost/intern/GHOST_System.h @@ -238,6 +238,16 @@ public: GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool& isDown) const; /*************************************************************************************** + * Access to 3D mouse. + ***************************************************************************************/ + + /** + * Sets 3D mouse deadzone + * \param deadzone: Deadzone of the 3D mouse (both for rotation and pan) relative to full range + */ + void setNDOFDeadZone(float deadzone); + + /*************************************************************************************** * Other (internal) functionality. ***************************************************************************************/ diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 0272f752bab..58bb383e84c 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -988,6 +988,7 @@ class USERPREF_MT_ndof_settings(Menu): layout.prop(input_prefs, "ndof_sensitivity") layout.prop(input_prefs, "ndof_orbit_sensitivity") + layout.prop(input_prefs, "ndof_deadzone") if is_view3d: layout.separator() @@ -1130,10 +1131,12 @@ class USERPREF_PT_input(Panel): sub.prop(walk, "jump_height") col.separator() - sub = col.column() - sub.label(text="NDOF Device:") + col.label(text="NDOF Device:") + sub = col.column(align=True) sub.prop(inputs, "ndof_sensitivity", text="NDOF Sensitivity") sub.prop(inputs, "ndof_orbit_sensitivity", text="NDOF Orbit Sensitivity") + sub.prop(inputs, "ndof_deadzone", text="NDOF Deadzone") + sub = col.column(align=True) sub.row().prop(inputs, "ndof_view_navigate_method", expand=True) sub.row().prop(inputs, "ndof_view_rotate_method", expand=True) diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 8367fd4369f..1638ba4521d 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -42,7 +42,7 @@ extern "C" { * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 275 -#define BLENDER_SUBVERSION 1 +#define BLENDER_SUBVERSION 2 /* Several breakages with 270, e.g. constraint deg vs rad */ #define BLENDER_MINVERSION 270 #define BLENDER_MINSUBVERSION 5 diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index b9d88176dba..e8311443123 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -2631,6 +2631,10 @@ void init_userdef_do_versions(void) } } + if (!USER_VERSION_ATLEAST(275, 2)) { + U.ndof_deadzone = 0.1; + } + if (U.pixelsize == 0.0f) U.pixelsize = 1.0f; diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 3a0e346d0c8..48ed3563d53 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -491,7 +491,6 @@ typedef struct UserDef { int memcachelimit; int prefetchframes; float pad_rot_angle; /* control the rotation step of the view when PAD2, PAD4, PAD6&PAD8 is use */ - float pad3; short frameserverport; short pad4; short obcenter_dia; @@ -519,6 +518,7 @@ typedef struct UserDef { float ndof_sensitivity; /* overall sensitivity of 3D mouse */ float ndof_orbit_sensitivity; + float ndof_deadzone; /* deadzone of 3D mouse */ int ndof_flag; /* flags for 3D mouse */ short ogl_multisamples; /* amount of samples for OpenGL FSA, if zero no FSA */ diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 9123a0682e6..9604f643149 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -267,6 +267,12 @@ static void rna_userdef_autokeymode_set(PointerRNA *ptr, int value) } } +static void rna_userdef_ndof_deadzone_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +{ + UserDef *userdef = ptr->data; + WM_ndof_deadzone_set(userdef->ndof_deadzone); +} + static void rna_userdef_timecode_style_set(PointerRNA *ptr, int value) { UserDef *userdef = (UserDef *)ptr->data; @@ -4303,6 +4309,11 @@ static void rna_def_userdef_input(BlenderRNA *brna) RNA_def_property_range(prop, 0.01f, 40.0f); RNA_def_property_ui_text(prop, "Orbit Sensitivity", "Overall sensitivity of the 3D Mouse for orbiting"); + prop = RNA_def_property(srna, "ndof_deadzone", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text(prop, "Deadzone", "Deadzone of the 3D Mouse"); + RNA_def_property_update(prop, 0, "rna_userdef_ndof_deadzone_update"); + prop = RNA_def_property(srna, "ndof_pan_yz_swap_axis", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_PAN_YZ_SWAP_AXIS); RNA_def_property_ui_text(prop, "Y/Z Swap Axis", diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index bdb373a78ba..9e27190de02 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -181,6 +181,9 @@ void WM_event_add_mousemove(struct bContext *C); bool WM_modal_tweak_exit(const struct wmEvent *event, int tweak_event); bool WM_event_is_absolute(const struct wmEvent *event); + /* 3D mouse */ +void WM_ndof_deadzone_set(float deadzone); + /* notifiers */ void WM_event_add_notifier(const struct bContext *C, unsigned int type, void *reference); void WM_main_add_notifier(unsigned int type, void *reference); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 075390f9a15..15b155c8649 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -623,6 +623,11 @@ bool WM_event_is_absolute(const wmEvent *event) return (event->tablet_data != NULL); } +void WM_ndof_deadzone_set(float deadzone) +{ + GHOST_setNDOFDeadZone(deadzone); +} + static void wm_add_reports(const bContext *C, ReportList *reports) { /* if the caller owns them, handle this */ diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index edca1f97ecf..dc36cfbaf57 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -171,6 +171,9 @@ void WM_init(bContext *C, int argc, const char **argv) /* get the default database, plus a wm */ wm_homefile_read(C, NULL, G.factory_startup, NULL); + /* sets 3D mouse deadzone */ + WM_ndof_deadzone_set(U.ndof_deadzone); + BLF_lang_set(NULL); if (!G.background) { |