[Bf-blender-cvs] [088e381] HMD_viewport: Quiet warnings without WITH_OPENHMD

Julian Eisel noreply at git.blender.org
Sun Apr 10 20:19:54 CEST 2016


Commit: 088e381ae2fa4ecc6dc6f7c1aa733e46dae733ad
Author: Julian Eisel
Date:   Sun Apr 10 20:18:55 2016 +0200
Branches: HMD_viewport
https://developer.blender.org/rB088e381ae2fa4ecc6dc6f7c1aa733e46dae733ad

Quiet warnings without WITH_OPENHMD

===================================================================

M	intern/ghost/intern/GHOST_C-api.cpp
M	intern/ghost/intern/GHOST_OpenHMDManager.cpp

===================================================================

diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index fe9fc7f..2b2c874 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -952,6 +952,8 @@ void GHOST_HMDopenDevice(int index)
 	GHOST_ISystem *system = GHOST_ISystem::getSystem();
 	GHOST_OpenHMDManager *ohmd = system->getOpenHMDManager();
 	ohmd->openDevice(index);
+#else
+	(void)index;
 #endif
 }
 
@@ -982,6 +984,7 @@ const char *GHOST_HMDgetDeviceName(int index)
 	GHOST_OpenHMDManager *ohmd = system->getOpenHMDManager();
 	return ohmd->getDeviceName(index);
 #else
+	(void)index;
 	return NULL;
 #endif
 }
diff --git a/intern/ghost/intern/GHOST_OpenHMDManager.cpp b/intern/ghost/intern/GHOST_OpenHMDManager.cpp
index 8bf1d7b..be3d406 100644
--- a/intern/ghost/intern/GHOST_OpenHMDManager.cpp
+++ b/intern/ghost/intern/GHOST_OpenHMDManager.cpp
@@ -45,7 +45,12 @@ GHOST_OpenHMDManager::~GHOST_OpenHMDManager()
 
 bool GHOST_OpenHMDManager::processEvents()
 {
-	GHOST_IWindow *window;
+	GHOST_IWindow *window = m_system.getWindowManager()->getActiveWindow();
+
+	if (!window)
+		return false;
+
+
 	GHOST_TUns64 now = m_system.getMilliSeconds();
 	static int num_devices_prev = 0;
 	const int num_devices = getNumDevices();
@@ -53,7 +58,7 @@ bool GHOST_OpenHMDManager::processEvents()
 
 	/* DeviceNumChanged event
 	 * Would be nicer if OpenHMD could handle this for us. */
-	if (num_devices_prev != num_devices && (window = m_system.getWindowManager()->getActiveWindow())) {
+	if (num_devices_prev != num_devices) {
 		GHOST_EventOpenHMD *event = new GHOST_EventOpenHMD(now, GHOST_kDeviceNumChanged, window);
 		m_system.pushEvent(event);
 
@@ -62,7 +67,7 @@ bool GHOST_OpenHMDManager::processEvents()
 	}
 	/* OrientationUpdate event
 	 * We might want to add a timeout check here to avoid too many updates. */
-	if (1 && m_device && (window = m_system.getWindowManager()->getActiveWindow())) {
+	if (1 && m_device) {
 		GHOST_EventOpenHMD *event = new GHOST_EventOpenHMD(now, GHOST_kOrientationUpdate, window);
 		GHOST_TEventOpenHMDData *data = (GHOST_TEventOpenHMDData*)event->getData();




More information about the Bf-blender-cvs mailing list