summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/BuildProblemsView.cs16
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs4
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs17
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.types.cs2
-rw-r--r--modules/openxr/openxr_api.cpp127
-rw-r--r--modules/openxr/openxr_api.h5
-rw-r--r--modules/openxr/openxr_interface.cpp12
7 files changed, 109 insertions, 74 deletions
diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildProblemsView.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildProblemsView.cs
index 93b5a6c7f8..d62eb3ce9e 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildProblemsView.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildProblemsView.cs
@@ -308,14 +308,14 @@ namespace GodotTools.Build
return false;
string searchText = _searchBox.Text;
- if (!string.IsNullOrEmpty(searchText) &&
- (!diagnostic.Message.Contains(searchText, StringComparison.OrdinalIgnoreCase) ||
- !(diagnostic.File?.Contains(searchText, StringComparison.OrdinalIgnoreCase) ?? false)))
- {
- return false;
- }
-
- return true;
+ if (string.IsNullOrEmpty(searchText))
+ return true;
+ if (diagnostic.Message.Contains(searchText, StringComparison.OrdinalIgnoreCase))
+ return true;
+ if (diagnostic.File?.Contains(searchText, StringComparison.OrdinalIgnoreCase) ?? false)
+ return true;
+
+ return false;
}
private Color? GetProblemItemColor(BuildDiagnostic diagnostic)
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs
index 16be494d99..7b6b35b68f 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs
@@ -94,7 +94,7 @@ namespace Godot.Bridge
// Signals
if (godotObject.HasGodotClassSignal(CustomUnsafe.AsRef(name)))
{
- godot_signal signal = new godot_signal(*name, godotObject.GetInstanceId());
+ godot_signal signal = new godot_signal(NativeFuncs.godotsharp_string_name_new_copy(*name), godotObject.GetInstanceId());
*outRet = VariantUtils.CreateFromSignalTakingOwnershipOfDisposableValue(signal);
return godot_bool.True;
}
@@ -102,7 +102,7 @@ namespace Godot.Bridge
// Methods
if (godotObject.HasGodotClassMethod(CustomUnsafe.AsRef(name)))
{
- godot_callable method = new godot_callable(*name, godotObject.GetInstanceId());
+ godot_callable method = new godot_callable(NativeFuncs.godotsharp_string_name_new_copy(*name), godotObject.GetInstanceId());
*outRet = VariantUtils.CreateFromCallableTakingOwnershipOfDisposableValue(method);
return godot_bool.True;
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs
index 968afa664b..e344dc84c7 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs
@@ -310,13 +310,6 @@ namespace Godot.Bridge
_pathTypeBiMap.Add(scriptPathAttr.Path, type);
- // This method may be called before initialization.
- if (NativeFuncs.godotsharp_dotnet_module_is_initialized().ToBool() && Engine.IsEditorHint())
- {
- using godot_string scriptPath = Marshaling.ConvertStringToNative(scriptPathAttr.Path);
- NativeFuncs.godotsharp_internal_editor_file_system_update_file(scriptPath);
- }
-
if (AlcReloadCfg.IsAlcReloadingEnabled)
{
AddTypeForAlcReloading(type);
@@ -366,6 +359,16 @@ namespace Godot.Bridge
}
}
}
+
+ // This method may be called before initialization.
+ if (NativeFuncs.godotsharp_dotnet_module_is_initialized().ToBool() && Engine.IsEditorHint())
+ {
+ foreach (var scriptPath in _pathTypeBiMap.Paths)
+ {
+ using godot_string nativeScriptPath = Marshaling.ConvertStringToNative(scriptPath);
+ NativeFuncs.godotsharp_internal_editor_file_system_update_file(nativeScriptPath);
+ }
+ }
}
[UnmanagedCallersOnly]
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.types.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.types.cs
index a58f6849ad..7fa3498b92 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.types.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.types.cs
@@ -61,6 +61,8 @@ public static partial class ScriptManagerBridge
private System.Collections.Generic.Dictionary<string, Type> _pathTypeMap = new();
private System.Collections.Generic.Dictionary<Type, string> _typePathMap = new();
+ public System.Collections.Generic.IEnumerable<string> Paths => _pathTypeMap.Keys;
+
public void Add(string scriptPath, Type scriptType)
{
_pathTypeMap.Add(scriptPath, scriptType);
diff --git a/modules/openxr/openxr_api.cpp b/modules/openxr/openxr_api.cpp
index 7b777a9845..491a419525 100644
--- a/modules/openxr/openxr_api.cpp
+++ b/modules/openxr/openxr_api.cpp
@@ -680,71 +680,85 @@ bool OpenXRAPI::is_reference_space_supported(XrReferenceSpaceType p_reference_sp
return false;
}
-bool OpenXRAPI::setup_spaces() {
- XrResult result;
+bool OpenXRAPI::setup_play_space() {
+ ERR_FAIL_COND_V(session == XR_NULL_HANDLE, false);
XrPosef identityPose = {
{ 0.0, 0.0, 0.0, 1.0 },
{ 0.0, 0.0, 0.0 }
};
- ERR_FAIL_COND_V(session == XR_NULL_HANDLE, false);
+ XrReferenceSpaceType new_reference_space;
+ XrSpace new_play_space = XR_NULL_HANDLE;
+ bool will_emulate_local_floor = false;
- // create play space
- {
- emulating_local_floor = false;
+ if (is_reference_space_supported(requested_reference_space)) {
+ new_reference_space = requested_reference_space;
+ } else if (requested_reference_space == XR_REFERENCE_SPACE_TYPE_LOCAL_FLOOR_EXT && is_reference_space_supported(XR_REFERENCE_SPACE_TYPE_STAGE)) {
+ print_verbose("OpenXR: LOCAL_FLOOR space isn't supported, emulating using STAGE and LOCAL spaces.");
- if (is_reference_space_supported(requested_reference_space)) {
- reference_space = requested_reference_space;
- } else if (requested_reference_space == XR_REFERENCE_SPACE_TYPE_LOCAL_FLOOR_EXT && is_reference_space_supported(XR_REFERENCE_SPACE_TYPE_STAGE)) {
- print_verbose("OpenXR: LOCAL_FLOOR space isn't supported, emulating using STAGE and LOCAL spaces.");
+ new_reference_space = XR_REFERENCE_SPACE_TYPE_LOCAL;
+ will_emulate_local_floor = true;
+ } else {
+ // Fallback on LOCAL, which all OpenXR runtimes are required to support.
+ print_verbose(String("OpenXR: ") + OpenXRUtil::get_reference_space_name(requested_reference_space) + String(" isn't supported, defaulting to LOCAL space."));
+ new_reference_space = XR_REFERENCE_SPACE_TYPE_LOCAL;
+ }
- reference_space = XR_REFERENCE_SPACE_TYPE_LOCAL;
- emulating_local_floor = true;
+ XrReferenceSpaceCreateInfo play_space_create_info = {
+ XR_TYPE_REFERENCE_SPACE_CREATE_INFO, // type
+ nullptr, // next
+ new_reference_space, // referenceSpaceType
+ identityPose, // poseInReferenceSpace
+ };
- // We'll use the STAGE space to get the floor height, but we can't do that until
- // after xrWaitFrame(), so just set this flag for now.
- should_reset_emulated_floor_height = true;
+ XrResult result = xrCreateReferenceSpace(session, &play_space_create_info, &new_play_space);
+ if (XR_FAILED(result)) {
+ print_line("OpenXR: Failed to create play space [", get_error_string(result), "]");
+ return false;
+ }
- } else {
- // Fallback on LOCAL, which all OpenXR runtimes are required to support.
- print_verbose(String("OpenXR: ") + OpenXRUtil::get_reference_space_name(requested_reference_space) + String(" isn't supported, defaulting to LOCAL space."));
- reference_space = XR_REFERENCE_SPACE_TYPE_LOCAL;
- }
+ // If we've previously created a play space, clean it up first.
+ if (play_space != XR_NULL_HANDLE) {
+ xrDestroySpace(play_space);
+ }
+ play_space = new_play_space;
+ reference_space = new_reference_space;
- XrReferenceSpaceCreateInfo play_space_create_info = {
- XR_TYPE_REFERENCE_SPACE_CREATE_INFO, // type
- nullptr, // next
- reference_space, // referenceSpaceType
- identityPose, // poseInReferenceSpace
- };
+ emulating_local_floor = will_emulate_local_floor;
+ if (emulating_local_floor) {
+ // We'll use the STAGE space to get the floor height, but we can't do that until
+ // after xrWaitFrame(), so just set this flag for now.
+ should_reset_emulated_floor_height = true;
+ }
- result = xrCreateReferenceSpace(session, &play_space_create_info, &play_space);
- if (XR_FAILED(result)) {
- print_line("OpenXR: Failed to create play space [", get_error_string(result), "]");
- return false;
- }
+ return true;
+}
+
+bool OpenXRAPI::setup_view_space() {
+ ERR_FAIL_COND_V(session == XR_NULL_HANDLE, false);
+
+ if (!is_reference_space_supported(XR_REFERENCE_SPACE_TYPE_VIEW)) {
+ print_line("OpenXR: reference space XR_REFERENCE_SPACE_TYPE_VIEW is not supported.");
+ return false;
}
- // create view space
- {
- if (!is_reference_space_supported(XR_REFERENCE_SPACE_TYPE_VIEW)) {
- print_line("OpenXR: reference space XR_REFERENCE_SPACE_TYPE_VIEW is not supported.");
- return false;
- }
+ XrPosef identityPose = {
+ { 0.0, 0.0, 0.0, 1.0 },
+ { 0.0, 0.0, 0.0 }
+ };
- XrReferenceSpaceCreateInfo view_space_create_info = {
- XR_TYPE_REFERENCE_SPACE_CREATE_INFO, // type
- nullptr, // next
- XR_REFERENCE_SPACE_TYPE_VIEW, // referenceSpaceType
- identityPose // poseInReferenceSpace
- };
+ XrReferenceSpaceCreateInfo view_space_create_info = {
+ XR_TYPE_REFERENCE_SPACE_CREATE_INFO, // type
+ nullptr, // next
+ XR_REFERENCE_SPACE_TYPE_VIEW, // referenceSpaceType
+ identityPose // poseInReferenceSpace
+ };
- result = xrCreateReferenceSpace(session, &view_space_create_info, &view_space);
- if (XR_FAILED(result)) {
- print_line("OpenXR: Failed to create view space [", get_error_string(result), "]");
- return false;
- }
+ XrResult result = xrCreateReferenceSpace(session, &view_space_create_info, &view_space);
+ if (XR_FAILED(result)) {
+ print_line("OpenXR: Failed to create view space [", get_error_string(result), "]");
+ return false;
}
return true;
@@ -1262,10 +1276,14 @@ void OpenXRAPI::set_view_configuration(XrViewConfigurationType p_view_configurat
view_configuration = p_view_configuration;
}
-void OpenXRAPI::set_requested_reference_space(XrReferenceSpaceType p_requested_reference_space) {
- ERR_FAIL_COND(is_initialized());
-
+bool OpenXRAPI::set_requested_reference_space(XrReferenceSpaceType p_requested_reference_space) {
requested_reference_space = p_requested_reference_space;
+
+ if (is_initialized()) {
+ return setup_play_space();
+ }
+
+ return true;
}
void OpenXRAPI::set_submit_depth_buffer(bool p_submit_depth_buffer) {
@@ -1466,7 +1484,12 @@ bool OpenXRAPI::initialize_session() {
return false;
}
- if (!setup_spaces()) {
+ if (!setup_play_space()) {
+ destroy_session();
+ return false;
+ }
+
+ if (!setup_view_space()) {
destroy_session();
return false;
}
diff --git a/modules/openxr/openxr_api.h b/modules/openxr/openxr_api.h
index 8cc6be3a9d..5e5a3d4663 100644
--- a/modules/openxr/openxr_api.h
+++ b/modules/openxr/openxr_api.h
@@ -232,7 +232,8 @@ private:
bool create_session();
bool load_supported_reference_spaces();
bool is_reference_space_supported(XrReferenceSpaceType p_reference_space);
- bool setup_spaces();
+ bool setup_play_space();
+ bool setup_view_space();
bool load_supported_swapchain_formats();
bool is_swapchain_format_supported(int64_t p_swapchain_format);
bool create_swapchains();
@@ -339,7 +340,7 @@ public:
void set_view_configuration(XrViewConfigurationType p_view_configuration);
XrViewConfigurationType get_view_configuration() const { return view_configuration; }
- void set_requested_reference_space(XrReferenceSpaceType p_requested_reference_space);
+ bool set_requested_reference_space(XrReferenceSpaceType p_requested_reference_space);
XrReferenceSpaceType get_requested_reference_space() const { return requested_reference_space; }
XrReferenceSpaceType get_reference_space() const { return reference_space; }
diff --git a/modules/openxr/openxr_interface.cpp b/modules/openxr/openxr_interface.cpp
index 6b311b73a8..ebcd331f3d 100644
--- a/modules/openxr/openxr_interface.cpp
+++ b/modules/openxr/openxr_interface.cpp
@@ -711,7 +711,6 @@ XRInterface::PlayAreaMode OpenXRInterface::get_play_area_mode() const {
}
bool OpenXRInterface::set_play_area_mode(XRInterface::PlayAreaMode p_mode) {
- ERR_FAIL_COND_V_MSG(initialized, false, "Cannot change play area mode after OpenXR interface has been initialized");
ERR_FAIL_NULL_V(openxr_api, false);
XrReferenceSpaceType reference_space;
@@ -726,8 +725,15 @@ bool OpenXRInterface::set_play_area_mode(XRInterface::PlayAreaMode p_mode) {
return false;
}
- openxr_api->set_requested_reference_space(reference_space);
- return true;
+ if (openxr_api->set_requested_reference_space(reference_space)) {
+ XRServer *xr_server = XRServer::get_singleton();
+ if (xr_server) {
+ xr_server->clear_reference_frame();
+ }
+ return true;
+ }
+
+ return false;
}
PackedVector3Array OpenXRInterface::get_play_area() const {