[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37513] branches/merwin-spacenav/intern/ ghost/intern: handle up to 32 buttons (up from 16), for SpacePilot PRO

Mike Erwin significant.bit at gmail.com
Wed Jun 15 18:05:11 CEST 2011


Revision: 37513
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37513
Author:   merwin
Date:     2011-06-15 16:05:10 +0000 (Wed, 15 Jun 2011)
Log Message:
-----------
handle up to 32 buttons (up from 16), for SpacePilot PRO

Modified Paths:
--------------
    branches/merwin-spacenav/intern/ghost/intern/GHOST_NDOFManager.cpp
    branches/merwin-spacenav/intern/ghost/intern/GHOST_NDOFManager.h
    branches/merwin-spacenav/intern/ghost/intern/GHOST_NDOFManagerX11.cpp
    branches/merwin-spacenav/intern/ghost/intern/GHOST_SystemWin32.cpp

Modified: branches/merwin-spacenav/intern/ghost/intern/GHOST_NDOFManager.cpp
===================================================================
--- branches/merwin-spacenav/intern/ghost/intern/GHOST_NDOFManager.cpp	2011-06-15 14:06:25 UTC (rev 37512)
+++ branches/merwin-spacenav/intern/ghost/intern/GHOST_NDOFManager.cpp	2011-06-15 16:05:10 UTC (rev 37513)
@@ -75,13 +75,13 @@
 		m_buttons &= ~mask; // clear this button's bit
 	}
 
-void GHOST_NDOFManager::updateButtons(unsigned short button_bits, GHOST_TUns64 time)
+void GHOST_NDOFManager::updateButtons(unsigned button_bits, GHOST_TUns64 time)
 	{
 	GHOST_IWindow* window = m_system.getWindowManager()->getActiveWindow();
 
-	unsigned short diff = m_buttons ^ button_bits;
+	unsigned diff = m_buttons ^ button_bits;
 
-	for (int i = 0; i < 16; ++i)
+	for (int i = 0; i <= 31; ++i)
 		{
 		unsigned short mask = 1 << i;
 
@@ -142,4 +142,3 @@
 
 	return true;
 	}
-

Modified: branches/merwin-spacenav/intern/ghost/intern/GHOST_NDOFManager.h
===================================================================
--- branches/merwin-spacenav/intern/ghost/intern/GHOST_NDOFManager.h	2011-06-15 14:06:25 UTC (rev 37512)
+++ branches/merwin-spacenav/intern/ghost/intern/GHOST_NDOFManager.h	2011-06-15 16:05:10 UTC (rev 37513)
@@ -43,7 +43,7 @@
 	void updateRotation(short r[3], GHOST_TUns64 time);
 	// send events immediately for changed buttons
 	void updateButton(int button_number, bool press, GHOST_TUns64 time);
-	void updateButtons(unsigned short button_bits, GHOST_TUns64 time);
+	void updateButtons(unsigned button_bits, GHOST_TUns64 time);
 
 	// processes most recent raw data into an NDOFMotion event and sends it
 	// returns whether an event was sent
@@ -54,7 +54,7 @@
 
 	short m_translation[3];
 	short m_rotation[3];
-	unsigned short m_buttons; // bit field
+	unsigned m_buttons; // bit field
 
 	GHOST_TUns64 m_motionTime; // in milliseconds
 	GHOST_TUns64 m_prevMotionTime; // time of most recent Motion event sent
@@ -65,4 +65,3 @@
 };
 
 #endif
-

Modified: branches/merwin-spacenav/intern/ghost/intern/GHOST_NDOFManagerX11.cpp
===================================================================
--- branches/merwin-spacenav/intern/ghost/intern/GHOST_NDOFManagerX11.cpp	2011-06-15 14:06:25 UTC (rev 37512)
+++ branches/merwin-spacenav/intern/ghost/intern/GHOST_NDOFManagerX11.cpp	2011-06-15 16:05:10 UTC (rev 37513)
@@ -83,4 +83,3 @@
 		}
 	return anyProcessed;
 	}
-

Modified: branches/merwin-spacenav/intern/ghost/intern/GHOST_SystemWin32.cpp
===================================================================
--- branches/merwin-spacenav/intern/ghost/intern/GHOST_SystemWin32.cpp	2011-06-15 14:06:25 UTC (rev 37512)
+++ branches/merwin-spacenav/intern/ghost/intern/GHOST_SystemWin32.cpp	2011-06-15 16:05:10 UTC (rev 37513)
@@ -859,20 +859,20 @@
 			}
 		case 3: // buttons
 			{
-			unsigned short buttons;
+			unsigned buttons;
 			memcpy(&buttons, data + 1, sizeof(buttons));
 
-			printf("buttons:");
-			if (buttons)
-				{
-				// work our way through the bit mask
-				for (int i = 0; i < 16; ++i)
-					if (buttons & (1 << i))
-						printf(" %d", i + 1);
-				printf("\n");
-				}
-			else
-				printf(" none\n");
+//			printf("buttons:");
+//			if (buttons)
+//				{
+//				// work our way through the bit mask
+//				for (int i = 0; i < 16; ++i)
+//					if (buttons & (1 << i))
+//						printf(" %d", i + 1);
+//				printf("\n");
+//				}
+//			else
+//				printf(" none\n");
 
 			m_ndofManager->updateButtons(buttons, getMilliSeconds());
 			break;




More information about the Bf-blender-cvs mailing list