Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-07-01 06:45:19 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-07-01 06:45:19 +0300
commit45b221834184e6bdc28e83338014ddea6eb1fad0 (patch)
treee94e3b767571ad403324172ef996e179d61d84af /intern/ghost
parentb71c27a446407448cb19660eb1564fe1d12c8281 (diff)
User Prefs for NDOF dead-zone
D1344 with edits
Diffstat (limited to 'intern/ghost')
-rw-r--r--intern/ghost/GHOST_C-api.h10
-rw-r--r--intern/ghost/GHOST_ISystem.h6
-rw-r--r--intern/ghost/intern/GHOST_C-api.cpp7
-rw-r--r--intern/ghost/intern/GHOST_NDOFManagerWin32.cpp2
-rw-r--r--intern/ghost/intern/GHOST_NDOFManagerX11.cpp2
-rw-r--r--intern/ghost/intern/GHOST_System.cpp9
-rw-r--r--intern/ghost/intern/GHOST_System.h10
7 files changed, 43 insertions, 3 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.
***************************************************************************************/