[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39007] trunk/blender/intern/ghost/intern: stricter guards for disabling NDOF code (will test in 3..
Mike Erwin
significant.bit at gmail.com
Thu Aug 4 05:14:03 CEST 2011
Revision: 39007
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39007
Author: merwin
Date: 2011-08-04 03:14:00 +0000 (Thu, 04 Aug 2011)
Log Message:
-----------
stricter guards for disabling NDOF code (will test in 3.. 2.. 1..)
Modified Paths:
--------------
trunk/blender/intern/ghost/intern/GHOST_NDOFManagerWin32.cpp
trunk/blender/intern/ghost/intern/GHOST_NDOFManagerWin32.h
trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
Modified: trunk/blender/intern/ghost/intern/GHOST_NDOFManagerWin32.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_NDOFManagerWin32.cpp 2011-08-04 01:56:36 UTC (rev 39006)
+++ trunk/blender/intern/ghost/intern/GHOST_NDOFManagerWin32.cpp 2011-08-04 03:14:00 UTC (rev 39007)
@@ -22,7 +22,9 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
-
+
+#ifdef WITH_INPUT_NDOF // use contents of this file
+
#include "GHOST_NDOFManagerWin32.h"
@@ -39,3 +41,5 @@
// always available since RawInput is built into Windows
return true;
}
+
+#endif // WITH_INPUT_NDOF
Modified: trunk/blender/intern/ghost/intern/GHOST_NDOFManagerWin32.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_NDOFManagerWin32.h 2011-08-04 01:56:36 UTC (rev 39006)
+++ trunk/blender/intern/ghost/intern/GHOST_NDOFManagerWin32.h 2011-08-04 03:14:00 UTC (rev 39007)
@@ -22,10 +22,13 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
-
+
+
#ifndef _GHOST_NDOFMANAGERWIN32_H_
#define _GHOST_NDOFMANAGERWIN32_H_
+#ifdef WITH_INPUT_NDOF
+
#include "GHOST_NDOFManager.h"
@@ -37,4 +40,5 @@
};
-#endif
+#endif // WITH_INPUT_NDOF
+#endif // #include guard
Modified: trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp 2011-08-04 01:56:36 UTC (rev 39006)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp 2011-08-04 03:14:00 UTC (rev 39007)
@@ -62,7 +62,6 @@
#endif
#endif
-#include "GHOST_Debug.h"
#include "GHOST_DisplayManagerWin32.h"
#include "GHOST_EventButton.h"
#include "GHOST_EventCursor.h"
@@ -72,7 +71,10 @@
#include "GHOST_TimerManager.h"
#include "GHOST_WindowManager.h"
#include "GHOST_WindowWin32.h"
+
+#ifdef WITH_INPUT_NDOF
#include "GHOST_NDOFManagerWin32.h"
+#endif
// Key code values not found in winuser.h
#ifndef VK_MINUS
@@ -127,22 +129,32 @@
static void initRawInput()
{
- RAWINPUTDEVICE devices[2];
- memset(devices, 0, 2 * sizeof(RAWINPUTDEVICE));
+#ifdef WITH_INPUT_NDOF
+#define DEVICE_COUNT 2
+#else
+#define DEVICE_COUNT 1
+#endif
- // multi-axis mouse (SpaceNavigator, etc.)
- devices[0].usUsagePage = 0x01;
- devices[0].usUsage = 0x08;
+ RAWINPUTDEVICE devices[DEVICE_COUNT];
+ memset(devices, 0, DEVICE_COUNT * sizeof(RAWINPUTDEVICE));
// Initiates WM_INPUT messages from keyboard
// That way GHOST can retrieve true keys
+ devices[0].usUsagePage = 0x01;
+ devices[0].usUsage = 0x06; /* http://msdn.microsoft.com/en-us/windows/hardware/gg487473.aspx */
+
+#ifdef WITH_INPUT_NDOF
+ // multi-axis mouse (SpaceNavigator, etc.)
devices[1].usUsagePage = 0x01;
- devices[1].usUsage = 0x06; /* http://msdn.microsoft.com/en-us/windows/hardware/gg487473.aspx */
+ devices[1].usUsage = 0x08;
+#endif
- if (RegisterRawInputDevices(devices, 2, sizeof(RAWINPUTDEVICE)))
- puts("registered for RawInput (spacenav & keyboard)");
+ if (RegisterRawInputDevices(devices, DEVICE_COUNT, sizeof(RAWINPUTDEVICE)))
+ ; // yay!
else
printf("could not register for RawInput: %d\n", (int)GetLastError());
+
+#undef DEVICE_COUNT
}
GHOST_SystemWin32::GHOST_SystemWin32()
@@ -808,6 +820,7 @@
case 1: // translation
{
short* axis = (short*)(data + 1);
+ // massage into blender view coords (same goes for rotation)
short t[3] = {axis[0], -axis[2], axis[1]};
m_ndofManager->updateTranslation(t, now);
@@ -830,14 +843,6 @@
}
case 3: // buttons
{
-#if 0
- // I'm getting garbage bits -- examine whole report:
- printf("ndof: HID report for buttons [");
- for (int i = 0; i < raw.data.hid.dwSizeHid; ++i)
- printf(" %02X", data[i]);
- printf(" ]\n");
-#endif
-
int button_bits;
memcpy(&button_bits, data + 1, sizeof(button_bits));
m_ndofManager->updateButtons(button_bits, now);
@@ -892,12 +897,12 @@
GHOST_PRINT(" key ignored\n")
}
break;
+#ifdef WITH_INPUT_NDOF
case RIM_TYPEHID:
-#ifdef WITH_INPUT_NDOF
if (system->processNDOF(raw))
eventHandled = true;
+ break;
#endif
- break;
}
break;
}
More information about the Bf-blender-cvs
mailing list