[Bf-blender-cvs] [724a991b7f] HMD_viewport: Fix changing device activates it unintentionally

Julian Eisel noreply at git.blender.org
Mon Feb 27 17:23:13 CET 2017


Commit: 724a991b7f77a4db4f8445287244ea7dc7fe5c5c
Author: Julian Eisel
Date:   Mon Feb 27 17:19:55 2017 +0100
Branches: HMD_viewport
https://developer.blender.org/rB724a991b7f77a4db4f8445287244ea7dc7fe5c5c

Fix changing device activates it unintentionally

Activating in this context means that OpenHMD starts polling the device
for rotation values. That can slow down things, so we only do it when
actually starting an HMD session.

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

M	source/blender/makesrna/intern/rna_userdef.c

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

diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index e89b1ee5f8..29ca227a14 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -616,11 +616,16 @@ static void rna_userdef_hmd_device_update(Main *UNUSED(bmain), Scene *UNUSED(sce
 {
 	const int act_device = WM_device_HMD_current_get();
 
-	if (U.hmd_settings.device < 0) {
+	/* Change the active device. */
+	if (act_device < 0) {
+		/* pass, no device active */
+	}
+	else if (U.hmd_settings.device < 0) {
+		/* disabled device ('None' entry) */
 		WM_device_HMD_state_set(U.hmd_settings.device, false);
 	}
-	/* change device */
 	else if (act_device != U.hmd_settings.device) {
+		/* change device */
 		WM_device_HMD_state_set(U.hmd_settings.device, true);
 	}
 }




More information about the Bf-blender-cvs mailing list