diff options
-rw-r--r-- | .github/workflows/android_builds.yml | 54 | ||||
-rw-r--r-- | doc/classes/HashingContext.xml | 10 | ||||
-rw-r--r-- | editor/filesystem_dock.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 33 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.h | 2 | ||||
-rw-r--r-- | editor/themes/editor_fonts.cpp | 2 | ||||
-rw-r--r-- | modules/webxr/godot_webxr.h | 2 | ||||
-rw-r--r-- | modules/webxr/native/library_godot_webxr.js | 5 | ||||
-rw-r--r-- | modules/webxr/native/webxr.externs.js | 5 | ||||
-rw-r--r-- | modules/webxr/webxr_interface_js.cpp | 42 | ||||
-rw-r--r-- | modules/webxr/webxr_interface_js.h | 8 |
11 files changed, 130 insertions, 35 deletions
diff --git a/.github/workflows/android_builds.yml b/.github/workflows/android_builds.yml index 9a488bd095..f99a31179e 100644 --- a/.github/workflows/android_builds.yml +++ b/.github/workflows/android_builds.yml @@ -13,9 +13,30 @@ concurrency: cancel-in-progress: true jobs: - android-template: + build-android: runs-on: "ubuntu-20.04" - name: Template (target=template_release) + name: ${{ matrix.name }} + strategy: + fail-fast: false + matrix: + include: + - name: Editor (target=editor) + cache-name: android-editor + target: editor + tests: false + sconsflags: arch=arm64 production=yes + + - name: Template arm32 (target=template_release, arch=arm32) + cache-name: android-template-arm32 + target: template_release + tests: false + sconsflags: arch=arm32 + + - name: Template arm64 (target=template_release, arch=arm64) + cache-name: android-template-arm64 + target: template_release + tests: false + sconsflags: arch=arm64 steps: - uses: actions/checkout@v4 @@ -30,33 +51,38 @@ jobs: - name: Setup Godot build cache uses: ./.github/actions/godot-cache + with: + cache-name: ${{ matrix.cache-name }} continue-on-error: true - name: Setup Python and SCons uses: ./.github/actions/godot-deps - - name: Compilation (arm32) - uses: ./.github/actions/godot-build - with: - sconsflags: ${{ env.SCONSFLAGS }} arch=arm32 - platform: android - target: template_release - tests: false - - - name: Compilation (arm64) + - name: Compilation uses: ./.github/actions/godot-build with: - sconsflags: ${{ env.SCONSFLAGS }} arch=arm64 + sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }} platform: android - target: template_release - tests: false + target: ${{ matrix.target }} + tests: ${{ matrix.tests }} - name: Generate Godot templates + if: matrix.target == 'template_release' run: | cd platform/android/java ./gradlew generateGodotTemplates cd ../../.. ls -l bin/ + - name: Generate Godot editor + if: matrix.target == 'editor' + run: | + cd platform/android/java + ./gradlew generateGodotEditor + cd ../../.. + ls -l bin/android_editor_builds/ + - name: Upload artifact uses: ./.github/actions/upload-artifact + with: + name: ${{ matrix.cache-name }} diff --git a/doc/classes/HashingContext.xml b/doc/classes/HashingContext.xml index f2681ae7b3..b42acb2b99 100644 --- a/doc/classes/HashingContext.xml +++ b/doc/classes/HashingContext.xml @@ -20,8 +20,9 @@ # Open the file to hash. var file = FileAccess.open(path, FileAccess.READ) # Update the context after reading each chunk. - while not file.eof_reached(): - ctx.update(file.get_buffer(CHUNK_SIZE)) + while file.get_position() < file.get_length(): + var remaining = file.get_length() - file.get_position() + ctx.update(file.get_buffer(min(remaining, CHUNK_SIZE))) # Get the computed hash. var res = ctx.finish() # Print the result as hex string and array. @@ -43,9 +44,10 @@ // Open the file to hash. using var file = FileAccess.Open(path, FileAccess.ModeFlags.Read); // Update the context after reading each chunk. - while (!file.EofReached()) + while (file.GetPosition() < file.GetLength()) { - ctx.Update(file.GetBuffer(ChunkSize)); + int remaining = (int)(file.GetLength() - file.GetPosition()); + ctx.Update(file.GetBuffer(Mathf.Min(remaining, ChunkSize))); } // Get the computed hash. byte[] res = ctx.Finish(); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 44ff95b0f9..29ca1279b2 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -758,6 +758,8 @@ void FileSystemDock::navigate_to_path(const String &p_path) { // Ensure that the FileSystem dock is visible. EditorDockManager::get_singleton()->focus_dock(this); + import_dock_needs_update = true; + _update_import_dock(); } void FileSystemDock::_file_list_thumbnail_done(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, const Variant &p_udata) { diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index d7d51d6a04..3d7647ca5b 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -325,11 +325,11 @@ void ViewportRotationControl::_notification(int p_what) { } void ViewportRotationControl::_draw() { - const Vector2i center = get_size() / 2.0; + const Vector2 center = get_size() / 2.0; const real_t radius = get_size().x / 2.0; if (focused_axis > -2 || orbiting_index != -1) { - draw_circle(center, radius, Color(0.5, 0.5, 0.5, 0.25)); + draw_circle(center, radius, Color(0.5, 0.5, 0.5, 0.25), true, -1.0, true); } Vector<Axis2D> axis_to_draw; @@ -345,34 +345,42 @@ void ViewportRotationControl::_draw_axis(const Axis2D &p_axis) { const int direction = p_axis.axis % 3; const Color axis_color = axis_colors[direction]; - const double alpha = focused ? 1.0 : ((p_axis.z_axis + 1.0) / 2.0) * 0.5 + 0.5; - const Color c = focused ? Color(0.9, 0.9, 0.9) : Color(axis_color, alpha); + const double min_alpha = 0.35; + const double alpha = focused ? 1.0 : Math::remap((p_axis.z_axis + 1.0) / 2.0, 0, 0.5, min_alpha, 1.0); + const Color c = focused ? Color(axis_color.lightened(0.75), 1.0) : Color(axis_color, alpha); if (positive) { // Draw axis lines for the positive axes. - const Vector2i center = get_size() / 2.0; - draw_line(center, p_axis.screen_point, c, 1.5 * EDSCALE); + const Vector2 center = get_size() / 2.0; + const Vector2 diff = p_axis.screen_point - center; + const float line_length = MAX(diff.length() - AXIS_CIRCLE_RADIUS - 0.5 * EDSCALE, 0); - draw_circle(p_axis.screen_point, AXIS_CIRCLE_RADIUS, c); + draw_line(center + diff.limit_length(0.5 * EDSCALE), center + diff.limit_length(line_length), c, 1.5 * EDSCALE, true); + + draw_circle(p_axis.screen_point, AXIS_CIRCLE_RADIUS, c, true, -1.0, true); // Draw the axis letter for the positive axes. const String axis_name = direction == 0 ? "X" : (direction == 1 ? "Y" : "Z"); - draw_char(get_theme_font(SNAME("rotation_control"), EditorStringName(EditorFonts)), p_axis.screen_point + Vector2i(Math::round(-4.0 * EDSCALE), Math::round(5.0 * EDSCALE)), axis_name, get_theme_font_size(SNAME("rotation_control_size"), EditorStringName(EditorFonts)), Color(0.0, 0.0, 0.0, alpha)); + const Ref<Font> &font = get_theme_font(SNAME("rotation_control"), EditorStringName(EditorFonts)); + const int font_size = get_theme_font_size(SNAME("rotation_control_size"), EditorStringName(EditorFonts)); + const Size2 char_size = font->get_char_size(axis_name[0], font_size); + const Vector2 char_offset = Vector2(-char_size.width / 2.0, char_size.height * 0.25); + draw_char(font, p_axis.screen_point + char_offset, axis_name, font_size, Color(0.0, 0.0, 0.0, alpha * 0.6)); } else { // Draw an outline around the negative axes. - draw_circle(p_axis.screen_point, AXIS_CIRCLE_RADIUS, c); - draw_circle(p_axis.screen_point, AXIS_CIRCLE_RADIUS * 0.8, c.darkened(0.4)); + draw_circle(p_axis.screen_point, AXIS_CIRCLE_RADIUS, c, true, -1.0, true); + draw_circle(p_axis.screen_point, AXIS_CIRCLE_RADIUS * 0.8, c.darkened(0.4), true, -1.0, true); } } void ViewportRotationControl::_get_sorted_axis(Vector<Axis2D> &r_axis) { - const Vector2i center = get_size() / 2.0; + const Vector2 center = get_size() / 2.0; const real_t radius = get_size().x / 2.0 - AXIS_CIRCLE_RADIUS - 2.0 * EDSCALE; const Basis camera_basis = viewport->to_camera_transform(viewport->cursor).get_basis().inverse(); for (int i = 0; i < 3; ++i) { Vector3 axis_3d = camera_basis.get_column(i); - Vector2i axis_vector = Vector2(axis_3d.x, -axis_3d.y) * radius; + Vector2 axis_vector = Vector2(axis_3d.x, -axis_3d.y) * radius; if (Math::abs(axis_3d.z) <= 1.0) { Axis2D pos_axis; @@ -5432,6 +5440,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p frame_time_gradient->add_point(0.5, Color()); top_right_vbox = memnew(VBoxContainer); + top_right_vbox->add_theme_constant_override("separation", 10.0 * EDSCALE); top_right_vbox->set_anchors_and_offsets_preset(PRESET_TOP_RIGHT, PRESET_MODE_MINSIZE, 10.0 * EDSCALE); top_right_vbox->set_h_grow_direction(GROW_DIRECTION_BEGIN); diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index 859d075732..580c001238 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -65,7 +65,7 @@ class ViewportRotationControl : public Control { GDCLASS(ViewportRotationControl, Control); struct Axis2D { - Vector2i screen_point; + Vector2 screen_point; float z_axis = -99.0; int axis = -1; }; diff --git a/editor/themes/editor_fonts.cpp b/editor/themes/editor_fonts.cpp index 71a050bc23..fc994a17d1 100644 --- a/editor/themes/editor_fonts.cpp +++ b/editor/themes/editor_fonts.cpp @@ -443,7 +443,7 @@ void editor_register_fonts(const Ref<Theme> &p_theme) { p_theme->set_font("rulers", EditorStringName(EditorFonts), default_fc); // Rotation widget font - p_theme->set_font_size("rotation_control_size", EditorStringName(EditorFonts), 14 * EDSCALE); + p_theme->set_font_size("rotation_control_size", EditorStringName(EditorFonts), 13 * EDSCALE); p_theme->set_font("rotation_control", EditorStringName(EditorFonts), default_fc); // Code font diff --git a/modules/webxr/godot_webxr.h b/modules/webxr/godot_webxr.h index caa7f217af..1b3e3b6a41 100644 --- a/modules/webxr/godot_webxr.h +++ b/modules/webxr/godot_webxr.h @@ -45,7 +45,7 @@ enum WebXRInputEvent { }; typedef void (*GodotWebXRSupportedCallback)(char *p_session_mode, int p_supported); -typedef void (*GodotWebXRStartedCallback)(char *p_reference_space_type, char *p_enabled_features); +typedef void (*GodotWebXRStartedCallback)(char *p_reference_space_type, char *p_enabled_features, char *p_environment_blend_mode); typedef void (*GodotWebXREndedCallback)(); typedef void (*GodotWebXRFailedCallback)(char *p_message); typedef void (*GodotWebXRInputEventCallback)(int p_event_type, int p_input_source_id); diff --git a/modules/webxr/native/library_godot_webxr.js b/modules/webxr/native/library_godot_webxr.js index 581da4d56f..155409f931 100644 --- a/modules/webxr/native/library_godot_webxr.js +++ b/modules/webxr/native/library_godot_webxr.js @@ -322,9 +322,12 @@ const GodotWebXR = { const reference_space_c_str = GodotRuntime.allocString(reference_space_type); const enabled_features = 'enabledFeatures' in session ? Array.from(session.enabledFeatures) : []; const enabled_features_c_str = GodotRuntime.allocString(enabled_features.join(',')); - onstarted(reference_space_c_str, enabled_features_c_str); + const environment_blend_mode = 'environmentBlendMode' in session ? session.environmentBlendMode : ''; + const environment_blend_mode_c_str = GodotRuntime.allocString(environment_blend_mode); + onstarted(reference_space_c_str, enabled_features_c_str, environment_blend_mode_c_str); GodotRuntime.free(reference_space_c_str); GodotRuntime.free(enabled_features_c_str); + GodotRuntime.free(environment_blend_mode_c_str); }, 0); } diff --git a/modules/webxr/native/webxr.externs.js b/modules/webxr/native/webxr.externs.js index 80a7f8d2de..18125d7869 100644 --- a/modules/webxr/native/webxr.externs.js +++ b/modules/webxr/native/webxr.externs.js @@ -83,6 +83,11 @@ XRSession.prototype.supportedFrameRates; XRSession.prototype.enabledFeatures; /** + * @type {string} + */ +XRSession.prototype.environmentBlendMode; + +/** * @type {?function (Event)} */ XRSession.prototype.onend; diff --git a/modules/webxr/webxr_interface_js.cpp b/modules/webxr/webxr_interface_js.cpp index 6c18b650ee..78a9db9b19 100644 --- a/modules/webxr/webxr_interface_js.cpp +++ b/modules/webxr/webxr_interface_js.cpp @@ -58,7 +58,7 @@ void _emwebxr_on_session_supported(char *p_session_mode, int p_supported) { interface->emit_signal(SNAME("session_supported"), session_mode, p_supported ? true : false); } -void _emwebxr_on_session_started(char *p_reference_space_type, char *p_enabled_features) { +void _emwebxr_on_session_started(char *p_reference_space_type, char *p_enabled_features, char *p_environment_blend_mode) { XRServer *xr_server = XRServer::get_singleton(); ERR_FAIL_NULL(xr_server); @@ -68,6 +68,7 @@ void _emwebxr_on_session_started(char *p_reference_space_type, char *p_enabled_f String reference_space_type = String(p_reference_space_type); interface->_set_reference_space_type(reference_space_type); interface->_set_enabled_features(p_enabled_features); + interface->_set_environment_blend_mode(p_environment_blend_mode); interface->emit_signal(SNAME("session_started")); } @@ -230,6 +231,44 @@ Array WebXRInterfaceJS::get_available_display_refresh_rates() const { return ret; } +Array WebXRInterfaceJS::get_supported_environment_blend_modes() { + Array blend_modes; + // The blend mode can't be changed, so return the current blend mode as the only supported one. + blend_modes.push_back(environment_blend_mode); + return blend_modes; +} + +XRInterface::EnvironmentBlendMode WebXRInterfaceJS::get_environment_blend_mode() const { + return environment_blend_mode; +} + +bool WebXRInterfaceJS::set_environment_blend_mode(EnvironmentBlendMode p_new_environment_blend_mode) { + if (environment_blend_mode == p_new_environment_blend_mode) { + // Environment blend mode can't be changed, but we'll consider it a success to set it + // to what it already is. + return true; + } + return false; +} + +void WebXRInterfaceJS::_set_environment_blend_mode(String p_blend_mode_string) { + if (p_blend_mode_string == "opaque") { + environment_blend_mode = XRInterface::XR_ENV_BLEND_MODE_OPAQUE; + } else if (p_blend_mode_string == "additive") { + environment_blend_mode = XRInterface::XR_ENV_BLEND_MODE_ADDITIVE; + } else if (p_blend_mode_string == "alpha-blend") { + environment_blend_mode = XRInterface::XR_ENV_BLEND_MODE_ALPHA_BLEND; + } else { + // Not all browsers can give us this information, so as a fallback, + // we'll make some guesses about the blend mode. + if (session_mode == "immersive-ar") { + environment_blend_mode = XRInterface::XR_ENV_BLEND_MODE_ALPHA_BLEND; + } else { + environment_blend_mode = XRInterface::XR_ENV_BLEND_MODE_OPAQUE; + } + } +} + StringName WebXRInterfaceJS::get_name() const { return "WebXR"; }; @@ -336,6 +375,7 @@ void WebXRInterfaceJS::uninitialize() { texture_cache.clear(); reference_space_type.clear(); enabled_features.clear(); + environment_blend_mode = XRInterface::XR_ENV_BLEND_MODE_OPAQUE; initialized = false; }; }; diff --git a/modules/webxr/webxr_interface_js.h b/modules/webxr/webxr_interface_js.h index afce28d410..d02c8d2677 100644 --- a/modules/webxr/webxr_interface_js.h +++ b/modules/webxr/webxr_interface_js.h @@ -60,6 +60,8 @@ private: String reference_space_type; String enabled_features; + XRInterface::EnvironmentBlendMode environment_blend_mode = XRInterface::XR_ENV_BLEND_MODE_OPAQUE; + Size2 render_targetsize; RBMap<unsigned int, RID> texture_cache; struct Touch { @@ -113,6 +115,10 @@ public: virtual void set_display_refresh_rate(float p_refresh_rate) override; virtual Array get_available_display_refresh_rates() const override; + virtual Array get_supported_environment_blend_modes() override; + virtual XRInterface::EnvironmentBlendMode get_environment_blend_mode() const override; + virtual bool set_environment_blend_mode(EnvironmentBlendMode p_new_environment_blend_mode) override; + virtual StringName get_name() const override; virtual uint32_t get_capabilities() const override; @@ -136,8 +142,10 @@ public: void _on_input_event(int p_event_type, int p_input_source_id); + // Internal setters used by callbacks from Emscripten. inline void _set_reference_space_type(String p_reference_space_type) { reference_space_type = p_reference_space_type; } inline void _set_enabled_features(String p_enabled_features) { enabled_features = p_enabled_features; } + void _set_environment_blend_mode(String p_blend_mode_string); WebXRInterfaceJS(); ~WebXRInterfaceJS(); |