summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/classes/Camera3D.xml4
-rw-r--r--misc/dist/html/editor.html53
-rw-r--r--modules/gridmap/editor/grid_map_editor_plugin.cpp1
-rw-r--r--modules/navigation/navigation_mesh_generator.cpp2
-rw-r--r--scene/gui/control.cpp24
-rw-r--r--scene/gui/grid_container.cpp55
-rw-r--r--scene/resources/navigation_mesh.cpp4
7 files changed, 112 insertions, 31 deletions
diff --git a/doc/classes/Camera3D.xml b/doc/classes/Camera3D.xml
index 5008cd826e..56e5ce1522 100644
--- a/doc/classes/Camera3D.xml
+++ b/doc/classes/Camera3D.xml
@@ -88,14 +88,14 @@
<return type="Vector3" />
<argument index="0" name="screen_point" type="Vector2" />
<description>
- Returns a normal vector in world space, that is the result of projecting a point on the [Viewport] rectangle by the camera projection. This is useful for casting rays in the form of (origin, normal) for object intersection or picking.
+ Returns a normal vector in world space, that is the result of projecting a point on the [Viewport] rectangle by the inverse camera projection. This is useful for casting rays in the form of (origin, normal) for object intersection or picking.
</description>
</method>
<method name="project_ray_origin" qualifiers="const">
<return type="Vector3" />
<argument index="0" name="screen_point" type="Vector2" />
<description>
- Returns a 3D position in world space, that is the result of projecting a point on the [Viewport] rectangle by the camera projection. This is useful for casting rays in the form of (origin, normal) for object intersection or picking.
+ Returns a 3D position in world space, that is the result of projecting a point on the [Viewport] rectangle by the inverse camera projection. This is useful for casting rays in the form of (origin, normal) for object intersection or picking.
</description>
</method>
<method name="set_cull_mask_value">
diff --git a/misc/dist/html/editor.html b/misc/dist/html/editor.html
index 8d436038c1..7c44dd45a1 100644
--- a/misc/dist/html/editor.html
+++ b/misc/dist/html/editor.html
@@ -68,6 +68,11 @@
height: 100%;
overflow: auto;
background-color: hsla(0, 0%, 0%, 0.5);
+ text-align: left;
+ }
+
+ .welcome-modal-title {
+ text-align: center;
}
.welcome-modal-content {
@@ -238,7 +243,7 @@
onclick="if (event.target === this) closeWelcomeModal(false)"
>
<div class="welcome-modal-content">
- <h2 id="welcome-modal-title">Important - Please read before continuing</h2>
+ <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.
@@ -254,9 +259,38 @@
>Web editor documentation</a> for usage instructions and limitations.
</p>
</div>
- <button id="welcome-modal-dismiss" class="btn" type="button" onclick="closeWelcomeModal(true)" style="margin-top: 1rem">
- OK, don't show again
- </button>
+ <div id="welcome-modal-description-no-cross-origin-isolation" style="display: none">
+ <p>
+ The web server does not support cross-origin isolation,
+ which is required for the Godot Web Editor to function.
+ </p>
+ <p>
+ <strong>Reasons for cross-origin isolation being disabled:</strong>
+ <ul>
+ <li id="welcome-modal-reason-not-secure">
+ This page is not served from a secure context (HTTPS <i>or</i> localhost).
+ </li>
+ <li>
+ This page may not be served with cross-origin isolation headers
+ (check with the developer tools' Network tab).
+ </li>
+ </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#threads"
+ target="_blank"
+ rel="noopener"
+ >Exporting for the Web - Threads</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 id="tabs-buttons">
@@ -360,7 +394,16 @@
});
}
- if (localStorage.getItem("welcomeModalDismissed") !== 'true') {
+ if (!crossOriginIsolated) {
+ // 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-description-no-cross-origin-isolation").style.display = "block";
+ document.getElementById("welcome-modal-dismiss").style.display = "none";
+ document.getElementById("welcome-modal-reason-not-secure").style.display = window.isSecureContext ? "none" : "list-item";
+ }
+
+ if (!crossOriginIsolated || localStorage.getItem("welcomeModalDismissed") !== 'true') {
document.getElementById("welcome-modal").style.display = "block";
document.getElementById("welcome-modal-dismiss").focus();
}
diff --git a/modules/gridmap/editor/grid_map_editor_plugin.cpp b/modules/gridmap/editor/grid_map_editor_plugin.cpp
index 2f613768ee..4902adb827 100644
--- a/modules/gridmap/editor/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/editor/grid_map_editor_plugin.cpp
@@ -930,6 +930,7 @@ void GridMapEditor::edit(GridMap *p_gridmap) {
}
update_palette();
+ _update_cursor_instance();
set_process(true);
diff --git a/modules/navigation/navigation_mesh_generator.cpp b/modules/navigation/navigation_mesh_generator.cpp
index 110a4f5138..5cbaded6c1 100644
--- a/modules/navigation/navigation_mesh_generator.cpp
+++ b/modules/navigation/navigation_mesh_generator.cpp
@@ -445,7 +445,7 @@ void NavigationMeshGenerator::_build_recast_navigation_mesh(
cfg.minRegionArea = (int)(p_nav_mesh->get_region_min_size() * p_nav_mesh->get_region_min_size());
cfg.mergeRegionArea = (int)(p_nav_mesh->get_region_merge_size() * p_nav_mesh->get_region_merge_size());
cfg.maxVertsPerPoly = (int)p_nav_mesh->get_verts_per_poly();
- cfg.detailSampleDist = p_nav_mesh->get_detail_sample_distance() < 0.9f ? 0 : p_nav_mesh->get_cell_size() * p_nav_mesh->get_detail_sample_distance();
+ cfg.detailSampleDist = MAX(p_nav_mesh->get_cell_size() * p_nav_mesh->get_detail_sample_distance(), 0.1f);
cfg.detailSampleMaxError = p_nav_mesh->get_cell_height() * p_nav_mesh->get_detail_sample_max_error();
cfg.bmin[0] = bmin[0];
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 54fa726260..a0104387c9 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -712,35 +712,25 @@ void Control::_notification(int p_notification) {
data.parent_window = Object::cast_to<Window>(get_parent());
data.is_rtl_dirty = true;
- Node *parent = this; //meh
+ CanvasItem *node = this;
Control *parent_control = nullptr;
- bool subwindow = false;
-
- while (parent) {
- parent = parent->get_parent();
+ while (!node->is_set_as_top_level()) {
+ CanvasItem *parent = Object::cast_to<CanvasItem>(node->get_parent());
if (!parent) {
break;
}
- CanvasItem *ci = Object::cast_to<CanvasItem>(parent);
- if (ci && ci->is_set_as_top_level()) {
- subwindow = true;
- break;
- }
-
parent_control = Object::cast_to<Control>(parent);
-
if (parent_control) {
break;
- } else if (ci) {
- } else {
- break;
}
+
+ node = parent;
}
- if (parent_control && !subwindow) {
- //do nothing, has a parent control and not top_level
+ if (parent_control) {
+ // Do nothing, has a parent control.
if (data.theme.is_null() && parent_control->data.theme_owner) {
data.theme_owner = parent_control->data.theme_owner;
notification(NOTIFICATION_THEME_CHANGED);
diff --git a/scene/gui/grid_container.cpp b/scene/gui/grid_container.cpp
index b2cf2f66a9..ec33018da0 100644
--- a/scene/gui/grid_container.cpp
+++ b/scene/gui/grid_container.cpp
@@ -142,13 +142,47 @@ void GridContainer::_notification(int p_what) {
}
// Finally, fit the nodes.
- int col_expand = col_expanded.size() > 0 ? remaining_space.width / col_expanded.size() : 0;
- int row_expand = row_expanded.size() > 0 ? remaining_space.height / row_expanded.size() : 0;
+ int col_remaining_pixel = 0;
+ int col_expand = 0;
+ if (col_expanded.size() > 0) {
+ col_expand = remaining_space.width / col_expanded.size();
+ col_remaining_pixel = remaining_space.width - col_expanded.size() * col_expand;
+ }
+
+ int row_remaining_pixel = 0;
+ int row_expand = 0;
+ if (row_expanded.size() > 0) {
+ row_expand = remaining_space.height / row_expanded.size();
+ row_remaining_pixel = remaining_space.height - row_expanded.size() * row_expand;
+ }
+
bool rtl = is_layout_rtl();
int col_ofs = 0;
int row_ofs = 0;
+ // Calculate the index of rows and columns that receive the remaining pixel.
+ int col_remaining_pixel_index = 0;
+ for (int i = 0; i < max_col; i++) {
+ if (col_remaining_pixel == 0) {
+ break;
+ }
+ if (col_expanded.has(i)) {
+ col_remaining_pixel_index = i + 1;
+ col_remaining_pixel--;
+ }
+ }
+ int row_remaining_pixel_index = 0;
+ for (int i = 0; i < max_row; i++) {
+ if (row_remaining_pixel == 0) {
+ break;
+ }
+ if (row_expanded.has(i)) {
+ row_remaining_pixel_index = i + 1;
+ row_remaining_pixel--;
+ }
+ }
+
valid_controls_index = 0;
for (int i = 0; i < get_child_count(); i++) {
Control *c = Object::cast_to<Control>(get_child(i));
@@ -167,17 +201,30 @@ void GridContainer::_notification(int p_what) {
}
if (row > 0) {
row_ofs += (row_expanded.has(row - 1) ? row_expand : row_minh[row - 1]) + vsep;
+
+ if (row_expanded.has(row - 1) && row - 1 < row_remaining_pixel_index) {
+ // Apply the remaining pixel of the previous row.
+ row_ofs++;
+ }
}
}
+ Size2 s(col_expanded.has(col) ? col_expand : col_minw[col], row_expanded.has(row) ? row_expand : row_minh[row]);
+
+ // Add the remaining pixel to the expanding columns and rows, starting from left and top.
+ if (col_expanded.has(col) && col < col_remaining_pixel_index) {
+ s.x++;
+ }
+ if (row_expanded.has(row) && row < row_remaining_pixel_index) {
+ s.y++;
+ }
+
if (rtl) {
- Size2 s(col_expanded.has(col) ? col_expand : col_minw[col], row_expanded.has(row) ? row_expand : row_minh[row]);
Point2 p(col_ofs - s.width, row_ofs);
fit_child_in_rect(c, Rect2(p, s));
col_ofs -= s.width + hsep;
} else {
Point2 p(col_ofs, row_ofs);
- Size2 s(col_expanded.has(col) ? col_expand : col_minw[col], row_expanded.has(row) ? row_expand : row_minh[row]);
fit_child_in_rect(c, Rect2(p, s));
col_ofs += s.width + hsep;
}
diff --git a/scene/resources/navigation_mesh.cpp b/scene/resources/navigation_mesh.cpp
index b1270e9dd6..7813de94ca 100644
--- a/scene/resources/navigation_mesh.cpp
+++ b/scene/resources/navigation_mesh.cpp
@@ -229,7 +229,7 @@ float NavigationMesh::get_verts_per_poly() const {
}
void NavigationMesh::set_detail_sample_distance(float p_value) {
- ERR_FAIL_COND(p_value < 0);
+ ERR_FAIL_COND(p_value < 0.1);
detail_sample_distance = p_value;
}
@@ -501,7 +501,7 @@ void NavigationMesh::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "edge/max_length", PROPERTY_HINT_RANGE, "0.0,50.0,0.01,or_greater"), "set_edge_max_length", "get_edge_max_length");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "edge/max_error", PROPERTY_HINT_RANGE, "0.1,3.0,0.01,or_greater"), "set_edge_max_error", "get_edge_max_error");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "polygon/verts_per_poly", PROPERTY_HINT_RANGE, "3.0,12.0,1.0,or_greater"), "set_verts_per_poly", "get_verts_per_poly");
- ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "detail/sample_distance", PROPERTY_HINT_RANGE, "0.0,16.0,0.01,or_greater"), "set_detail_sample_distance", "get_detail_sample_distance");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "detail/sample_distance", PROPERTY_HINT_RANGE, "0.1,16.0,0.01,or_greater"), "set_detail_sample_distance", "get_detail_sample_distance");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "detail/sample_max_error", PROPERTY_HINT_RANGE, "0.0,16.0,0.01,or_greater"), "set_detail_sample_max_error", "get_detail_sample_max_error");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter/low_hanging_obstacles"), "set_filter_low_hanging_obstacles", "get_filter_low_hanging_obstacles");