summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/os/midi_driver.cpp5
-rw-r--r--doc/classes/Camera2D.xml18
-rw-r--r--doc/classes/InputEventMIDI.xml2
-rw-r--r--editor/plugins/tiles/tile_map_editor.cpp1
-rw-r--r--editor/project_converter_3_to_4.cpp12
-rw-r--r--misc/dist/html/editor.html1449
-rw-r--r--misc/dist/html/full-size.html472
-rw-r--r--misc/dist/html/offline-export.html71
-rw-r--r--misc/dist/html/offline.html74
-rw-r--r--modules/gdscript/editor/gdscript_highlighter.cpp23
-rw-r--r--modules/gdscript/editor/gdscript_highlighter.h3
-rw-r--r--platform/linuxbsd/detect.py1
-rw-r--r--platform/web/.eslintrc.html.js19
-rw-r--r--platform/web/export/export_plugin.cpp1
-rw-r--r--platform/web/package-lock.json327
-rw-r--r--platform/web/package.json15
-rw-r--r--scene/2d/camera_2d.cpp46
-rw-r--r--scene/2d/camera_2d.h12
18 files changed, 1425 insertions, 1126 deletions
diff --git a/core/os/midi_driver.cpp b/core/os/midi_driver.cpp
index 410b62068a..79eef95ef2 100644
--- a/core/os/midi_driver.cpp
+++ b/core/os/midi_driver.cpp
@@ -86,11 +86,6 @@ void MIDIDriver::receive_input_packet(uint64_t timestamp, uint8_t *data, uint32_
if (length >= 2 + param_position) {
event->set_pitch(data[param_position]);
event->set_velocity(data[param_position + 1]);
-
- if (event->get_message() == MIDIMessage::NOTE_ON && event->get_velocity() == 0) {
- // https://www.midi.org/forum/228-writing-midi-software-send-note-off,-or-zero-velocity-note-on
- event->set_message(MIDIMessage::NOTE_OFF);
- }
}
break;
diff --git a/doc/classes/Camera2D.xml b/doc/classes/Camera2D.xml
index 671ecb6af1..9315a85e1f 100644
--- a/doc/classes/Camera2D.xml
+++ b/doc/classes/Camera2D.xml
@@ -52,14 +52,14 @@
<return type="Vector2" />
<description>
Returns this camera's target position, in global coordinates.
- [b]Note:[/b] The returned value is not the same as [member Node2D.global_position], as it is affected by the drag properties. It is also not the same as the current position if [member smoothing_enabled] is [code]true[/code] (see [method get_screen_center_position]).
+ [b]Note:[/b] The returned value is not the same as [member Node2D.global_position], as it is affected by the drag properties. It is also not the same as the current position if [member position_smoothing_enabled] is [code]true[/code] (see [method get_screen_center_position]).
</description>
</method>
<method name="reset_smoothing">
<return type="void" />
<description>
Sets the camera's position immediately to its current smoothing destination.
- This method has no effect if [member smoothing_enabled] is [code]false[/code].
+ This method has no effect if [member position_smoothing_enabled] is [code]false[/code].
</description>
</method>
<method name="set_drag_margin">
@@ -138,7 +138,7 @@
</member>
<member name="limit_smoothed" type="bool" setter="set_limit_smoothing_enabled" getter="is_limit_smoothing_enabled" default="false">
If [code]true[/code], the camera smoothly stops when reaches its limits.
- This property has no effect if [member smoothing_enabled] is [code]false[/code].
+ This property has no effect if [member position_smoothing_enabled] is [code]false[/code].
[b]Note:[/b] To immediately update the camera's position to be within limits without smoothing, even with this setting enabled, invoke [method reset_smoothing].
</member>
<member name="limit_top" type="int" setter="set_limit" getter="get_limit" default="-10000000">
@@ -147,6 +147,12 @@
<member name="offset" type="Vector2" setter="set_offset" getter="get_offset" default="Vector2(0, 0)">
The camera's relative offset. Useful for looking around or camera shake animations. The offsetted camera can go past the limits defined in [member limit_top], [member limit_bottom], [member limit_left] and [member limit_right].
</member>
+ <member name="position_smoothing_enabled" type="bool" setter="set_position_smoothing_enabled" getter="is_position_smoothing_enabled" default="false">
+ If [code]true[/code], the camera's view smoothly moves towards its target position at [member position_smoothing_speed].
+ </member>
+ <member name="position_smoothing_speed" type="float" setter="set_position_smoothing_speed" getter="get_position_smoothing_speed" default="5.0">
+ Speed in pixels per second of the camera's smoothing effect when [member position_smoothing_enabled] is [code]true[/code].
+ </member>
<member name="process_callback" type="int" setter="set_process_callback" getter="get_process_callback" enum="Camera2D.Camera2DProcessCallback" default="1">
The camera's process callback. See [enum Camera2DProcessCallback].
</member>
@@ -157,12 +163,6 @@
<member name="rotation_smoothing_speed" type="float" setter="set_rotation_smoothing_speed" getter="get_rotation_smoothing_speed" default="5.0">
The angular, asymptotic speed of the camera's rotation smoothing effect when [member rotation_smoothing_enabled] is [code]true[/code].
</member>
- <member name="smoothing_enabled" type="bool" setter="set_enable_follow_smoothing" getter="is_follow_smoothing_enabled" default="false">
- If [code]true[/code], the camera smoothly moves towards the target at [member smoothing_speed].
- </member>
- <member name="smoothing_speed" type="float" setter="set_follow_smoothing" getter="get_follow_smoothing" default="5.0">
- Speed in pixels per second of the camera's smoothing effect when [member smoothing_enabled] is [code]true[/code].
- </member>
<member name="zoom" type="Vector2" setter="set_zoom" getter="get_zoom" default="Vector2(1, 1)">
The camera's zoom. A zoom of [code]Vector(2, 2)[/code] doubles the size seen in the viewport. A zoom of [code]Vector(0.5, 0.5)[/code] halves the size seen in the viewport.
</member>
diff --git a/doc/classes/InputEventMIDI.xml b/doc/classes/InputEventMIDI.xml
index 2af88149b6..04d8cab065 100644
--- a/doc/classes/InputEventMIDI.xml
+++ b/doc/classes/InputEventMIDI.xml
@@ -90,7 +90,7 @@
The pressure of the MIDI signal. This value ranges from 0 to 127. For many devices, this value is always zero.
</member>
<member name="velocity" type="int" setter="set_velocity" getter="get_velocity" default="0">
- The velocity of the MIDI signal. This value ranges from 0 to 127. For a piano, this corresponds to how quickly the key was pressed, and is rarely above about 110 in practice.
+ The velocity of the MIDI signal. This value ranges from 0 to 127. For a piano, this corresponds to how quickly the key was pressed, and is rarely above about 110 in practice. Note that some MIDI devices may send a [constant MIDI_MESSAGE_NOTE_ON] message with zero velocity and expect this to be treated the same as a [constant MIDI_MESSAGE_NOTE_OFF] message, but device implementations vary so Godot reports event data exactly as received.
</member>
</members>
</class>
diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp
index 7cc29dbfad..dd16d4ffea 100644
--- a/editor/plugins/tiles/tile_map_editor.cpp
+++ b/editor/plugins/tiles/tile_map_editor.cpp
@@ -2002,6 +2002,7 @@ void TileMapEditorTilesPlugin::_set_source_sort(int p_sort) {
}
TilesEditorPlugin::get_singleton()->set_sorting_option(p_sort);
_update_tile_set_sources_list();
+ EditorSettings::get_singleton()->set_project_metadata("editor_metadata", "tile_source_sort", p_sort);
}
void TileMapEditorTilesPlugin::_bind_methods() {
diff --git a/editor/project_converter_3_to_4.cpp b/editor/project_converter_3_to_4.cpp
index 1a2c670aef..78f3b4de0e 100644
--- a/editor/project_converter_3_to_4.cpp
+++ b/editor/project_converter_3_to_4.cpp
@@ -311,6 +311,7 @@ static const char *gdscript_function_renames[][2] = {
{ "get_error_string", "get_error_message" }, // JSON
{ "get_filename", "get_scene_file_path" }, // Node, WARNING, this may be used in a lot of other places
{ "get_focus_neighbour", "get_focus_neighbor" }, // Control
+ { "get_follow_smoothing", "get_position_smoothing_speed" }, // Camera2D
{ "get_font_types", "get_font_type_list" }, // Theme
{ "get_frame_color", "get_color" }, // ColorRect
{ "get_global_rate_scale", "get_playback_speed_scale" }, // AudioServer
@@ -419,6 +420,7 @@ static const char *gdscript_function_renames[][2] = {
{ "is_commiting_action", "is_committing_action" }, // UndoRedo
{ "is_doubleclick", "is_double_click" }, // InputEventMouseButton
{ "is_draw_red", "is_draw_warning" }, // EditorProperty
+ { "is_follow_smoothing_enabled", "is_position_smoothing_enabled" }, // Camera2D
{ "is_h_drag_enabled", "is_drag_horizontal_enabled" }, // Camera2D
{ "is_handle_highlighted", "_is_handle_highlighted" }, // EditorNode3DGizmo, EditorNode3DGizmoPlugin
{ "is_inverting_faces", "get_flip_faces" }, // CSGPrimitive3D
@@ -500,11 +502,13 @@ static const char *gdscript_function_renames[][2] = {
{ "set_depth_bias_enable", "set_depth_bias_enabled" }, // RDPipelineRasterizationState
{ "set_doubleclick", "set_double_click" }, // InputEventMouseButton
{ "set_draw_red", "set_draw_warning" }, // EditorProperty
+ { "set_enable_follow_smoothing", "set_position_smoothing_enabled" }, // Camera2D
{ "set_enabled_focus_mode", "set_focus_mode" }, // BaseButton
{ "set_endian_swap", "set_big_endian" }, // File
{ "set_expand_to_text_length", "set_expand_to_text_length_enabled" }, // LineEdit
{ "set_filename", "set_scene_file_path" }, // Node, WARNING, this may be used in a lot of other places
{ "set_focus_neighbour", "set_focus_neighbor" }, // Control
+ { "set_follow_smoothing", "set_position_smoothing_speed" }, // Camera2D
{ "set_frame_color", "set_color" }, // ColorRect
{ "set_global_rate_scale", "set_playback_speed_scale" }, // AudioServer
{ "set_gravity_distance_scale", "set_gravity_point_distance_scale" }, // Area2D
@@ -753,6 +757,7 @@ static const char *csharp_function_renames[][2] = {
{ "GetEndianSwap", "IsBigEndian" }, // File
{ "GetErrorString", "GetErrorMessage" }, // JSON
{ "GetFocusNeighbour", "GetFocusNeighbor" }, // Control
+ { "GetFollowSmoothing", "GetFollowSmoothingSpeed" }, // Camera2D
{ "GetFontTypes", "GetFontTypeList" }, // Theme
{ "GetFrameColor", "GetColor" }, // ColorRect
{ "GetGlobalRateScale", "GetPlaybackSpeedScale" }, // AudioServer
@@ -858,6 +863,7 @@ static const char *csharp_function_renames[][2] = {
{ "IsAParentOf", "IsAncestorOf" }, // Node
{ "IsCommitingAction", "IsCommittingAction" }, // UndoRedo
{ "IsDoubleclick", "IsDoubleClick" }, // InputEventMouseButton
+ { "IsFollowSmoothingEnabled", "IsPositionSmoothingEnabled" }, // Camera2D
{ "IsHDragEnabled", "IsDragHorizontalEnabled" }, // Camera2D
{ "IsHandleHighlighted", "_IsHandleHighlighted" }, // EditorNode3DGizmo, EditorNode3DGizmoPlugin
{ "IsNetworkMaster", "IsMultiplayerAuthority" }, // Node
@@ -934,10 +940,12 @@ static const char *csharp_function_renames[][2] = {
{ "SetD", "SetDistance" }, // WorldMarginShape2D
{ "SetDepthBiasEnable", "SetDepthBiasEnabled" }, // RDPipelineRasterizationState
{ "SetDoubleclick", "SetDoubleClick" }, // InputEventMouseButton
+ { "SetEnableFollowSmoothing", "SetFollowSmoothingEnabled" }, // Camera2D
{ "SetEnabledFocusMode", "SetFocusMode" }, // BaseButton
{ "SetEndianSwap", "SetBigEndian" }, // File
{ "SetExpandToTextLength", "SetExpandToTextLengthEnabled" }, // LineEdit
{ "SetFocusNeighbour", "SetFocusNeighbor" }, // Control
+ { "SetFollowSmoothing", "SetFollowSmoothingSpeed" }, // Camera2D
{ "SetFrameColor", "SetColor" }, // ColorRect
{ "SetGlobalRateScale", "SetPlaybackSpeedScale" }, // AudioServer
{ "SetGravityDistanceScale", "SetGravityPointDistanceScale" }, // Area2D
@@ -1139,6 +1147,8 @@ static const char *gdscript_properties_renames[][2] = {
{ "selectedframe", "selected_frame" }, // Theme
{ "size_override_stretch", "size_2d_override_stretch" }, // SubViewport
{ "slips_on_slope", "slide_on_slope" }, // SeparationRayShape2D
+ { "smoothing_enabled", "follow_smoothing_enabled" }, // Camera2D
+ { "smoothing_speed", "position_smoothing_speed" }, // Camera2D
{ "ss_reflections_depth_tolerance", "ssr_depth_tolerance" }, // Environment
{ "ss_reflections_enabled", "ssr_enabled" }, // Environment
{ "ss_reflections_fade_in", "ssr_fade_in" }, // Environment
@@ -1233,6 +1243,8 @@ static const char *csharp_properties_renames[][2] = {
{ "Selectedframe", "SelectedFrame" }, // Theme
{ "SizeOverrideStretch", "Size2dOverrideStretch" }, // SubViewport
{ "SlipsOnSlope", "SlideOnSlope" }, // SeparationRayShape2D
+ { "SmoothingEnabled", "FollowSmoothingEnabled" }, // Camera2D
+ { "SmoothingSpeed", "FollowSmoothingSpeed" }, // Camera2D
{ "SsReflectionsDepthTolerance", "SsrDepthTolerance" }, // Environment
{ "SsReflectionsEnabled", "SsrEnabled" }, // Environment
{ "SsReflectionsFadeIn", "SsrFadeIn" }, // Environment
diff --git a/misc/dist/html/editor.html b/misc/dist/html/editor.html
index c9f3c2cc0d..93afbf085d 100644
--- a/misc/dist/html/editor.html
+++ b/misc/dist/html/editor.html
@@ -1,752 +1,757 @@
<!DOCTYPE html>
-<html xmlns="https://www.w3.org/1999/xhtml" lang="en">
-<head>
- <meta charset="utf-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
- <meta name="author" content="Godot Engine" />
- <meta name="description" content="Use the Godot Engine editor directly in your web browser, without having to install anything." />
- <meta name="mobile-web-app-capable" content="yes" />
- <meta name="apple-mobile-web-app-capable" content="yes" />
- <meta name="application-name" content="Godot" />
- <meta name="apple-mobile-web-app-title" content="Godot" />
- <meta name="theme-color" content="#202531" />
- <meta name="msapplication-navbutton-color" content="#202531" />
- <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
- <meta name="msapplication-starturl" content="/latest" />
- <meta property="og:site_name" content="Godot Engine Web Editor" />
- <meta property="og:url" name="twitter:url" content="https://editor.godotengine.org/releases/latest/" />
- <meta property="og:title" name="twitter:title" content="Free and open source 2D and 3D game engine" />
- <meta property="og:description" name="twitter:description" content="Use the Godot Engine editor directly in your web browser, without having to install anything." />
- <meta property="og:image" name="twitter:image" content="https://godotengine.org/themes/godotengine/assets/og_image.png" />
- <meta property="og:type" content="website" />
- <meta name="twitter:card" content="summary" />
- <link id="-gd-engine-icon" rel="icon" type="image/png" href="favicon.png" />
- <link rel="apple-touch-icon" type="image/png" href="favicon.png" />
- <link rel="manifest" href="manifest.json" />
- <title>Godot Engine Web Editor (@GODOT_VERSION@)</title>
- <style>
- *:focus {
- /* More visible outline for better keyboard navigation. */
- outline: 0.125rem solid hsl(220, 100%, 62.5%);
- /* Make the outline always appear above other elements. */
- /* Otherwise, one of its sides can be hidden by tabs in the Download and More layouts. */
- position: relative;
- }
-
- body {
- touch-action: none;
- font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
- margin: 0;
- border: 0 none;
- padding: 0;
- text-align: center;
- background-color: #333b4f;
- overflow: hidden;
- }
-
- a {
- color: hsl(205, 100%, 75%);
- text-decoration-color: hsla(205, 100%, 75%, 0.3);
- text-decoration-thickness: 0.125rem;
- }
-
- a:hover {
- filter: brightness(117.5%);
- }
-
- a:active {
- filter: brightness(82.5%);
- }
-
- .welcome-modal {
- display: none;
- position: fixed;
- z-index: 1;
- left: 0;
- top: 0;
- width: 100%;
- height: 100%;
- overflow: auto;
- background-color: hsla(0, 0%, 0%, 0.5);
- text-align: left;
- }
-
- .welcome-modal-title {
- text-align: center;
- }
-
- .welcome-modal-content {
- background-color: #333b4f;
- box-shadow: 0 0.25rem 0.25rem hsla(0, 0%, 0%, 0.5);
- line-height: 1.5;
- max-width: 38rem;
- margin: 4rem auto 0 auto;
- color: white;
- border-radius: 0.5rem;
- padding: 1rem 1rem 2rem 1rem;
- }
-
- #tabs-buttons {
- /* Match the default background color of the editor window for a seamless appearance. */
- background-color: #202531;
- }
-
- #tab-game {
- /* Use a pure black background to better distinguish the running project */
- /* from the editor window, and to use a more neutral background color (no tint). */
- background-color: black;
- /* Make the background span the entire page height. */
- min-height: 100vh;
- }
-
- #canvas, #gameCanvas {
- display: block;
- margin: 0;
- color: white;
- }
-
- /* Don't show distracting focus outlines for the main tabs' contents. */
- #tab-editor canvas:focus,
- #tab-game canvas:focus,
- #canvas:focus,
- #gameCanvas:focus {
- outline: none;
- }
-
- .godot {
- color: #e0e0e0;
- background-color: #3b3943;
- background-image: linear-gradient(to bottom, #403e48, #35333c);
- border: 1px solid #45434e;
- box-shadow: 0 0 1px 1px #2f2d35;
- }
-
- .btn {
- appearance: none;
- color: #e0e0e0;
- background-color: #262c3b;
- border: 1px solid #202531;
- padding: 0.5rem 1rem;
- margin: 0 0.5rem;
- }
-
- .btn:not(:disabled):hover {
- color: #e0e1e5;
- border-color: #666c7b;
- }
-
- .btn:active {
- border-color: #699ce8;
- color: #699ce8;
- }
-
- .btn:disabled {
- color: #aaa;
- border-color: #242937;
- }
-
- .btn.tab-btn {
- padding: 0.3rem 1rem;
- }
-
- .btn.close-btn {
- padding: 0.3rem 1rem;
- margin-left: -0.75rem;
- font-weight: 700;
- }
-
-
- /* Status display
- * ============== */
-
- #status {
- position: absolute;
- left: 0;
- top: 0;
- right: 0;
- bottom: 0;
- display: flex;
- justify-content: center;
- align-items: center;
- /* don't consume click events - make children visible explicitly */
- visibility: hidden;
- }
-
- #status-progress {
- width: 366px;
- height: 7px;
- background-color: #38363A;
- border: 1px solid #444246;
- padding: 1px;
- box-shadow: 0 0 2px 1px #1B1C22;
- border-radius: 2px;
- visibility: visible;
- }
-
- @media only screen and (orientation:portrait) {
- #status-progress {
- width: 61.8%;
- }
- }
-
- #status-progress-inner {
- height: 100%;
- width: 0;
- box-sizing: border-box;
- transition: width 0.5s linear;
- background-color: #202020;
- border: 1px solid #222223;
- box-shadow: 0 0 1px 1px #27282E;
- border-radius: 3px;
- }
-
- #status-indeterminate {
- visibility: visible;
- position: relative;
- }
-
- #status-indeterminate > div {
- width: 4.5px;
- height: 0;
- border-style: solid;
- border-width: 9px 3px 0 3px;
- border-color: #2b2b2b transparent transparent transparent;
- transform-origin: center 21px;
- position: absolute;
- }
-
- #status-indeterminate > div:nth-child(1) { transform: rotate( 22.5deg); }
- #status-indeterminate > div:nth-child(2) { transform: rotate( 67.5deg); }
- #status-indeterminate > div:nth-child(3) { transform: rotate(112.5deg); }
- #status-indeterminate > div:nth-child(4) { transform: rotate(157.5deg); }
- #status-indeterminate > div:nth-child(5) { transform: rotate(202.5deg); }
- #status-indeterminate > div:nth-child(6) { transform: rotate(247.5deg); }
- #status-indeterminate > div:nth-child(7) { transform: rotate(292.5deg); }
- #status-indeterminate > div:nth-child(8) { transform: rotate(337.5deg); }
-
- #status-notice {
- margin: 0 100px;
- line-height: 1.3;
- visibility: visible;
- padding: 4px 6px;
- visibility: visible;
- }
- </style>
-</head>
-<body>
- <div
- id="welcome-modal"
- class="welcome-modal"
- role="dialog"
- aria-labelledby="welcome-modal-title"
- aria-describedby="welcome-modal-description"
- onclick="if (event.target === this) closeWelcomeModal(false)"
- >
- <div class="welcome-modal-content">
- <h2 id="welcome-modal-title" class="welcome-modal-title">Important - Please read before continuing</h2>
- <div id="welcome-modal-description">
- <p>
- The Godot Web Editor has some limitations compared to the native version.
- Its main focus is education and experimentation;
- <strong>it is not recommended for production</strong>.
- </p>
- <p>
- Refer to the
- <a
- href="https://docs.godotengine.org/en/latest/tutorials/editor/using_the_web_editor.html"
- target="_blank"
- rel="noopener"
- >Web editor documentation</a> for usage instructions and limitations.
- </p>
- </div>
- <div id="welcome-modal-missing-description" style="display: none">
- <p>
- <strong>The following features required by the Godot Web Editor are missing:</strong>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
+ <meta name="author" content="Godot Engine">
+ <meta name="description" content="Use the Godot Engine editor directly in your web browser, without having to install anything.">
+ <meta name="mobile-web-app-capable" content="yes">
+ <meta name="apple-mobile-web-app-capable" content="yes">
+ <meta name="application-name" content="Godot">
+ <meta name="apple-mobile-web-app-title" content="Godot">
+ <meta name="theme-color" content="#202531">
+ <meta name="msapplication-navbutton-color" content="#202531">
+ <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
+ <meta name="msapplication-starturl" content="/latest">
+ <meta property="og:site_name" content="Godot Engine Web Editor">
+ <meta property="og:url" name="twitter:url" content="https://editor.godotengine.org/releases/latest/">
+ <meta property="og:title" name="twitter:title" content="Free and open source 2D and 3D game engine">
+ <meta property="og:description" name="twitter:description" content="Use the Godot Engine editor directly in your web browser, without having to install anything.">
+ <meta property="og:image" name="twitter:image" content="https://godotengine.org/themes/godotengine/assets/og_image.png">
+ <meta property="og:type" content="website">
+ <meta name="twitter:card" content="summary">
+ <link id="-gd-engine-icon" rel="icon" type="image/png" href="favicon.png">
+ <link rel="apple-touch-icon" type="image/png" href="favicon.png">
+ <link rel="manifest" href="manifest.json">
+ <title>Godot Engine Web Editor (@GODOT_VERSION@)</title>
+ <style>
+*:focus {
+ /* More visible outline for better keyboard navigation. */
+ outline: 0.125rem solid hsl(220, 100%, 62.5%);
+ /* Make the outline always appear above other elements. */
+ /* Otherwise, one of its sides can be hidden by tabs in the Download and More layouts. */
+ position: relative;
+}
+
+body {
+ touch-action: none;
+ font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
+ margin: 0;
+ border: 0 none;
+ padding: 0;
+ text-align: center;
+ background-color: #333b4f;
+ overflow: hidden;
+}
+
+a {
+ color: hsl(205, 100%, 75%);
+ text-decoration-color: hsla(205, 100%, 75%, 0.3);
+ text-decoration-thickness: 0.125rem;
+}
+
+a:hover {
+ filter: brightness(117.5%);
+}
+
+a:active {
+ filter: brightness(82.5%);
+}
+
+.welcome-modal {
+ display: none;
+ position: fixed;
+ z-index: 1;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ overflow: auto;
+ background-color: hsla(0, 0%, 0%, 0.5);
+ text-align: left;
+}
+
+.welcome-modal-title {
+ text-align: center;
+}
+
+.welcome-modal-content {
+ background-color: #333b4f;
+ box-shadow: 0 0.25rem 0.25rem hsla(0, 0%, 0%, 0.5);
+ line-height: 1.5;
+ max-width: 38rem;
+ margin: 4rem auto 0 auto;
+ color: white;
+ border-radius: 0.5rem;
+ padding: 1rem 1rem 2rem 1rem;
+}
+
+#tabs-buttons {
+ /* Match the default background color of the editor window for a seamless appearance. */
+ background-color: #202531;
+}
+
+#tab-game {
+ /* Use a pure black background to better distinguish the running project */
+ /* from the editor window, and to use a more neutral background color (no tint). */
+ background-color: black;
+ /* Make the background span the entire page height. */
+ min-height: 100vh;
+}
+
+#canvas, #gameCanvas {
+ display: block;
+ margin: 0;
+ color: white;
+}
+
+/* Don't show distracting focus outlines for the main tabs' contents. */
+#tab-editor canvas:focus,
+#tab-game canvas:focus,
+#canvas:focus,
+#gameCanvas:focus {
+ outline: none;
+}
+
+.godot {
+ color: #e0e0e0;
+ background-color: #3b3943;
+ background-image: linear-gradient(to bottom, #403e48, #35333c);
+ border: 1px solid #45434e;
+ box-shadow: 0 0 1px 1px #2f2d35;
+}
+
+.btn {
+ appearance: none;
+ color: #e0e0e0;
+ background-color: #262c3b;
+ border: 1px solid #202531;
+ padding: 0.5rem 1rem;
+ margin: 0 0.5rem;
+}
+
+.btn:not(:disabled):hover {
+ color: #e0e1e5;
+ border-color: #666c7b;
+}
+
+.btn:active {
+ border-color: #699ce8;
+ color: #699ce8;
+}
+
+.btn:disabled {
+ color: #aaa;
+ border-color: #242937;
+}
+
+.btn.tab-btn {
+ padding: 0.3rem 1rem;
+}
+
+.btn.close-btn {
+ padding: 0.3rem 1rem;
+ margin-left: -0.75rem;
+ font-weight: 700;
+}
+
+/* Status display */
+
+#status {
+ position: absolute;
+ left: 0;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ /* don't consume click events - make children visible explicitly */
+ visibility: hidden;
+}
+
+#status-progress {
+ width: 366px;
+ height: 7px;
+ background-color: #38363A;
+ border: 1px solid #444246;
+ padding: 1px;
+ box-shadow: 0 0 2px 1px #1B1C22;
+ border-radius: 2px;
+ visibility: visible;
+}
+
+@media only screen and (orientation:portrait) {
+ #status-progress {
+ width: 61.8%;
+ }
+}
+
+#status-progress-inner {
+ height: 100%;
+ width: 0;
+ box-sizing: border-box;
+ transition: width 0.5s linear;
+ background-color: #202020;
+ border: 1px solid #222223;
+ box-shadow: 0 0 1px 1px #27282E;
+ border-radius: 3px;
+}
+
+#status-indeterminate {
+ visibility: visible;
+ position: relative;
+}
+
+#status-indeterminate > div {
+ width: 4.5px;
+ height: 0;
+ border-style: solid;
+ border-width: 9px 3px 0 3px;
+ border-color: #2b2b2b transparent transparent transparent;
+ transform-origin: center 21px;
+ position: absolute;
+}
+
+#status-indeterminate > div:nth-child(1) { transform: rotate( 22.5deg); }
+#status-indeterminate > div:nth-child(2) { transform: rotate( 67.5deg); }
+#status-indeterminate > div:nth-child(3) { transform: rotate(112.5deg); }
+#status-indeterminate > div:nth-child(4) { transform: rotate(157.5deg); }
+#status-indeterminate > div:nth-child(5) { transform: rotate(202.5deg); }
+#status-indeterminate > div:nth-child(6) { transform: rotate(247.5deg); }
+#status-indeterminate > div:nth-child(7) { transform: rotate(292.5deg); }
+#status-indeterminate > div:nth-child(8) { transform: rotate(337.5deg); }
+
+#status-notice {
+ margin: 0 100px;
+ line-height: 1.3;
+ visibility: visible;
+ padding: 4px 6px;
+ visibility: visible;
+}
+ </style>
+ </head>
+ <body>
+ <div
+ id="welcome-modal"
+ class="welcome-modal"
+ role="dialog"
+ aria-labelledby="welcome-modal-title"
+ aria-describedby="welcome-modal-description"
+ onclick="if (event.target === this) closeWelcomeModal(false)"
+ >
+ <div class="welcome-modal-content">
+ <h2 id="welcome-modal-title" class="welcome-modal-title">Important - Please read before continuing</h2>
+ <div id="welcome-modal-description">
+ <p>
+ The Godot Web Editor has some limitations compared to the native version.
+ Its main focus is education and experimentation;
+ <strong>it is not recommended for production</strong>.
+ </p>
+ <p>
+ Refer to the
+ <a
+ href="https://docs.godotengine.org/en/latest/tutorials/editor/using_the_web_editor.html"
+ target="_blank"
+ rel="noopener"
+ >Web editor documentation</a> for usage instructions and limitations.
+ </p>
+ </div>
+ <div id="welcome-modal-missing-description" style="display: none">
+ <p>
+ <strong>The following features required by the Godot Web Editor are missing:</strong>
+ </p>
<ul id="welcome-modal-missing-list">
</ul>
- </p>
- <p>
- If you are self-hosting the web editor,
- refer to
- <a
- href="https://docs.godotengine.org/en/latest/tutorials/export/exporting_for_web.html"
- target="_blank"
- rel="noopener"
- >Exporting for the Web</a> for more information.
- </p>
- </div>
- <div style="text-align: center">
- <button id="welcome-modal-dismiss" class="btn" type="button" onclick="closeWelcomeModal(true)" style="margin-top: 1rem">
- OK, don't show again
- </button>
+ <p>
+ If you are self-hosting the web editor,
+ refer to
+ <a
+ href="https://docs.godotengine.org/en/latest/tutorials/export/exporting_for_web.html"
+ target="_blank"
+ rel="noopener"
+ >Exporting for the Web</a> for more information.
+ </p>
+ </div>
+ <div style="text-align: center">
+ <button id="welcome-modal-dismiss" class="btn" type="button" onclick="closeWelcomeModal(true)" style="margin-top: 1rem">
+ OK, don't show again
+ </button>
+ </div>
</div>
</div>
- </div>
- <div id="tabs-buttons">
- <button id="btn-tab-loader" class="btn tab-btn" onclick="showTab('loader')">Loader</button>
- <button id="btn-tab-editor" class="btn tab-btn" disabled="disabled" onclick="showTab('editor')">Editor</button>
- <button id="btn-close-editor" class="btn close-btn" disabled="disabled" onclick="closeEditor()">×</button>
- <button id="btn-tab-game" class="btn tab-btn" disabled="disabled" onclick="showTab('game')">Game</button>
- <button id="btn-close-game" class="btn close-btn" disabled="disabled" onclick="closeGame()">×</button>
- <button id="btn-tab-update" class="btn tab-btn" style="display: none;">Update</button>
- </div>
- <div id="tabs">
- <div id="tab-loader">
- <div style="color: #e0e0e0;" id="persistence">
- <br />
- <img src="logo.svg" alt="Godot Engine logo" width="1024" height="414" style="width: auto; height: auto; max-width: min(85%, 50vh); max-height: 250px" />
- <br />
- @GODOT_VERSION@
- <br />
- <a href="releases/">Need an old version?</a>
- <br />
- <br />
- <br />
- <label for="videoMode" style="margin-right: 1rem">Video driver:</label>
- <select id="videoMode">
- <option value="" selected="selected">Auto</option>
- <option value="opengl3">WebGL 2</option>
- </select>
- <br />
- <br />
- <label for="zip-file" style="margin-right: 1rem">Preload project ZIP:</label> <input id="zip-file" type="file" name="files" style="margin-bottom: 1rem"/>
- <br />
-<a href="demo.zip">(Try this for example)</a>
- <br />
- <br />
- <button id="startButton" class="btn" style="margin-bottom: 4rem; font-weight: 700">Start Godot editor</button>
- <br />
- <button class="btn" onclick="clearPersistence()" style="margin-bottom: 1.5rem">Clear persistent data</button>
- <br />
- <a href="https://docs.godotengine.org/en/latest/tutorials/editor/using_the_web_editor.html">Web editor documentation</a>
- </div>
- </div>
- <div id="tab-editor" style="display: none;">
- <canvas id="editor-canvas" tabindex="1">
- HTML5 canvas appears to be unsupported in the current browser.<br />
- Please try updating or use a different browser.
- </canvas>
- </div>
- <div id="tab-game" style="display: none;">
- <canvas id="game-canvas" tabindex="2">
- HTML5 canvas appears to be unsupported in the current browser.<br />
- Please try updating or use a different browser.
- </canvas>
+ <div id="tabs-buttons">
+ <button id="btn-tab-loader" class="btn tab-btn" onclick="showTab('loader')">Loader</button>
+ <button id="btn-tab-editor" class="btn tab-btn" disabled="disabled" onclick="showTab('editor')">Editor</button>
+ <button id="btn-close-editor" class="btn close-btn" disabled="disabled" onclick="closeEditor()">×</button>
+ <button id="btn-tab-game" class="btn tab-btn" disabled="disabled" onclick="showTab('game')">Game</button>
+ <button id="btn-close-game" class="btn close-btn" disabled="disabled" onclick="closeGame()">×</button>
+ <button id="btn-tab-update" class="btn tab-btn" style="display: none;">Update</button>
</div>
- <div id="tab-status" style="display: none;">
- <div id="status-progress" style="display: none;" oncontextmenu="event.preventDefault();"><div id="status-progress-inner"></div></div>
- <div id="status-indeterminate" style="display: none;" oncontextmenu="event.preventDefault();">
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
+ <div id="tabs">
+ <div id="tab-loader">
+ <div style="color: #e0e0e0;" id="persistence">
+ <br >
+ <img src="logo.svg" alt="Godot Engine logo" width="1024" height="414" style="width: auto; height: auto; max-width: min(85%, 50vh); max-height: 250px">
+ <br >
+ @GODOT_VERSION@
+ <br >
+ <a href="releases/">Need an old version?</a>
+ <br >
+ <br >
+ <br >
+ <label for="videoMode" style="margin-right: 1rem">Video driver:</label>
+ <select id="videoMode">
+ <option value="" selected="selected">Auto</option>
+ <option value="opengl3">WebGL 2</option>
+ </select>
+ <br >
+ <br >
+ <label for="zip-file" style="margin-right: 1rem">Preload project ZIP:</label>
+ <input id="zip-file" type="file" name="files" style="margin-bottom: 1rem">
+ <br >
+ <a href="demo.zip">(Try this for example)</a>
+ <br >
+ <br >
+ <button id="startButton" class="btn" style="margin-bottom: 4rem; font-weight: 700">Start Godot editor</button>
+ <br >
+ <button class="btn" onclick="clearPersistence()" style="margin-bottom: 1.5rem">Clear persistent data</button>
+ <br >
+ <a href="https://docs.godotengine.org/en/latest/tutorials/editor/using_the_web_editor.html">Web editor documentation</a>
+ </div>
+ </div>
+ <div id="tab-editor" style="display: none;">
+ <canvas id="editor-canvas" tabindex="1">
+ HTML5 canvas appears to be unsupported in the current browser.<br >
+ Please try updating or use a different browser.
+ </canvas>
+ </div>
+ <div id="tab-game" style="display: none;">
+ <canvas id="game-canvas" tabindex="2">
+ HTML5 canvas appears to be unsupported in the current browser.<br >
+ Please try updating or use a different browser.
+ </canvas>
+ </div>
+ <div id="tab-status" style="display: none;">
+ <div id="status-progress" style="display: none;" oncontextmenu="event.preventDefault();">
+ <div id="status-progress-inner"></div>
+ </div>
+ <div id="status-indeterminate" style="display: none;" oncontextmenu="event.preventDefault();">
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ </div>
+ <div id="status-notice" class="godot" style="display: none;"></div>
</div>
- <div id="status-notice" class="godot" style="display: none;"></div>
</div>
- </div>
- <script>//<![CDATA[
- window.addEventListener("load", () => {
- function notifyUpdate(sw) {
- const btn = document.getElementById("btn-tab-update");
- btn.onclick = function () {
- if (!window.confirm("Are you sure you want to update?\nClicking \"OK\" will reload all active instances!")) {
- return;
- }
- sw.postMessage("update");
- btn.innerHTML = "Updating...";
- btn.disabled = true;
- };
- btn.style.display = "";
- }
- if ("serviceWorker" in navigator) {
- navigator.serviceWorker.register("service.worker.js").then(function (reg) {
- if (reg.waiting) {
- notifyUpdate(reg.waiting);
- }
- reg.addEventListener("updatefound", function () {
- const update = reg.installing;
- update.addEventListener("statechange", function () {
- if (update.state === "installed") {
- // It's a new install, claim and perform aggressive caching.
- if (!reg.active) {
- update.postMessage("claim");
- } else {
- notifyUpdate(update);
- }
- }
- });
- });
- });
- }
-
- const missing = Engine.getMissingFeatures();
- if (missing.length) {
- // Display error dialog as threading support is required for the editor.
- setButtonEnabled('startButton', false);
- document.getElementById("welcome-modal-description").style.display = "none";
- document.getElementById("welcome-modal-missing-description").style.display = "block";
- document.getElementById("welcome-modal-dismiss").style.display = "none";
- const list = document.getElementById("welcome-modal-missing-list");
- for (let i = 0; i < missing.length; i++) {
- const node = document.createElement("li");
- node.innerText = missing[i];
- list.appendChild(node);
- }
- }
-
- if (missing.length || localStorage.getItem("welcomeModalDismissed") !== 'true') {
- document.getElementById("welcome-modal").style.display = "block";
- document.getElementById("welcome-modal-dismiss").focus();
+ <script>
+window.addEventListener('load', () => {
+ function notifyUpdate(sw) {
+ const btn = document.getElementById('btn-tab-update');
+ btn.onclick = function () {
+ if (!window.confirm('Are you sure you want to update?\nClicking "OK" will reload all active instances!')) {
+ return;
}
- });
-
- function closeWelcomeModal(dontShowAgain) {
- document.getElementById("welcome-modal").style.display = "none";
- if (dontShowAgain) {
- localStorage.setItem("welcomeModalDismissed", 'true');
+ sw.postMessage('update');
+ btn.innerHTML = 'Updating...';
+ btn.disabled = true;
+ };
+ btn.style.display = '';
+ }
+ if ('serviceWorker' in navigator) {
+ navigator.serviceWorker.register('service.worker.js').then(function (reg) {
+ if (reg.waiting) {
+ notifyUpdate(reg.waiting);
}
- }
- //]]></script>
- <script src="godot.editor.js"></script>
- <script>//<![CDATA[
-
- var editor = null;
- var game = null;
- var setStatusMode;
- var setStatusNotice;
- var video_driver = "";
-
- function clearPersistence() {
- function deleteDB(path) {
- return new Promise(function(resolve, reject) {
- var req = indexedDB.deleteDatabase(path);
- req.onsuccess = function() {
- resolve();
- };
- req.onerror = function(err) {
- reject(err);
- };
- req.onblocked = function(err) {
- reject(err);
+ reg.addEventListener('updatefound', function () {
+ const update = reg.installing;
+ update.addEventListener('statechange', function () {
+ if (update.state === 'installed') {
+ // It's a new install, claim and perform aggressive caching.
+ if (!reg.active) {
+ update.postMessage('claim');
+ } else {
+ notifyUpdate(update);
+ }
}
-
});
- }
- if (!window.confirm("Are you sure you want to delete all the locally stored files?\nClicking \"OK\" will permanently remove your projects and editor settings!")) {
- return;
- }
- Promise.all([
- deleteDB("/home/web_user"),
- ]).then(function(results) {
- alert("Done.");
- }).catch(function (err) {
- alert("Error deleting local files. Please retry after reloading the page.");
});
- }
-
- function selectVideoMode() {
- var select = document.getElementById('videoMode');
- video_driver = select.selectedOptions[0].value;
- }
-
- var tabs = [
- document.getElementById('tab-loader'),
- document.getElementById('tab-editor'),
- document.getElementById('tab-game')
- ]
- function showTab(name) {
- tabs.forEach(function (elem) {
- if (elem.id == 'tab-' + name) {
- elem.style.display = 'block';
- if (name == 'editor' || name == 'game') {
- const canvas = document.getElementById(name + '-canvas');
- canvas.focus();
- }
- } else {
- elem.style.display = 'none';
- }
- });
- }
-
- function setButtonEnabled(id, enabled) {
- if (enabled) {
- document.getElementById(id).disabled = "";
- } else {
- document.getElementById(id).disabled = "disabled";
+ });
+ }
+
+ const missing = Engine.getMissingFeatures();
+ if (missing.length) {
+ // Display error dialog as threading support is required for the editor.
+ document.getElementById('startButton').disabled = 'disabled';
+ document.getElementById('welcome-modal-description').style.display = 'none';
+ document.getElementById('welcome-modal-missing-description').style.display = 'block';
+ document.getElementById('welcome-modal-dismiss').style.display = 'none';
+ const list = document.getElementById('welcome-modal-missing-list');
+ for (let i = 0; i < missing.length; i++) {
+ const node = document.createElement('li');
+ node.innerText = missing[i];
+ list.appendChild(node);
+ }
+ }
+
+ if (missing.length || localStorage.getItem('welcomeModalDismissed') !== 'true') {
+ document.getElementById('welcome-modal').style.display = 'block';
+ document.getElementById('welcome-modal-dismiss').focus();
+ }
+});
+
+function closeWelcomeModal(dontShowAgain) { // eslint-disable-line no-unused-vars
+ document.getElementById('welcome-modal').style.display = 'none';
+ if (dontShowAgain) {
+ localStorage.setItem('welcomeModalDismissed', 'true');
+ }
+}
+ </script>
+ <script src="godot.editor.js"></script>
+ <script>
+let editor = null;
+let game = null;
+let setStatusMode;
+let setStatusNotice;
+let video_driver = '';
+
+function clearPersistence() { // eslint-disable-line no-unused-vars
+ function deleteDB(path) {
+ return new Promise(function (resolve, reject) {
+ const req = indexedDB.deleteDatabase(path);
+ req.onsuccess = function () {
+ resolve();
+ };
+ req.onerror = function (err) {
+ reject(err);
+ };
+ req.onblocked = function (err) {
+ reject(err);
+ };
+ });
+ }
+ if (!window.confirm('Are you sure you want to delete all the locally stored files?\nClicking "OK" will permanently remove your projects and editor settings!')) {
+ return;
+ }
+ Promise.all([
+ deleteDB('/home/web_user'),
+ ]).then(function (results) {
+ alert('Done.');
+ }).catch(function (err) {
+ alert('Error deleting local files. Please retry after reloading the page.');
+ });
+}
+
+function selectVideoMode() {
+ const select = document.getElementById('videoMode');
+ video_driver = select.selectedOptions[0].value;
+}
+
+const tabs = [
+ document.getElementById('tab-loader'),
+ document.getElementById('tab-editor'),
+ document.getElementById('tab-game'),
+];
+function showTab(name) {
+ tabs.forEach(function (elem) {
+ if (elem.id === `tab-${name}`) {
+ elem.style.display = 'block';
+ if (name === 'editor' || name === 'game') {
+ const canvas = document.getElementById(`${name}-canvas`);
+ canvas.focus();
}
+ } else {
+ elem.style.display = 'none';
+ }
+ });
+}
+
+function setButtonEnabled(id, enabled) {
+ if (enabled) {
+ document.getElementById(id).disabled = '';
+ } else {
+ document.getElementById(id).disabled = 'disabled';
+ }
+}
+
+function setLoaderEnabled(enabled) {
+ setButtonEnabled('btn-tab-loader', enabled);
+ setButtonEnabled('btn-tab-editor', !enabled);
+ setButtonEnabled('btn-close-editor', !enabled);
+}
+
+function setGameTabEnabled(enabled) {
+ setButtonEnabled('btn-tab-game', enabled);
+ setButtonEnabled('btn-close-game', enabled);
+}
+
+function closeGame() {
+ if (game) {
+ game.requestQuit();
+ }
+}
+
+function closeEditor() { // eslint-disable-line no-unused-vars
+ closeGame();
+ if (editor) {
+ editor.requestQuit();
+ }
+}
+
+function startEditor(zip) {
+ const INDETERMINATE_STATUS_STEP_MS = 100;
+ const persistentPaths = ['/home/web_user'];
+
+ let editorCanvas = document.getElementById('editor-canvas');
+ let gameCanvas = document.getElementById('game-canvas');
+ const statusProgress = document.getElementById('status-progress');
+ const statusProgressInner = document.getElementById('status-progress-inner');
+ const statusIndeterminate = document.getElementById('status-indeterminate');
+ const statusNotice = document.getElementById('status-notice');
+ const headerDiv = document.getElementById('tabs-buttons');
+
+ let initializing = true;
+ let statusMode = 'hidden';
+
+ showTab('status');
+
+ let animationCallbacks = [];
+ function animate(time) {
+ animationCallbacks.forEach((callback) => callback(time));
+ requestAnimationFrame(animate);
+ }
+ requestAnimationFrame(animate);
+
+ let lastScale = 0;
+ let lastWidth = 0;
+ let lastHeight = 0;
+ function adjustCanvasDimensions() {
+ const scale = window.devicePixelRatio || 1;
+ const headerHeight = headerDiv.offsetHeight + 1;
+ const width = window.innerWidth;
+ const height = window.innerHeight - headerHeight;
+ if (lastScale !== scale || lastWidth !== width || lastHeight !== height) {
+ editorCanvas.width = width * scale;
+ editorCanvas.height = height * scale;
+ editorCanvas.style.width = `${width}px`;
+ editorCanvas.style.height = `${height}px`;
+ lastScale = scale;
+ lastWidth = width;
+ lastHeight = height;
+ }
+ }
+ animationCallbacks.push(adjustCanvasDimensions);
+ adjustCanvasDimensions();
+
+ function replaceCanvas(from) {
+ const out = document.createElement('canvas');
+ out.id = from.id;
+ out.tabIndex = from.tabIndex;
+ from.parentNode.replaceChild(out, from);
+ lastScale = 0;
+ return out;
+ }
+
+ function animateStatusIndeterminate(ms) {
+ const i = Math.floor((ms / INDETERMINATE_STATUS_STEP_MS) % 8);
+ if (statusIndeterminate.children[i].style.borderTopColor === '') {
+ Array.prototype.slice.call(statusIndeterminate.children).forEach((child) => {
+ child.style.borderTopColor = '';
+ });
+ statusIndeterminate.children[i].style.borderTopColor = '#dfdfdf';
}
+ }
- function setLoaderEnabled(enabled) {
- setButtonEnabled('btn-tab-loader', enabled);
- setButtonEnabled('btn-tab-editor', !enabled);
- setButtonEnabled('btn-close-editor', !enabled);
- }
-
- function setGameTabEnabled(enabled) {
- setButtonEnabled('btn-tab-game', enabled);
- setButtonEnabled('btn-close-game', enabled);
+ setStatusMode = function (mode) {
+ if (statusMode === mode || !initializing) {
+ return;
}
-
- function closeGame() {
+ [statusProgress, statusIndeterminate, statusNotice].forEach((elem) => {
+ elem.style.display = 'none';
+ });
+ animationCallbacks = animationCallbacks.filter(function (value) {
+ return (value !== animateStatusIndeterminate);
+ });
+ switch (mode) {
+ case 'progress':
+ statusProgress.style.display = 'block';
+ break;
+ case 'indeterminate':
+ statusIndeterminate.style.display = 'block';
+ animationCallbacks.push(animateStatusIndeterminate);
+ break;
+ case 'notice':
+ statusNotice.style.display = 'block';
+ break;
+ case 'hidden':
+ break;
+ default:
+ throw new Error('Invalid status mode');
+ }
+ statusMode = mode;
+ };
+
+ setStatusNotice = function (text) {
+ while (statusNotice.lastChild) {
+ statusNotice.removeChild(statusNotice.lastChild);
+ }
+ const lines = text.split('\n');
+ lines.forEach((line) => {
+ statusNotice.appendChild(document.createTextNode(line));
+ statusNotice.appendChild(document.createElement('br'));
+ });
+ };
+
+ const gameConfig = {
+ 'persistentPaths': persistentPaths,
+ 'unloadAfterInit': false,
+ 'canvas': gameCanvas,
+ 'canvasResizePolicy': 1,
+ 'onExit': function () {
+ gameCanvas = replaceCanvas(gameCanvas);
+ setGameTabEnabled(false);
+ showTab('editor');
+ game = null;
+ },
+ };
+
+ let OnEditorExit = function () {
+ showTab('loader');
+ setLoaderEnabled(true);
+ };
+ function Execute(args) {
+ const is_editor = args.filter(function (v) {
+ return v === '--editor' || v === '-e';
+ }).length !== 0;
+ const is_project_manager = args.filter(function (v) {
+ return v === '--project-manager';
+ }).length !== 0;
+ const is_game = !is_editor && !is_project_manager;
+ if (video_driver) {
+ args.push('--rendering-driver', video_driver);
+ }
+
+ if (is_game) {
if (game) {
- game.requestQuit();
- }
- }
-
- function closeEditor() {
- closeGame();
- if (editor) {
- editor.requestQuit();
- }
- }
-
- function startEditor(zip) {
- const INDETERMINATE_STATUS_STEP_MS = 100;
- const persistentPaths = ['/home/web_user'];
-
- var editorCanvas = document.getElementById('editor-canvas');
- var gameCanvas = document.getElementById('game-canvas');
- var statusProgress = document.getElementById('status-progress');
- var statusProgressInner = document.getElementById('status-progress-inner');
- var statusIndeterminate = document.getElementById('status-indeterminate');
- var statusNotice = document.getElementById('status-notice');
- var headerDiv = document.getElementById('tabs-buttons');
-
- var initializing = true;
- var statusMode = 'hidden';
-
- showTab('status');
-
- var animationCallbacks = [];
- function animate(time) {
- animationCallbacks.forEach(callback => callback(time));
- requestAnimationFrame(animate);
- }
- requestAnimationFrame(animate);
-
- var lastScale = 0;
- var lastWidth = 0;
- var lastHeight = 0;
- function adjustCanvasDimensions() {
- var scale = window.devicePixelRatio || 1;
- var headerHeight = headerDiv.offsetHeight + 1;
- var width = window.innerWidth;
- var height = window.innerHeight - headerHeight;
- if (lastScale !== scale || lastWidth !== width || lastHeight !== height) {
- editorCanvas.width = width * scale;
- editorCanvas.height = height * scale;
- editorCanvas.style.width = width + "px";
- editorCanvas.style.height = height + "px";
- lastScale = scale;
- lastWidth = width;
- lastHeight = height;
- }
- }
- animationCallbacks.push(adjustCanvasDimensions);
- adjustCanvasDimensions();
-
- function replaceCanvas(from) {
- const out = document.createElement("canvas");
- out.id = from.id;
- out.tabIndex = from.tabIndex;
- from.parentNode.replaceChild(out, from);
- lastScale = 0;
- return out;
+ console.error('A game is already running. Close it first');
+ return;
}
-
- setStatusMode = function setStatusMode(mode) {
- if (statusMode === mode || !initializing)
- return;
- [statusProgress, statusIndeterminate, statusNotice].forEach(elem => {
- elem.style.display = 'none';
- });
- animationCallbacks = animationCallbacks.filter(function(value) {
- return (value != animateStatusIndeterminate);
- });
- switch (mode) {
- case 'progress':
- statusProgress.style.display = 'block';
- break;
- case 'indeterminate':
- statusIndeterminate.style.display = 'block';
- animationCallbacks.push(animateStatusIndeterminate);
- break;
- case 'notice':
- statusNotice.style.display = 'block';
- break;
- case 'hidden':
- break;
- default:
- throw new Error('Invalid status mode');
- }
- statusMode = mode;
- };
-
- function animateStatusIndeterminate(ms) {
- var i = Math.floor(ms / INDETERMINATE_STATUS_STEP_MS % 8);
- if (statusIndeterminate.children[i].style.borderTopColor == '') {
- Array.prototype.slice.call(statusIndeterminate.children).forEach(child => {
- child.style.borderTopColor = '';
+ setGameTabEnabled(true);
+ game = new Engine(gameConfig);
+ showTab('game');
+ game.init().then(function () {
+ requestAnimationFrame(function () {
+ game.start({ 'args': args, 'canvas': gameCanvas }).then(function () {
+ gameCanvas.focus();
});
- statusIndeterminate.children[i].style.borderTopColor = '#dfdfdf';
- }
- }
-
- setStatusNotice = function setStatusNotice(text) {
- while (statusNotice.lastChild) {
- statusNotice.removeChild(statusNotice.lastChild);
- }
- var lines = text.split('\n');
- lines.forEach((line) => {
- statusNotice.appendChild(document.createTextNode(line));
- statusNotice.appendChild(document.createElement('br'));
});
- };
-
- const gameConfig = {
- 'persistentPaths': persistentPaths,
- 'unloadAfterInit': false,
- 'canvas': gameCanvas,
- 'canvasResizePolicy': 1,
- 'onExit': function () {
- gameCanvas = replaceCanvas(gameCanvas);
- setGameTabEnabled(false);
- showTab('editor');
- game = null;
- },
- };
-
- var OnEditorExit = function () {
- showTab('loader');
+ });
+ } else { // New editor instances will be run in the same canvas. We want to wait for it to exit.
+ OnEditorExit = function (code) {
setLoaderEnabled(true);
- };
- function Execute(args) {
- const is_editor = args.filter(function(v) { return v == '--editor' || v == '-e' }).length != 0;
- const is_project_manager = args.filter(function(v) { return v == '--project-manager' }).length != 0;
- const is_game = !is_editor && !is_project_manager;
- if (video_driver) {
- args.push('--rendering-driver', video_driver);
- }
-
- if (is_game) {
- if (game) {
- console.error("A game is already running. Close it first");
- return;
- }
- setGameTabEnabled(true);
- game = new Engine(gameConfig);
- showTab('game');
- game.init().then(function() {
- requestAnimationFrame(function() {
- game.start({'args': args, 'canvas': gameCanvas}).then(function() {
- gameCanvas.focus();
- });
- });
+ setTimeout(function () {
+ editor.init().then(function () {
+ setLoaderEnabled(false);
+ OnEditorExit = function () {
+ showTab('loader');
+ setLoaderEnabled(true);
+ };
+ editor.start({ 'args': args, 'persistentDrops': is_project_manager, 'canvas': editorCanvas });
});
- } else { // New editor instances will be run in the same canvas. We want to wait for it to exit.
- OnEditorExit = function(code) {
- setLoaderEnabled(true);
- setTimeout(function() {
- editor.init().then(function() {
- setLoaderEnabled(false);
- OnEditorExit = function() {
- showTab('loader');
- setLoaderEnabled(true);
- };
- editor.start({'args': args, 'persistentDrops': is_project_manager, 'canvas': editorCanvas});
- });
- }, 0);
- OnEditorExit = null;
- };
- }
- }
-
- const editorConfig = {
- 'unloadAfterInit': false,
- 'onProgress': function progressFunction (current, total) {
- if (total > 0) {
- statusProgressInner.style.width = current/total * 100 + '%';
- setStatusMode('progress');
- if (current === total) {
- // wait for progress bar animation
- setTimeout(() => {
- setStatusMode('indeterminate');
- }, 100);
- }
- } else {
- setStatusMode('indeterminate');
- }
- },
- 'canvas': editorCanvas,
- 'canvasResizePolicy': 0,
- 'onExit': function() {
- editorCanvas = replaceCanvas(editorCanvas);
- if (OnEditorExit) {
- OnEditorExit();
- }
- },
- 'onExecute': Execute,
- 'persistentPaths': persistentPaths,
+ }, 0);
+ OnEditorExit = null;
};
- editor = new Engine(editorConfig);
-
- function displayFailureNotice(err) {
- var msg = err.message || err;
- console.error(msg);
- setStatusNotice(msg);
- setStatusMode('notice');
- initializing = false;
- };
-
- if (!Engine.isWebGLAvailable()) {
- displayFailureNotice('WebGL not available');
+ }
+ }
+
+ const editorConfig = {
+ 'unloadAfterInit': false,
+ 'onProgress': function progressFunction(current, total) {
+ if (total > 0) {
+ statusProgressInner.style.width = `${(current / total) * 100}%`;
+ setStatusMode('progress');
+ if (current === total) {
+ // wait for progress bar animation
+ setTimeout(() => {
+ setStatusMode('indeterminate');
+ }, 100);
+ }
} else {
setStatusMode('indeterminate');
- editor.init('godot.editor').then(function() {
- if (zip) {
- editor.copyToFS("/tmp/preload.zip", zip);
- }
- try {
- // Avoid user creating project in the persistent root folder.
- editor.copyToFS("/home/web_user/keep", new Uint8Array());
- } catch(e) {
- // File exists
- }
- selectVideoMode();
- showTab('editor');
- setLoaderEnabled(false);
- const args = ['--project-manager', '--single-window'];
- if (video_driver) {
- args.push('--rendering-driver', video_driver);
- }
- editor.start({'args': args, 'persistentDrops': true}).then(function() {
- setStatusMode('hidden');
- initializing = false;
- });
- }).catch(displayFailureNotice);
}
- };
- document.getElementById("startButton").onclick = function() {
- preloadZip(document.getElementById('zip-file')).then(function(zip) {
- startEditor(zip);
+ },
+ 'canvas': editorCanvas,
+ 'canvasResizePolicy': 0,
+ 'onExit': function () {
+ editorCanvas = replaceCanvas(editorCanvas);
+ if (OnEditorExit) {
+ OnEditorExit();
+ }
+ },
+ 'onExecute': Execute,
+ 'persistentPaths': persistentPaths,
+ };
+ editor = new Engine(editorConfig);
+
+ function displayFailureNotice(err) {
+ const msg = err.message || err;
+ console.error(msg);
+ setStatusNotice(msg);
+ setStatusMode('notice');
+ initializing = false;
+ }
+
+ if (!Engine.isWebGLAvailable()) {
+ displayFailureNotice('WebGL not available');
+ } else {
+ setStatusMode('indeterminate');
+ editor.init('godot.editor').then(function () {
+ if (zip) {
+ editor.copyToFS('/tmp/preload.zip', zip);
+ }
+ try {
+ // Avoid user creating project in the persistent root folder.
+ editor.copyToFS('/home/web_user/keep', new Uint8Array());
+ } catch (e) {
+ // File exists
+ }
+ selectVideoMode();
+ showTab('editor');
+ setLoaderEnabled(false);
+ const args = ['--project-manager', '--single-window'];
+ if (video_driver) {
+ args.push('--rendering-driver', video_driver);
+ }
+ editor.start({ 'args': args, 'persistentDrops': true }).then(function () {
+ setStatusMode('hidden');
+ initializing = false;
});
- }
-
- function preloadZip(target) {
- return new Promise(function(resolve, reject) {
- if (target.files.length > 0) {
- target.files[0].arrayBuffer().then(function(data) {
- resolve(data);
- });
- } else {
- resolve();
- }
+ }).catch(displayFailureNotice);
+ }
+}
+
+function preloadZip(target) {
+ return new Promise(function (resolve, reject) {
+ if (target.files.length > 0) {
+ target.files[0].arrayBuffer().then(function (data) {
+ resolve(data);
});
- }
- //]]></script>
-</body>
+ } else {
+ resolve();
+ }
+ });
+}
+
+document.getElementById('startButton').onclick = function () {
+ preloadZip(document.getElementById('zip-file')).then(function (zip) {
+ startEditor(zip);
+ });
+};
+ </script>
+ </body>
</html>
diff --git a/misc/dist/html/full-size.html b/misc/dist/html/full-size.html
index d5b0050cfd..6ae3e5cc73 100644
--- a/misc/dist/html/full-size.html
+++ b/misc/dist/html/full-size.html
@@ -1,247 +1,245 @@
<!DOCTYPE html>
-<html xmlns='https://www.w3.org/1999/xhtml' lang='' xml:lang=''>
-<head>
- <meta charset='utf-8' />
- <meta name='viewport' content='width=device-width, user-scalable=no' />
- <title>$GODOT_PROJECT_NAME</title>
- <style type='text/css'>
-
- body {
- touch-action: none;
- margin: 0;
- border: 0 none;
- padding: 0;
- text-align: center;
- background-color: black;
- }
-
- #canvas {
- display: block;
- margin: 0;
- color: white;
- }
-
- #canvas:focus {
- outline: none;
- }
-
- .godot {
- font-family: 'Noto Sans', 'Droid Sans', Arial, sans-serif;
- color: #e0e0e0;
- background-color: #3b3943;
- background-image: linear-gradient(to bottom, #403e48, #35333c);
- border: 1px solid #45434e;
- box-shadow: 0 0 1px 1px #2f2d35;
- }
-
-
- /* Status display
- * ============== */
-
- #status {
- position: absolute;
- left: 0;
- top: 0;
- right: 0;
- bottom: 0;
- display: flex;
- justify-content: center;
- align-items: center;
- /* don't consume click events - make children visible explicitly */
- visibility: hidden;
- }
-
- #status-progress {
- width: 366px;
- height: 7px;
- background-color: #38363A;
- border: 1px solid #444246;
- padding: 1px;
- box-shadow: 0 0 2px 1px #1B1C22;
- border-radius: 2px;
- visibility: visible;
- }
-
- @media only screen and (orientation:portrait) {
- #status-progress {
- width: 61.8%;
- }
- }
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, user-scalable=no">
+ <title>$GODOT_PROJECT_NAME</title>
+ <style>
+body {
+ touch-action: none;
+ margin: 0;
+ border: 0 none;
+ padding: 0;
+ text-align: center;
+ background-color: black;
+}
+
+#canvas {
+ display: block;
+ margin: 0;
+ color: white;
+}
+
+#canvas:focus {
+ outline: none;
+}
+
+.godot {
+ font-family: 'Noto Sans', 'Droid Sans', Arial, sans-serif;
+ color: #e0e0e0;
+ background-color: #3b3943;
+ background-image: linear-gradient(to bottom, #403e48, #35333c);
+ border: 1px solid #45434e;
+ box-shadow: 0 0 1px 1px #2f2d35;
+}
+
+/* Status display */
+
+#status {
+ position: absolute;
+ left: 0;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ /* don't consume click events - make children visible explicitly */
+ visibility: hidden;
+}
+
+#status-progress {
+ width: 366px;
+ height: 7px;
+ background-color: #38363A;
+ border: 1px solid #444246;
+ padding: 1px;
+ box-shadow: 0 0 2px 1px #1B1C22;
+ border-radius: 2px;
+ visibility: visible;
+}
+
+@media only screen and (orientation:portrait) {
+ #status-progress {
+ width: 61.8%;
+ }
+}
+
+#status-progress-inner {
+ height: 100%;
+ width: 0;
+ box-sizing: border-box;
+ transition: width 0.5s linear;
+ background-color: #202020;
+ border: 1px solid #222223;
+ box-shadow: 0 0 1px 1px #27282E;
+ border-radius: 3px;
+}
+
+#status-indeterminate {
+ height: 42px;
+ visibility: visible;
+ position: relative;
+}
+
+#status-indeterminate > div {
+ width: 4.5px;
+ height: 0;
+ border-style: solid;
+ border-width: 9px 3px 0 3px;
+ border-color: #2b2b2b transparent transparent transparent;
+ transform-origin: center 21px;
+ position: absolute;
+}
+
+#status-indeterminate > div:nth-child(1) { transform: rotate( 22.5deg); }
+#status-indeterminate > div:nth-child(2) { transform: rotate( 67.5deg); }
+#status-indeterminate > div:nth-child(3) { transform: rotate(112.5deg); }
+#status-indeterminate > div:nth-child(4) { transform: rotate(157.5deg); }
+#status-indeterminate > div:nth-child(5) { transform: rotate(202.5deg); }
+#status-indeterminate > div:nth-child(6) { transform: rotate(247.5deg); }
+#status-indeterminate > div:nth-child(7) { transform: rotate(292.5deg); }
+#status-indeterminate > div:nth-child(8) { transform: rotate(337.5deg); }
+
+#status-notice {
+ margin: 0 100px;
+ line-height: 1.3;
+ visibility: visible;
+ padding: 4px 6px;
+ visibility: visible;
+}
+ </style>
+ $GODOT_HEAD_INCLUDE
+ </head>
+ <body>
+ <canvas id="canvas">
+ HTML5 canvas appears to be unsupported in the current browser.<br >
+ Please try updating or use a different browser.
+ </canvas>
+ <div id="status">
+ <div id="status-progress" style="display: none;" oncontextmenu="event.preventDefault();">
+ <div id ="status-progress-inner"></div>
+ </div>
+ <div id="status-indeterminate" style="display: none;" oncontextmenu="event.preventDefault();">
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ </div>
+ <div id="status-notice" class="godot" style="display: none;"></div>
+ </div>
- #status-progress-inner {
- height: 100%;
- width: 0;
- box-sizing: border-box;
- transition: width 0.5s linear;
- background-color: #202020;
- border: 1px solid #222223;
- box-shadow: 0 0 1px 1px #27282E;
- border-radius: 3px;
+ <script src="$GODOT_URL"></script>
+ <script>
+const GODOT_CONFIG = $GODOT_CONFIG;
+const engine = new Engine(GODOT_CONFIG);
+
+(function () {
+ const INDETERMINATE_STATUS_STEP_MS = 100;
+ const statusProgress = document.getElementById('status-progress');
+ const statusProgressInner = document.getElementById('status-progress-inner');
+ const statusIndeterminate = document.getElementById('status-indeterminate');
+ const statusNotice = document.getElementById('status-notice');
+
+ let initializing = true;
+ let statusMode = 'hidden';
+
+ let animationCallbacks = [];
+ function animate(time) {
+ animationCallbacks.forEach((callback) => callback(time));
+ requestAnimationFrame(animate);
+ }
+ requestAnimationFrame(animate);
+
+ function animateStatusIndeterminate(ms) {
+ const i = Math.floor((ms / INDETERMINATE_STATUS_STEP_MS) % 8);
+ if (statusIndeterminate.children[i].style.borderTopColor === '') {
+ Array.prototype.slice.call(statusIndeterminate.children).forEach((child) => {
+ child.style.borderTopColor = '';
+ });
+ statusIndeterminate.children[i].style.borderTopColor = '#dfdfdf';
}
+ }
- #status-indeterminate {
- height: 42px;
- visibility: visible;
- position: relative;
+ function setStatusMode(mode) {
+ if (statusMode === mode || !initializing) {
+ return;
}
-
- #status-indeterminate > div {
- width: 4.5px;
- height: 0;
- border-style: solid;
- border-width: 9px 3px 0 3px;
- border-color: #2b2b2b transparent transparent transparent;
- transform-origin: center 21px;
- position: absolute;
+ [statusProgress, statusIndeterminate, statusNotice].forEach((elem) => {
+ elem.style.display = 'none';
+ });
+ animationCallbacks = animationCallbacks.filter(function (value) {
+ return (value !== animateStatusIndeterminate);
+ });
+ switch (mode) {
+ case 'progress':
+ statusProgress.style.display = 'block';
+ break;
+ case 'indeterminate':
+ statusIndeterminate.style.display = 'block';
+ animationCallbacks.push(animateStatusIndeterminate);
+ break;
+ case 'notice':
+ statusNotice.style.display = 'block';
+ break;
+ case 'hidden':
+ break;
+ default:
+ throw new Error('Invalid status mode');
}
+ statusMode = mode;
+ }
- #status-indeterminate > div:nth-child(1) { transform: rotate( 22.5deg); }
- #status-indeterminate > div:nth-child(2) { transform: rotate( 67.5deg); }
- #status-indeterminate > div:nth-child(3) { transform: rotate(112.5deg); }
- #status-indeterminate > div:nth-child(4) { transform: rotate(157.5deg); }
- #status-indeterminate > div:nth-child(5) { transform: rotate(202.5deg); }
- #status-indeterminate > div:nth-child(6) { transform: rotate(247.5deg); }
- #status-indeterminate > div:nth-child(7) { transform: rotate(292.5deg); }
- #status-indeterminate > div:nth-child(8) { transform: rotate(337.5deg); }
-
- #status-notice {
- margin: 0 100px;
- line-height: 1.3;
- visibility: visible;
- padding: 4px 6px;
- visibility: visible;
+ function setStatusNotice(text) {
+ while (statusNotice.lastChild) {
+ statusNotice.removeChild(statusNotice.lastChild);
}
- </style>
-$GODOT_HEAD_INCLUDE
-</head>
-<body>
- <canvas id='canvas'>
- HTML5 canvas appears to be unsupported in the current browser.<br />
- Please try updating or use a different browser.
- </canvas>
- <div id='status'>
- <div id='status-progress' style='display: none;' oncontextmenu='event.preventDefault();'><div id ='status-progress-inner'></div></div>
- <div id='status-indeterminate' style='display: none;' oncontextmenu='event.preventDefault();'>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- </div>
- <div id='status-notice' class='godot' style='display: none;'></div>
- </div>
-
- <script type='text/javascript' src='$GODOT_URL'></script>
- <script type='text/javascript'>//<![CDATA[
-
- const GODOT_CONFIG = $GODOT_CONFIG;
- var engine = new Engine(GODOT_CONFIG);
-
- (function() {
- const INDETERMINATE_STATUS_STEP_MS = 100;
- var statusProgress = document.getElementById('status-progress');
- var statusProgressInner = document.getElementById('status-progress-inner');
- var statusIndeterminate = document.getElementById('status-indeterminate');
- var statusNotice = document.getElementById('status-notice');
-
- var initializing = true;
- var statusMode = 'hidden';
-
- var animationCallbacks = [];
- function animate(time) {
- animationCallbacks.forEach(callback => callback(time));
- requestAnimationFrame(animate);
- }
- requestAnimationFrame(animate);
-
- function setStatusMode(mode) {
-
- if (statusMode === mode || !initializing)
- return;
- [statusProgress, statusIndeterminate, statusNotice].forEach(elem => {
- elem.style.display = 'none';
- });
- animationCallbacks = animationCallbacks.filter(function(value) {
- return (value != animateStatusIndeterminate);
- });
- switch (mode) {
- case 'progress':
- statusProgress.style.display = 'block';
- break;
- case 'indeterminate':
- statusIndeterminate.style.display = 'block';
- animationCallbacks.push(animateStatusIndeterminate);
- break;
- case 'notice':
- statusNotice.style.display = 'block';
- break;
- case 'hidden':
- break;
- default:
- throw new Error('Invalid status mode');
- }
- statusMode = mode;
- }
-
- function animateStatusIndeterminate(ms) {
- var i = Math.floor(ms / INDETERMINATE_STATUS_STEP_MS % 8);
- if (statusIndeterminate.children[i].style.borderTopColor == '') {
- Array.prototype.slice.call(statusIndeterminate.children).forEach(child => {
- child.style.borderTopColor = '';
- });
- statusIndeterminate.children[i].style.borderTopColor = '#dfdfdf';
- }
- }
-
- function setStatusNotice(text) {
- while (statusNotice.lastChild) {
- statusNotice.removeChild(statusNotice.lastChild);
- }
- var lines = text.split('\n');
- lines.forEach((line) => {
- statusNotice.appendChild(document.createTextNode(line));
- statusNotice.appendChild(document.createElement('br'));
- });
- };
-
- function displayFailureNotice(err) {
- var msg = err.message || err;
- console.error(msg);
- setStatusNotice(msg);
- setStatusMode('notice');
- initializing = false;
- };
-
- const missing = Engine.getMissingFeatures();
- if (missing.length !== 0) {
- const missingMsg = 'Warning!\nThe following features required to run Godot projects on the Web are missing:\n';
- displayFailureNotice(missingMsg + missing.join("\n"));
- } else {
- setStatusMode('indeterminate');
- engine.startGame({
- 'onProgress': function (current, total) {
- if (total > 0) {
- statusProgressInner.style.width = current/total * 100 + '%';
- setStatusMode('progress');
- if (current === total) {
- // wait for progress bar animation
- setTimeout(() => {
- setStatusMode('indeterminate');
- }, 500);
- }
- } else {
+ const lines = text.split('\n');
+ lines.forEach((line) => {
+ statusNotice.appendChild(document.createTextNode(line));
+ statusNotice.appendChild(document.createElement('br'));
+ });
+ }
+
+ function displayFailureNotice(err) {
+ const msg = err.message || err;
+ console.error(msg);
+ setStatusNotice(msg);
+ setStatusMode('notice');
+ initializing = false;
+ }
+
+ const missing = Engine.getMissingFeatures();
+ if (missing.length !== 0) {
+ const missingMsg = 'Warning!\nThe following features required to run Godot projects on the Web are missing:\n';
+ displayFailureNotice(missingMsg + missing.join('\n'));
+ } else {
+ setStatusMode('indeterminate');
+ engine.startGame({
+ 'onProgress': function (current, total) {
+ if (total > 0) {
+ statusProgressInner.style.width = `${(current / total) * 100}%`;
+ setStatusMode('progress');
+ if (current === total) {
+ // wait for progress bar animation
+ setTimeout(() => {
setStatusMode('indeterminate');
- }
- },
- }).then(() => {
- setStatusMode('hidden');
- initializing = false;
- }, displayFailureNotice);
- }
- })();
- //]]></script>
-</body>
+ }, 500);
+ }
+ } else {
+ setStatusMode('indeterminate');
+ }
+ },
+ }).then(() => {
+ setStatusMode('hidden');
+ initializing = false;
+ }, displayFailureNotice);
+ }
+}());
+ </script>
+ </body>
</html>
diff --git a/misc/dist/html/offline-export.html b/misc/dist/html/offline-export.html
index 41ab42b04b..ae5298ae46 100644
--- a/misc/dist/html/offline-export.html
+++ b/misc/dist/html/offline-export.html
@@ -1,42 +1,41 @@
<!DOCTYPE html>
<html lang="en">
-<head>
- <meta charset="utf-8" />
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
- <meta name="viewport" content="width=device-width, initial-scale=1" />
- <title>You are offline</title>
- <style>
- html {
- background-color: #000000;
- color: #ffffff;
- }
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>You are offline</title>
+ <style>
+html {
+ background-color: #000000;
+ color: #ffffff;
+}
- body {
- font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
- margin: 2rem;
- }
+body {
+ font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
+ margin: 2rem;
+}
- p {
- margin-block: 1rem;
- }
+p {
+ margin-block: 1rem;
+}
- button {
- display: block;
- padding: 1rem 2rem;
- margin: 3rem auto 0;
- }
- </style>
-</head>
-<body>
- <h1>You are offline</h1>
- <p>This application requires an Internet connection to run for the first time.</p>
- <p>Press the button below to try reloading:</p>
- <button type="button">Reload</button>
-
- <script>
- document.querySelector("button").addEventListener("click", () => {
- window.location.reload();
- });
- </script>
-</body>
+button {
+ display: block;
+ padding: 1rem 2rem;
+ margin: 3rem auto 0;
+}
+ </style>
+ </head>
+ <body>
+ <h1>You are offline</h1>
+ <p>This application requires an Internet connection to run for the first time.</p>
+ <p>Press the button below to try reloading:</p>
+ <button type="button">Reload</button>
+ <script>
+document.querySelector('button').addEventListener('click', () => {
+ window.location.reload();
+});
+ </script>
+ </body>
</html>
diff --git a/misc/dist/html/offline.html b/misc/dist/html/offline.html
index 5cfc3362d9..123181e3e0 100644
--- a/misc/dist/html/offline.html
+++ b/misc/dist/html/offline.html
@@ -1,44 +1,44 @@
<!DOCTYPE html>
<html lang="en">
-<head>
- <meta charset="utf-8" />
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
- <meta name="viewport" content="width=device-width, initial-scale=1" />
- <meta name="theme-color" content="#202531" />
- <meta name="msapplication-navbutton-color" content="#202531" />
- <title>You are offline</title>
- <style>
- html {
- background-color: #333b4f;
- color: #e0e0e0;
- }
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta name="theme-color" content="#202531">
+ <meta name="msapplication-navbutton-color" content="#202531">
+ <title>You are offline</title>
+ <style>
+html {
+ background-color: #333b4f;
+ color: #e0e0e0;
+}
- body {
- font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
- margin: 2rem;
- }
+body {
+ font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
+ margin: 2rem;
+}
- p {
- margin-block: 1rem;
- }
+p {
+ margin-block: 1rem;
+}
- button {
- display: block;
- padding: 1rem 2rem;
- margin: 3rem auto 0;
- }
- </style>
-</head>
-<body>
- <h1>You are offline</h1>
- <p>This application requires an Internet connection to run for the first time.</p>
- <p>Press the button below to try reloading:</p>
- <button type="button">Reload</button>
+button {
+ display: block;
+ padding: 1rem 2rem;
+ margin: 3rem auto 0;
+}
+ </style>
+ </head>
+ <body>
+ <h1>You are offline</h1>
+ <p>This application requires an Internet connection to run for the first time.</p>
+ <p>Press the button below to try reloading:</p>
+ <button type="button">Reload</button>
- <script>
- document.querySelector("button").addEventListener("click", () => {
- window.location.reload();
- });
- </script>
-</body>
+ <script>
+document.querySelector('button').addEventListener('click', () => {
+ window.location.reload();
+});
+ </script>
+ </body>
</html>
diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp
index 8645aa6f15..996d323a7f 100644
--- a/modules/gdscript/editor/gdscript_highlighter.cpp
+++ b/modules/gdscript/editor/gdscript_highlighter.cpp
@@ -256,7 +256,7 @@ Dictionary GDScriptSyntaxHighlighter::_get_line_syntax_highlighting_impl(int p_l
}
String word = str.substr(from + 1, to - from);
// Keywords need to be exceptions, except for keywords that represent a value.
- if (word == "true" || word == "false" || word == "null" || word == "PI" || word == "TAU" || word == "INF" || word == "NAN" || word == "self" || word == "super" || !keywords.has(word)) {
+ if (word == "true" || word == "false" || word == "null" || word == "PI" || word == "TAU" || word == "INF" || word == "NAN" || word == "self" || word == "super" || !reserved_keywords.has(word)) {
if (!is_symbol(str[to]) || str[to] == '"' || str[to] == '\'' || str[to] == ')' || str[to] == ']' || str[to] == '}') {
is_binary_op = true;
}
@@ -338,8 +338,10 @@ Dictionary GDScriptSyntaxHighlighter::_get_line_syntax_highlighting_impl(int p_l
col = global_function_color;
}
}
- } else if (keywords.has(word)) {
- col = keywords[word];
+ } else if (class_names.has(word)) {
+ col = class_names[word];
+ } else if (reserved_keywords.has(word)) {
+ col = reserved_keywords[word];
} else if (member_keywords.has(word)) {
col = member_keywords[word];
}
@@ -563,7 +565,8 @@ PackedStringArray GDScriptSyntaxHighlighter::_get_supported_languages() const {
}
void GDScriptSyntaxHighlighter::_update_cache() {
- keywords.clear();
+ class_names.clear();
+ reserved_keywords.clear();
member_keywords.clear();
global_functions.clear();
color_regions.clear();
@@ -580,7 +583,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
List<StringName> types;
ClassDB::get_class_list(&types);
for (const StringName &E : types) {
- keywords[E] = types_color;
+ class_names[E] = types_color;
}
/* User types. */
@@ -588,14 +591,14 @@ void GDScriptSyntaxHighlighter::_update_cache() {
List<StringName> global_classes;
ScriptServer::get_global_class_list(&global_classes);
for (const StringName &E : global_classes) {
- keywords[E] = usertype_color;
+ class_names[E] = usertype_color;
}
/* Autoloads. */
for (const KeyValue<StringName, ProjectSettings::AutoloadInfo> &E : ProjectSettings::get_singleton()->get_autoload_list()) {
const ProjectSettings::AutoloadInfo &info = E.value;
if (info.is_singleton) {
- keywords[info.name] = usertype_color;
+ class_names[info.name] = usertype_color;
}
}
@@ -606,7 +609,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
List<String> core_types;
gdscript->get_core_type_words(&core_types);
for (const String &E : core_types) {
- keywords[StringName(E)] = basetype_color;
+ class_names[StringName(E)] = basetype_color;
}
/* Reserved words. */
@@ -616,9 +619,9 @@ void GDScriptSyntaxHighlighter::_update_cache() {
gdscript->get_reserved_words(&keyword_list);
for (const String &E : keyword_list) {
if (gdscript->is_control_flow_keyword(E)) {
- keywords[StringName(E)] = control_flow_keyword_color;
+ reserved_keywords[StringName(E)] = control_flow_keyword_color;
} else {
- keywords[StringName(E)] = keyword_color;
+ reserved_keywords[StringName(E)] = keyword_color;
}
}
diff --git a/modules/gdscript/editor/gdscript_highlighter.h b/modules/gdscript/editor/gdscript_highlighter.h
index 60b5b092d4..7c22eb30b1 100644
--- a/modules/gdscript/editor/gdscript_highlighter.h
+++ b/modules/gdscript/editor/gdscript_highlighter.h
@@ -47,7 +47,8 @@ private:
Vector<ColorRegion> color_regions;
HashMap<int, int> color_region_cache;
- HashMap<StringName, Color> keywords;
+ HashMap<StringName, Color> class_names;
+ HashMap<StringName, Color> reserved_keywords;
HashMap<StringName, Color> member_keywords;
HashSet<StringName> global_functions;
diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py
index 86ae1f2d9c..ac69f3806b 100644
--- a/platform/linuxbsd/detect.py
+++ b/platform/linuxbsd/detect.py
@@ -367,6 +367,7 @@ def configure(env: "Environment"):
# The default crash handler depends on glibc, so if the host uses
# a different libc (BSD libc, musl), fall back to libexecinfo.
print("Note: Using `execinfo=yes` for the crash handler as required on platforms where glibc is missing.")
+ env["execinfo"] = True
if env["execinfo"]:
env.Append(LIBS=["execinfo"])
diff --git a/platform/web/.eslintrc.html.js b/platform/web/.eslintrc.html.js
new file mode 100644
index 0000000000..5cb8de360a
--- /dev/null
+++ b/platform/web/.eslintrc.html.js
@@ -0,0 +1,19 @@
+module.exports = {
+ "plugins": [
+ "html",
+ "@html-eslint",
+ ],
+ "parser": "@html-eslint/parser",
+ "extends": ["plugin:@html-eslint/recommended", "./.eslintrc.js"],
+ "rules": {
+ "no-alert": "off",
+ "no-console": "off",
+ "@html-eslint/require-closing-tags": ["error", { "selfClosing": "never" }],
+ "@html-eslint/indent": ["error", "tab"],
+ },
+ "globals": {
+ "Godot": true,
+ "Engine": true,
+ "$GODOT_CONFIG": true,
+ },
+};
diff --git a/platform/web/export/export_plugin.cpp b/platform/web/export/export_plugin.cpp
index 1c327fe4b2..f59ac54f20 100644
--- a/platform/web/export/export_plugin.cpp
+++ b/platform/web/export/export_plugin.cpp
@@ -485,6 +485,7 @@ Error EditorExportPlatformWeb::export_project(const Ref<EditorExportPreset> &p_p
}
html.resize(f->get_length());
f->get_buffer(html.ptrw(), html.size());
+ f.unref(); // close file.
// Generate HTML file with replaced strings.
_fix_html(html, p_preset, base_name, p_debug, p_flags, shared_objects, file_sizes);
diff --git a/platform/web/package-lock.json b/platform/web/package-lock.json
index 9a7d871c64..4c12c8602d 100644
--- a/platform/web/package-lock.json
+++ b/platform/web/package-lock.json
@@ -8,8 +8,13 @@
"name": "godot",
"version": "1.0.0",
"license": "MIT",
+ "dependencies": {
+ "eslint-plugin-html": "^7.1.0"
+ },
"devDependencies": {
- "eslint": "^7.28.0",
+ "@html-eslint/eslint-plugin": "^0.15.0",
+ "@html-eslint/parser": "^0.15.0",
+ "eslint": "^7.32.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.23.4",
"jsdoc": "^3.6.7"
@@ -83,9 +88,9 @@
}
},
"node_modules/@eslint/eslintrc": {
- "version": "0.4.2",
- "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.2.tgz",
- "integrity": "sha512-8nmGq/4ycLpIwzvhI4tNDmQztZ8sp+hI7cyG8i1nQDhkAbRzHpXPidRAHlNvCZQpJTKw5ItIpMw9RSToGF00mg==",
+ "version": "0.4.3",
+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz",
+ "integrity": "sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==",
"dev": true,
"dependencies": {
"ajv": "^6.12.4",
@@ -102,6 +107,47 @@
"node": "^10.12.0 || >=12.0.0"
}
},
+ "node_modules/@html-eslint/eslint-plugin": {
+ "version": "0.15.0",
+ "resolved": "https://registry.npmjs.org/@html-eslint/eslint-plugin/-/eslint-plugin-0.15.0.tgz",
+ "integrity": "sha512-6DUb2ZN1PUlzlNzNj4aBhoObBp3Kl/+YbZ6CnkgFAsQSW0tSFAu7p8WwESkz9RZLZZN9gCUlcaYKJnQjTkmnDA==",
+ "dev": true,
+ "engines": {
+ "node": ">=8.10.0"
+ }
+ },
+ "node_modules/@html-eslint/parser": {
+ "version": "0.15.0",
+ "resolved": "https://registry.npmjs.org/@html-eslint/parser/-/parser-0.15.0.tgz",
+ "integrity": "sha512-fA+HQtWnODhOIK6j1p4XWqltINx7hM0WNNTM2RvlH/2glzeRDCcYq3vEmeQhnytvGocidu4ofTzNk80cLnnyiw==",
+ "dev": true,
+ "dependencies": {
+ "es-html-parser": "^0.0.8"
+ },
+ "engines": {
+ "node": ">=8.10.0"
+ }
+ },
+ "node_modules/@humanwhocodes/config-array": {
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz",
+ "integrity": "sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==",
+ "dev": true,
+ "dependencies": {
+ "@humanwhocodes/object-schema": "^1.2.0",
+ "debug": "^4.1.1",
+ "minimatch": "^3.0.4"
+ },
+ "engines": {
+ "node": ">=10.10.0"
+ }
+ },
+ "node_modules/@humanwhocodes/object-schema": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz",
+ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
+ "dev": true
+ },
"node_modules/@types/json5": {
"version": "0.0.29",
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
@@ -143,9 +189,9 @@
}
},
"node_modules/acorn-jsx": {
- "version": "5.3.1",
- "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz",
- "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==",
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
+ "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
"dev": true,
"peerDependencies": {
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
@@ -419,9 +465,9 @@
}
},
"node_modules/debug": {
- "version": "4.3.1",
- "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
- "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
+ "version": "4.3.4",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
+ "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"dev": true,
"dependencies": {
"ms": "2.1.2"
@@ -465,6 +511,68 @@
"node": ">=6.0.0"
}
},
+ "node_modules/dom-serializer": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz",
+ "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==",
+ "dependencies": {
+ "domelementtype": "^2.3.0",
+ "domhandler": "^5.0.2",
+ "entities": "^4.2.0"
+ },
+ "funding": {
+ "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1"
+ }
+ },
+ "node_modules/dom-serializer/node_modules/entities": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz",
+ "integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==",
+ "engines": {
+ "node": ">=0.12"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/entities?sponsor=1"
+ }
+ },
+ "node_modules/domelementtype": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz",
+ "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/fb55"
+ }
+ ]
+ },
+ "node_modules/domhandler": {
+ "version": "5.0.3",
+ "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz",
+ "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==",
+ "dependencies": {
+ "domelementtype": "^2.3.0"
+ },
+ "engines": {
+ "node": ">= 4"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/domhandler?sponsor=1"
+ }
+ },
+ "node_modules/domutils": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.0.1.tgz",
+ "integrity": "sha512-z08c1l761iKhDFtfXO04C7kTdPBLi41zwOZl00WS8b5eiaebNpY00HKbztwBq+e3vyqWNwWF3mP9YLUeqIrF+Q==",
+ "dependencies": {
+ "dom-serializer": "^2.0.0",
+ "domelementtype": "^2.3.0",
+ "domhandler": "^5.0.1"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/domutils?sponsor=1"
+ }
+ },
"node_modules/emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
@@ -531,6 +639,12 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/es-html-parser": {
+ "version": "0.0.8",
+ "resolved": "https://registry.npmjs.org/es-html-parser/-/es-html-parser-0.0.8.tgz",
+ "integrity": "sha512-kjMH23xhvTBw/7Ve1Dtb/7yZdFajfvwOpdsgRHmnyt8yvTsDJnkFjUgEEaMZFW+e1OhN/eoZrvF9wehq+waTGg==",
+ "dev": true
+ },
"node_modules/es-to-primitive": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz",
@@ -561,13 +675,14 @@
}
},
"node_modules/eslint": {
- "version": "7.28.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.28.0.tgz",
- "integrity": "sha512-UMfH0VSjP0G4p3EWirscJEQ/cHqnT/iuH6oNZOB94nBjWbMnhGEPxsZm1eyIW0C/9jLI0Fow4W5DXLjEI7mn1g==",
+ "version": "7.32.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz",
+ "integrity": "sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==",
"dev": true,
"dependencies": {
"@babel/code-frame": "7.12.11",
- "@eslint/eslintrc": "^0.4.2",
+ "@eslint/eslintrc": "^0.4.3",
+ "@humanwhocodes/config-array": "^0.5.0",
"ajv": "^6.10.0",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.2",
@@ -681,6 +796,14 @@
"ms": "^2.1.1"
}
},
+ "node_modules/eslint-plugin-html": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-html/-/eslint-plugin-html-7.1.0.tgz",
+ "integrity": "sha512-fNLRraV/e6j8e3XYOC9xgND4j+U7b1Rq+OygMlLcMg+wI/IpVbF+ubQa3R78EjKB9njT6TQOlcK5rFKBVVtdfg==",
+ "dependencies": {
+ "htmlparser2": "^8.0.1"
+ }
+ },
"node_modules/eslint-plugin-import": {
"version": "2.23.4",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.23.4.tgz",
@@ -1005,9 +1128,9 @@
}
},
"node_modules/globals": {
- "version": "13.9.0",
- "resolved": "https://registry.npmjs.org/globals/-/globals-13.9.0.tgz",
- "integrity": "sha512-74/FduwI/JaIrr1H8e71UbDE+5x7pIPs1C2rrwC52SszOo043CsWOZEMW7o2Y58xwm9b+0RBKDxY5n2sUpEFxA==",
+ "version": "13.17.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz",
+ "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==",
"dev": true,
"dependencies": {
"type-fest": "^0.20.2"
@@ -1073,6 +1196,35 @@
"integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==",
"dev": true
},
+ "node_modules/htmlparser2": {
+ "version": "8.0.1",
+ "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.1.tgz",
+ "integrity": "sha512-4lVbmc1diZC7GUJQtRQ5yBAeUCL1exyMwmForWkRLnwyzWBFxN633SALPMGYaWZvKe9j1pRZJpauvmxENSp/EA==",
+ "funding": [
+ "https://github.com/fb55/htmlparser2?sponsor=1",
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/fb55"
+ }
+ ],
+ "dependencies": {
+ "domelementtype": "^2.3.0",
+ "domhandler": "^5.0.2",
+ "domutils": "^3.0.1",
+ "entities": "^4.3.0"
+ }
+ },
+ "node_modules/htmlparser2/node_modules/entities": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz",
+ "integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==",
+ "engines": {
+ "node": ">=0.12"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/entities?sponsor=1"
+ }
+ },
"node_modules/ignore": {
"version": "4.0.6",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz",
@@ -2067,7 +2219,7 @@
"node_modules/sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
- "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
+ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==",
"dev": true
},
"node_modules/string-width": {
@@ -2406,9 +2558,9 @@
"dev": true
},
"@eslint/eslintrc": {
- "version": "0.4.2",
- "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.2.tgz",
- "integrity": "sha512-8nmGq/4ycLpIwzvhI4tNDmQztZ8sp+hI7cyG8i1nQDhkAbRzHpXPidRAHlNvCZQpJTKw5ItIpMw9RSToGF00mg==",
+ "version": "0.4.3",
+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz",
+ "integrity": "sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==",
"dev": true,
"requires": {
"ajv": "^6.12.4",
@@ -2422,6 +2574,38 @@
"strip-json-comments": "^3.1.1"
}
},
+ "@html-eslint/eslint-plugin": {
+ "version": "0.15.0",
+ "resolved": "https://registry.npmjs.org/@html-eslint/eslint-plugin/-/eslint-plugin-0.15.0.tgz",
+ "integrity": "sha512-6DUb2ZN1PUlzlNzNj4aBhoObBp3Kl/+YbZ6CnkgFAsQSW0tSFAu7p8WwESkz9RZLZZN9gCUlcaYKJnQjTkmnDA==",
+ "dev": true
+ },
+ "@html-eslint/parser": {
+ "version": "0.15.0",
+ "resolved": "https://registry.npmjs.org/@html-eslint/parser/-/parser-0.15.0.tgz",
+ "integrity": "sha512-fA+HQtWnODhOIK6j1p4XWqltINx7hM0WNNTM2RvlH/2glzeRDCcYq3vEmeQhnytvGocidu4ofTzNk80cLnnyiw==",
+ "dev": true,
+ "requires": {
+ "es-html-parser": "^0.0.8"
+ }
+ },
+ "@humanwhocodes/config-array": {
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz",
+ "integrity": "sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==",
+ "dev": true,
+ "requires": {
+ "@humanwhocodes/object-schema": "^1.2.0",
+ "debug": "^4.1.1",
+ "minimatch": "^3.0.4"
+ }
+ },
+ "@humanwhocodes/object-schema": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz",
+ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
+ "dev": true
+ },
"@types/json5": {
"version": "0.0.29",
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
@@ -2457,9 +2641,9 @@
"dev": true
},
"acorn-jsx": {
- "version": "5.3.1",
- "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz",
- "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==",
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
+ "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
"dev": true,
"requires": {}
},
@@ -2672,9 +2856,9 @@
}
},
"debug": {
- "version": "4.3.1",
- "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
- "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
+ "version": "4.3.4",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
+ "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"dev": true,
"requires": {
"ms": "2.1.2"
@@ -2704,6 +2888,46 @@
"esutils": "^2.0.2"
}
},
+ "dom-serializer": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz",
+ "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==",
+ "requires": {
+ "domelementtype": "^2.3.0",
+ "domhandler": "^5.0.2",
+ "entities": "^4.2.0"
+ },
+ "dependencies": {
+ "entities": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz",
+ "integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA=="
+ }
+ }
+ },
+ "domelementtype": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz",
+ "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw=="
+ },
+ "domhandler": {
+ "version": "5.0.3",
+ "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz",
+ "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==",
+ "requires": {
+ "domelementtype": "^2.3.0"
+ }
+ },
+ "domutils": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.0.1.tgz",
+ "integrity": "sha512-z08c1l761iKhDFtfXO04C7kTdPBLi41zwOZl00WS8b5eiaebNpY00HKbztwBq+e3vyqWNwWF3mP9YLUeqIrF+Q==",
+ "requires": {
+ "dom-serializer": "^2.0.0",
+ "domelementtype": "^2.3.0",
+ "domhandler": "^5.0.1"
+ }
+ },
"emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
@@ -2758,6 +2982,12 @@
"unbox-primitive": "^1.0.1"
}
},
+ "es-html-parser": {
+ "version": "0.0.8",
+ "resolved": "https://registry.npmjs.org/es-html-parser/-/es-html-parser-0.0.8.tgz",
+ "integrity": "sha512-kjMH23xhvTBw/7Ve1Dtb/7yZdFajfvwOpdsgRHmnyt8yvTsDJnkFjUgEEaMZFW+e1OhN/eoZrvF9wehq+waTGg==",
+ "dev": true
+ },
"es-to-primitive": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz",
@@ -2776,13 +3006,14 @@
"dev": true
},
"eslint": {
- "version": "7.28.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.28.0.tgz",
- "integrity": "sha512-UMfH0VSjP0G4p3EWirscJEQ/cHqnT/iuH6oNZOB94nBjWbMnhGEPxsZm1eyIW0C/9jLI0Fow4W5DXLjEI7mn1g==",
+ "version": "7.32.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz",
+ "integrity": "sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==",
"dev": true,
"requires": {
"@babel/code-frame": "7.12.11",
- "@eslint/eslintrc": "^0.4.2",
+ "@eslint/eslintrc": "^0.4.3",
+ "@humanwhocodes/config-array": "^0.5.0",
"ajv": "^6.10.0",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.2",
@@ -2881,6 +3112,14 @@
}
}
},
+ "eslint-plugin-html": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-html/-/eslint-plugin-html-7.1.0.tgz",
+ "integrity": "sha512-fNLRraV/e6j8e3XYOC9xgND4j+U7b1Rq+OygMlLcMg+wI/IpVbF+ubQa3R78EjKB9njT6TQOlcK5rFKBVVtdfg==",
+ "requires": {
+ "htmlparser2": "^8.0.1"
+ }
+ },
"eslint-plugin-import": {
"version": "2.23.4",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.23.4.tgz",
@@ -3139,9 +3378,9 @@
}
},
"globals": {
- "version": "13.9.0",
- "resolved": "https://registry.npmjs.org/globals/-/globals-13.9.0.tgz",
- "integrity": "sha512-74/FduwI/JaIrr1H8e71UbDE+5x7pIPs1C2rrwC52SszOo043CsWOZEMW7o2Y58xwm9b+0RBKDxY5n2sUpEFxA==",
+ "version": "13.17.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz",
+ "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==",
"dev": true,
"requires": {
"type-fest": "^0.20.2"
@@ -3186,6 +3425,24 @@
"integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==",
"dev": true
},
+ "htmlparser2": {
+ "version": "8.0.1",
+ "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.1.tgz",
+ "integrity": "sha512-4lVbmc1diZC7GUJQtRQ5yBAeUCL1exyMwmForWkRLnwyzWBFxN633SALPMGYaWZvKe9j1pRZJpauvmxENSp/EA==",
+ "requires": {
+ "domelementtype": "^2.3.0",
+ "domhandler": "^5.0.2",
+ "domutils": "^3.0.1",
+ "entities": "^4.3.0"
+ },
+ "dependencies": {
+ "entities": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz",
+ "integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA=="
+ }
+ }
+ },
"ignore": {
"version": "4.0.6",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz",
@@ -3936,7 +4193,7 @@
"sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
- "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
+ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==",
"dev": true
},
"string-width": {
diff --git a/platform/web/package.json b/platform/web/package.json
index 8d4983663b..e1dd7b1a22 100644
--- a/platform/web/package.json
+++ b/platform/web/package.json
@@ -5,23 +5,30 @@
"description": "Development and linting setup for Godot's Web platform code",
"scripts": {
"docs": "jsdoc --template js/jsdoc2rst/ js/engine/engine.js js/engine/config.js js/engine/features.js --destination ''",
- "lint": "npm run lint:engine && npm run lint:libs && npm run lint:modules && npm run lint:tools",
+ "lint": "npm run lint:engine && npm run lint:libs && npm run lint:modules && npm run lint:tools && npm run lint:html",
"lint:engine": "eslint \"js/engine/*.js\" --no-eslintrc -c .eslintrc.engine.js",
"lint:libs": "eslint \"js/libs/*.js\" --no-eslintrc -c .eslintrc.libs.js",
"lint:modules": "eslint \"../../modules/**/*.js\" --no-eslintrc -c .eslintrc.libs.js",
"lint:tools": "eslint \"js/jsdoc2rst/**/*.js\" --no-eslintrc -c .eslintrc.engine.js",
- "format": "npm run format:engine && npm run format:libs && npm run format:modules && npm run format:tools",
+ "lint:html": "eslint \"../../misc/dist/html/*.html\" --no-eslintrc -c .eslintrc.html.js",
+ "format": "npm run format:engine && npm run format:libs && npm run format:modules && npm run format:tools && npm run format:html",
"format:engine": "npm run lint:engine -- --fix",
"format:libs": "npm run lint:libs -- --fix",
"format:modules": "npm run lint:modules -- --fix",
- "format:tools": "npm run lint:tools -- --fix"
+ "format:tools": "npm run lint:tools -- --fix",
+ "format:html": "npm run lint:html -- --fix"
},
"author": "Godot Engine contributors",
"license": "MIT",
"devDependencies": {
- "eslint": "^7.28.0",
+ "@html-eslint/eslint-plugin": "^0.15.0",
+ "@html-eslint/parser": "^0.15.0",
+ "eslint": "^7.32.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.23.4",
"jsdoc": "^3.6.7"
+ },
+ "dependencies": {
+ "eslint-plugin-html": "^7.1.0"
}
}
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index aeaaaf3aec..aa7df4ea9c 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -155,11 +155,11 @@ Transform2D Camera2D::get_camera_transform() {
}
}
- if (smoothing_enabled && !Engine::get_singleton()->is_editor_hint()) {
- real_t c = smoothing * (process_callback == CAMERA2D_PROCESS_PHYSICS ? get_physics_process_delta_time() : get_process_delta_time());
+ if (follow_smoothing_enabled && !Engine::get_singleton()->is_editor_hint()) {
+ real_t c = position_smoothing_speed * (process_callback == CAMERA2D_PROCESS_PHYSICS ? get_physics_process_delta_time() : get_process_delta_time());
smoothed_camera_pos = ((camera_pos - smoothed_camera_pos) * c) + smoothed_camera_pos;
ret_camera_pos = smoothed_camera_pos;
- //camera_pos=camera_pos*(1.0-smoothing)+new_camera_pos*smoothing;
+ //camera_pos=camera_pos*(1.0-position_smoothing_speed)+new_camera_pos*position_smoothing_speed;
} else {
ret_camera_pos = smoothed_camera_pos = camera_pos;
}
@@ -183,7 +183,7 @@ Transform2D Camera2D::get_camera_transform() {
Rect2 screen_rect(-screen_offset + ret_camera_pos, screen_size * zoom_scale);
- if (!smoothing_enabled || !limit_smoothing_enabled) {
+ if (!follow_smoothing_enabled || !limit_smoothing_enabled) {
if (screen_rect.position.x < limit[SIDE_LEFT]) {
screen_rect.position.x = limit[SIDE_LEFT];
}
@@ -428,7 +428,7 @@ void Camera2D::set_current(bool p_current) {
void Camera2D::_update_process_internal_for_smoothing() {
bool is_not_in_scene_or_editor = !(is_inside_tree() && Engine::get_singleton()->is_editor_hint());
- bool is_any_smoothing_valid = smoothing > 0 || rotation_smoothing_speed > 0;
+ bool is_any_smoothing_valid = position_smoothing_speed > 0 || rotation_smoothing_speed > 0;
bool enabled = is_any_smoothing_valid && is_not_in_scene_or_editor;
set_process_internal(enabled);
@@ -525,13 +525,13 @@ void Camera2D::align() {
_update_scroll();
}
-void Camera2D::set_follow_smoothing(real_t p_speed) {
- smoothing = p_speed;
+void Camera2D::set_position_smoothing_speed(real_t p_speed) {
+ position_smoothing_speed = p_speed;
_update_process_internal_for_smoothing();
}
-real_t Camera2D::get_follow_smoothing() const {
- return smoothing;
+real_t Camera2D::get_position_smoothing_speed() const {
+ return position_smoothing_speed;
}
void Camera2D::set_rotation_smoothing_speed(real_t p_speed) {
@@ -607,18 +607,18 @@ real_t Camera2D::get_drag_horizontal_offset() const {
void Camera2D::_set_old_smoothing(real_t p_enable) {
//compatibility
if (p_enable > 0) {
- smoothing_enabled = true;
- set_follow_smoothing(p_enable);
+ follow_smoothing_enabled = true;
+ set_position_smoothing_speed(p_enable);
}
}
-void Camera2D::set_enable_follow_smoothing(bool p_enabled) {
- smoothing_enabled = p_enabled;
+void Camera2D::set_position_smoothing_enabled(bool p_enabled) {
+ follow_smoothing_enabled = p_enabled;
notify_property_list_changed();
}
-bool Camera2D::is_follow_smoothing_enabled() const {
- return smoothing_enabled;
+bool Camera2D::is_position_smoothing_enabled() const {
+ return follow_smoothing_enabled;
}
void Camera2D::set_custom_viewport(Node *p_viewport) {
@@ -689,7 +689,7 @@ bool Camera2D::is_margin_drawing_enabled() const {
}
void Camera2D::_validate_property(PropertyInfo &p_property) const {
- if (!smoothing_enabled && p_property.name == "smoothing_speed") {
+ if (!follow_smoothing_enabled && p_property.name == "smoothing_speed") {
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
}
if (!rotation_smoothing_enabled && p_property.name == "rotation_smoothing_speed") {
@@ -746,11 +746,11 @@ void Camera2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_custom_viewport", "viewport"), &Camera2D::set_custom_viewport);
ClassDB::bind_method(D_METHOD("get_custom_viewport"), &Camera2D::get_custom_viewport);
- ClassDB::bind_method(D_METHOD("set_follow_smoothing", "follow_smoothing"), &Camera2D::set_follow_smoothing);
- ClassDB::bind_method(D_METHOD("get_follow_smoothing"), &Camera2D::get_follow_smoothing);
+ ClassDB::bind_method(D_METHOD("set_position_smoothing_speed", "position_smoothing_speed"), &Camera2D::set_position_smoothing_speed);
+ ClassDB::bind_method(D_METHOD("get_position_smoothing_speed"), &Camera2D::get_position_smoothing_speed);
- ClassDB::bind_method(D_METHOD("set_enable_follow_smoothing", "follow_smoothing"), &Camera2D::set_enable_follow_smoothing);
- ClassDB::bind_method(D_METHOD("is_follow_smoothing_enabled"), &Camera2D::is_follow_smoothing_enabled);
+ ClassDB::bind_method(D_METHOD("set_position_smoothing_enabled", "position_smoothing_speed"), &Camera2D::set_position_smoothing_enabled);
+ ClassDB::bind_method(D_METHOD("is_position_smoothing_enabled"), &Camera2D::is_position_smoothing_enabled);
ClassDB::bind_method(D_METHOD("set_rotation_smoothing_enabled", "enabled"), &Camera2D::set_rotation_smoothing_enabled);
ClassDB::bind_method(D_METHOD("is_rotation_smoothing_enabled"), &Camera2D::is_rotation_smoothing_enabled);
@@ -788,9 +788,9 @@ void Camera2D::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::INT, "limit_bottom", PROPERTY_HINT_NONE, "suffix:px"), "set_limit", "get_limit", SIDE_BOTTOM);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "limit_smoothed"), "set_limit_smoothing_enabled", "is_limit_smoothing_enabled");
- ADD_GROUP("Smoothing", "smoothing_");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smoothing_enabled"), "set_enable_follow_smoothing", "is_follow_smoothing_enabled");
- ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "smoothing_speed", PROPERTY_HINT_NONE, "suffix:px/s"), "set_follow_smoothing", "get_follow_smoothing");
+ ADD_GROUP("Follow Smoothing", "follow_smoothing_");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "position_smoothing_enabled"), "set_position_smoothing_enabled", "is_position_smoothing_enabled");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "position_smoothing_speed", PROPERTY_HINT_NONE, "suffix:px/s"), "set_position_smoothing_speed", "get_position_smoothing_speed");
ADD_GROUP("Rotation Smoothing", "rotation_smoothing_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "rotation_smoothing_enabled"), "set_rotation_smoothing_enabled", "is_rotation_smoothing_enabled");
diff --git a/scene/2d/camera_2d.h b/scene/2d/camera_2d.h
index 1411175af2..ae172f47b1 100644
--- a/scene/2d/camera_2d.h
+++ b/scene/2d/camera_2d.h
@@ -65,8 +65,8 @@ protected:
AnchorMode anchor_mode = ANCHOR_MODE_DRAG_CENTER;
bool ignore_rotation = true;
bool current = false;
- real_t smoothing = 5.0;
- bool smoothing_enabled = false;
+ real_t position_smoothing_speed = 5.0;
+ bool follow_smoothing_enabled = false;
real_t camera_angle = 0.0;
real_t rotation_smoothing_speed = 5.0;
@@ -140,11 +140,11 @@ public:
void set_drag_vertical_offset(real_t p_offset);
real_t get_drag_vertical_offset() const;
- void set_enable_follow_smoothing(bool p_enabled);
- bool is_follow_smoothing_enabled() const;
+ void set_position_smoothing_enabled(bool p_enabled);
+ bool is_position_smoothing_enabled() const;
- void set_follow_smoothing(real_t p_speed);
- real_t get_follow_smoothing() const;
+ void set_position_smoothing_speed(real_t p_speed);
+ real_t get_position_smoothing_speed() const;
void set_rotation_smoothing_speed(real_t p_speed);
real_t get_rotation_smoothing_speed() const;