瀏覽代碼

Rename `OpenXRInterface.OpenXrSessionState` to `OpenXRInterface.SessionState`

David Snopek 4 月之前
父節點
當前提交
00f30b4f16
共有 3 個文件被更改,包括 37 次插入37 次删除
  1. 13 13
      modules/openxr/doc_classes/OpenXRInterface.xml
  2. 12 12
      modules/openxr/openxr_interface.cpp
  3. 12 12
      modules/openxr/openxr_interface.h

+ 13 - 13
modules/openxr/doc_classes/OpenXRInterface.xml

@@ -86,7 +86,7 @@
 			</description>
 		</method>
 		<method name="get_session_state">
-			<return type="int" enum="OpenXRInterface.OpenXrSessionState" />
+			<return type="int" enum="OpenXRInterface.SessionState" />
 			<description>
 				Returns the current state of our OpenXR session.
 			</description>
@@ -222,7 +222,7 @@
 		</signal>
 		<signal name="session_focussed">
 			<description>
-				Informs our OpenXR session now has focus, e.g. output is sent to our HMD and we're receiving XR input.
+				Informs our OpenXR session now has focus, for example output is sent to the HMD and we're receiving XR input.
 			</description>
 		</signal>
 		<signal name="session_loss_pending">
@@ -242,38 +242,38 @@
 		</signal>
 		<signal name="session_visible">
 			<description>
-				Informs our OpenXR session is now visible, e.g. output is being sent to the HMD but we don't receive XR input.
+				Informs our OpenXR session is now visible, for example output is sent to the HMD but we don't receive XR input.
 			</description>
 		</signal>
 	</signals>
 	<constants>
-		<constant name="OPENXR_SESSION_STATE_UNKNOWN" value="0" enum="OpenXrSessionState">
+		<constant name="SESSION_STATE_UNKNOWN" value="0" enum="SessionState">
 			The state of the session is unknown, we haven't tried setting up OpenXR yet.
 		</constant>
-		<constant name="OPENXR_SESSION_STATE_IDLE" value="1" enum="OpenXrSessionState">
+		<constant name="SESSION_STATE_IDLE" value="1" enum="SessionState">
 			The initial state after the OpenXR session is created or after the session is destroyed.
 		</constant>
-		<constant name="OPENXR_SESSION_STATE_READY" value="2" enum="OpenXrSessionState">
+		<constant name="SESSION_STATE_READY" value="2" enum="SessionState">
 			OpenXR is ready to begin our session. [signal session_begun] is emitted when we change to this state.
 		</constant>
-		<constant name="OPENXR_SESSION_STATE_SYNCHRONIZED" value="3" enum="OpenXrSessionState">
+		<constant name="SESSION_STATE_SYNCHRONIZED" value="3" enum="SessionState">
 			The application has synched its frame loop with the runtime but we're not rendering anything. [signal session_synchronized] is emitted when we change to this state.
 		</constant>
-		<constant name="OPENXR_SESSION_STATE_VISIBLE" value="4" enum="OpenXrSessionState">
+		<constant name="SESSION_STATE_VISIBLE" value="4" enum="SessionState">
 			The application has synched its frame loop with the runtime and we're rendering output to the user, however we receive no user input. [signal session_visible] is emitted when we change to this state.
-			[b]Note:[/b] This is the current state just before we get the focused state, whenever the user opens a system menu, switches to another application or takes off their headset.
+			[b]Note:[/b] This is the current state just before we get the focused state, whenever the user opens a system menu, switches to another application, or takes off their headset.
 		</constant>
-		<constant name="OPENXR_SESSION_STATE_FOCUSED" value="5" enum="OpenXrSessionState">
+		<constant name="SESSION_STATE_FOCUSED" value="5" enum="SessionState">
 			The application has synched its frame loop with the runtime, we're rendering output to the user and we're receiving XR input. [signal session_focussed] is emitted when we change to this state.
 			[b]Note:[/b] This is the state OpenXR will be in when the user can fully interact with your game.
 		</constant>
-		<constant name="OPENXR_SESSION_STATE_STOPPING" value="6" enum="OpenXrSessionState">
+		<constant name="SESSION_STATE_STOPPING" value="6" enum="SessionState">
 			Our session is being stopped. [signal session_stopping] is emitted when we change to this state.
 		</constant>
-		<constant name="OPENXR_SESSION_STATE_LOSS_PENDING" value="7" enum="OpenXrSessionState">
+		<constant name="SESSION_STATE_LOSS_PENDING" value="7" enum="SessionState">
 			The session is about to be lost. [signal session_loss_pending] is emitted when we change to this state.
 		</constant>
-		<constant name="OPENXR_SESSION_STATE_EXITING" value="8" enum="OpenXrSessionState">
+		<constant name="SESSION_STATE_EXITING" value="8" enum="SessionState">
 			The OpenXR instance is about to be destroyed and we're existing. [signal instance_exiting] is emitted when we change to this state.
 		</constant>
 		<constant name="HAND_LEFT" value="0" enum="Hand">

+ 12 - 12
modules/openxr/openxr_interface.cpp

@@ -120,15 +120,15 @@ void OpenXRInterface::_bind_methods() {
 	ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "vrs_min_radius", PROPERTY_HINT_RANGE, "1.0,100.0,1.0"), "set_vrs_min_radius", "get_vrs_min_radius");
 	ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "vrs_strength", PROPERTY_HINT_RANGE, "0.1,10.0,0.1"), "set_vrs_strength", "get_vrs_strength");
 
-	BIND_ENUM_CONSTANT(OPENXR_SESSION_STATE_UNKNOWN);
-	BIND_ENUM_CONSTANT(OPENXR_SESSION_STATE_IDLE);
-	BIND_ENUM_CONSTANT(OPENXR_SESSION_STATE_READY);
-	BIND_ENUM_CONSTANT(OPENXR_SESSION_STATE_SYNCHRONIZED);
-	BIND_ENUM_CONSTANT(OPENXR_SESSION_STATE_VISIBLE);
-	BIND_ENUM_CONSTANT(OPENXR_SESSION_STATE_FOCUSED);
-	BIND_ENUM_CONSTANT(OPENXR_SESSION_STATE_STOPPING);
-	BIND_ENUM_CONSTANT(OPENXR_SESSION_STATE_LOSS_PENDING);
-	BIND_ENUM_CONSTANT(OPENXR_SESSION_STATE_EXITING);
+	BIND_ENUM_CONSTANT(SESSION_STATE_UNKNOWN);
+	BIND_ENUM_CONSTANT(SESSION_STATE_IDLE);
+	BIND_ENUM_CONSTANT(SESSION_STATE_READY);
+	BIND_ENUM_CONSTANT(SESSION_STATE_SYNCHRONIZED);
+	BIND_ENUM_CONSTANT(SESSION_STATE_VISIBLE);
+	BIND_ENUM_CONSTANT(SESSION_STATE_FOCUSED);
+	BIND_ENUM_CONSTANT(SESSION_STATE_STOPPING);
+	BIND_ENUM_CONSTANT(SESSION_STATE_LOSS_PENDING);
+	BIND_ENUM_CONSTANT(SESSION_STATE_EXITING);
 
 	BIND_ENUM_CONSTANT(HAND_LEFT);
 	BIND_ENUM_CONSTANT(HAND_RIGHT);
@@ -1417,12 +1417,12 @@ void OpenXRInterface::on_refresh_rate_changes(float p_new_rate) {
 	emit_signal(SNAME("refresh_rate_changed"), p_new_rate);
 }
 
-OpenXRInterface::OpenXrSessionState OpenXRInterface::get_session_state() {
+OpenXRInterface::SessionState OpenXRInterface::get_session_state() {
 	if (openxr_api) {
-		return (OpenXrSessionState)openxr_api->get_session_state();
+		return (SessionState)openxr_api->get_session_state();
 	}
 
-	return OPENXR_SESSION_STATE_UNKNOWN;
+	return SESSION_STATE_UNKNOWN;
 }
 
 /** Hand tracking. */

+ 12 - 12
modules/openxr/openxr_interface.h

@@ -218,19 +218,19 @@ public:
 	void tracker_profile_changed(RID p_tracker, RID p_interaction_profile);
 
 	/** Session */
-	enum OpenXrSessionState { // Should mirror XrSessionState
-		OPENXR_SESSION_STATE_UNKNOWN = 0,
-		OPENXR_SESSION_STATE_IDLE = 1,
-		OPENXR_SESSION_STATE_READY = 2,
-		OPENXR_SESSION_STATE_SYNCHRONIZED = 3,
-		OPENXR_SESSION_STATE_VISIBLE = 4,
-		OPENXR_SESSION_STATE_FOCUSED = 5,
-		OPENXR_SESSION_STATE_STOPPING = 6,
-		OPENXR_SESSION_STATE_LOSS_PENDING = 7,
-		OPENXR_SESSION_STATE_EXITING = 8,
+	enum SessionState { // Should mirror XrSessionState
+		SESSION_STATE_UNKNOWN = 0,
+		SESSION_STATE_IDLE = 1,
+		SESSION_STATE_READY = 2,
+		SESSION_STATE_SYNCHRONIZED = 3,
+		SESSION_STATE_VISIBLE = 4,
+		SESSION_STATE_FOCUSED = 5,
+		SESSION_STATE_STOPPING = 6,
+		SESSION_STATE_LOSS_PENDING = 7,
+		SESSION_STATE_EXITING = 8,
 	};
 
-	OpenXrSessionState get_session_state();
+	SessionState get_session_state();
 
 	/** Hand tracking. */
 	enum Hand {
@@ -337,7 +337,7 @@ public:
 	~OpenXRInterface();
 };
 
-VARIANT_ENUM_CAST(OpenXRInterface::OpenXrSessionState)
+VARIANT_ENUM_CAST(OpenXRInterface::SessionState)
 VARIANT_ENUM_CAST(OpenXRInterface::Hand)
 VARIANT_ENUM_CAST(OpenXRInterface::HandMotionRange)
 VARIANT_ENUM_CAST(OpenXRInterface::HandTrackedSource)