minor cleanup of Mac ndof manager

This commit is contained in:
Mike Erwin 2011-07-24 00:52:18 +00:00
parent ed232c756d
commit c2c62134cc

@ -41,7 +41,7 @@ static void NDOF_DeviceAdded(io_connect_t connection)
{ {
printf("ndof: device added\n"); // change these: printf --> informational reports printf("ndof: device added\n"); // change these: printf --> informational reports
#if 0 // device preferences will be useful soon #if 0 // device preferences will be useful some day
ConnexionDevicePrefs p; ConnexionDevicePrefs p;
ConnexionGetCurrentDevicePrefs(kDevID_AnyDevice, &p); ConnexionGetCurrentDevicePrefs(kDevID_AnyDevice, &p);
#endif #endif
@ -74,10 +74,13 @@ static void NDOF_DeviceEvent(io_connect_t connection, natural_t messageType, voi
{ {
case kConnexionCmdHandleAxis: case kConnexionCmdHandleAxis:
{ {
// convert to blender view coordinates
short t[3] = {s->axis[0], -(s->axis[2]), s->axis[1]}; short t[3] = {s->axis[0], -(s->axis[2]), s->axis[1]};
short r[3] = {-(s->axis[3]), s->axis[5], -(s->axis[4])}; short r[3] = {-(s->axis[3]), s->axis[5], -(s->axis[4])};
ndof_manager->updateTranslation(t, now); ndof_manager->updateTranslation(t, now);
ndof_manager->updateRotation(r, now); ndof_manager->updateRotation(r, now);
ghost_system->notifyExternalEventProcessed(); ghost_system->notifyExternalEventProcessed();
break; break;
} }
@ -98,7 +101,8 @@ static void NDOF_DeviceEvent(io_connect_t connection, natural_t messageType, voi
break; break;
} }
case kConnexionMsgPrefsChanged: case kConnexionMsgPrefsChanged:
printf("ndof: prefs changed\n"); // this includes app switches // printf("ndof: prefs changed\n"); // this includes app switches
// TODO: look through updated prefs for things blender cares about
break; break;
case kConnexionMsgCalibrateDevice: case kConnexionMsgCalibrateDevice:
printf("ndof: calibrate\n"); // but what should blender do? printf("ndof: calibrate\n"); // but what should blender do?
@ -134,7 +138,7 @@ GHOST_NDOFManagerCocoa::GHOST_NDOFManagerCocoa(GHOST_System& sys)
m_clientID = RegisterConnexionClient('blnd', (UInt8*) "\007blender", m_clientID = RegisterConnexionClient('blnd', (UInt8*) "\007blender",
kConnexionClientModeTakeOver, kConnexionMaskAll); kConnexionClientModeTakeOver, kConnexionMaskAll);
printf("ndof: client id = %d\n", m_clientID); // printf("ndof: client id = %d\n", m_clientID);
if (SetConnexionClientButtonMask != NULL) if (SetConnexionClientButtonMask != NULL)
{ {
@ -162,6 +166,7 @@ GHOST_NDOFManagerCocoa::~GHOST_NDOFManagerCocoa()
bool GHOST_NDOFManagerCocoa::available() bool GHOST_NDOFManagerCocoa::available()
{ {
// extern OSErr InstallConnexionHandlers() __attribute__((weak_import)); // extern OSErr InstallConnexionHandlers() __attribute__((weak_import));
// ^-- not needed since the entire framework is weak-linked // ^^ not needed since the entire framework is weak-linked
return InstallConnexionHandlers != NULL; return InstallConnexionHandlers != NULL;
// this means that the driver is installed and dynamically linked to blender
} }