summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/egl/egl_manager.cpp19
-rw-r--r--editor/filesystem_dock.cpp4
-rw-r--r--editor/plugins/skeleton_3d_editor_plugin.cpp4
-rw-r--r--editor/scene_tree_dock.cpp5
-rw-r--r--scene/3d/reflection_probe.cpp5
-rw-r--r--scene/gui/base_button.cpp2
-rw-r--r--scene/gui/menu_bar.cpp5
-rw-r--r--scene/gui/popup_menu.cpp1
-rw-r--r--scene/gui/tab_container.cpp13
-rw-r--r--scene/gui/tab_container.h1
-rw-r--r--scene/gui/text_edit.cpp8
-rw-r--r--scene/resources/particle_process_material.cpp20
12 files changed, 61 insertions, 26 deletions
diff --git a/drivers/egl/egl_manager.cpp b/drivers/egl/egl_manager.cpp
index 0faae8cf6f..4c9d610935 100644
--- a/drivers/egl/egl_manager.cpp
+++ b/drivers/egl/egl_manager.cpp
@@ -52,9 +52,13 @@ int EGLManager::_get_gldisplay_id(void *p_display) {
GLDisplay new_gldisplay;
new_gldisplay.display = p_display;
- Vector<EGLAttrib> attribs = _get_platform_display_attributes();
-
- new_gldisplay.egl_display = eglGetPlatformDisplay(_get_platform_extension_enum(), new_gldisplay.display, (attribs.size() > 0) ? attribs.ptr() : nullptr);
+ if (GLAD_EGL_VERSION_1_5) {
+ Vector<EGLAttrib> attribs = _get_platform_display_attributes();
+ new_gldisplay.egl_display = eglGetPlatformDisplay(_get_platform_extension_enum(), new_gldisplay.display, (attribs.size() > 0) ? attribs.ptr() : nullptr);
+ } else {
+ NativeDisplayType *native_display_type = (NativeDisplayType *)new_gldisplay.display;
+ new_gldisplay.egl_display = eglGetDisplay(*native_display_type);
+ }
ERR_FAIL_COND_V(eglGetError() != EGL_SUCCESS, -1);
ERR_FAIL_COND_V_MSG(new_gldisplay.egl_display == EGL_NO_DISPLAY, -1, "Can't create an EGL display.");
@@ -198,7 +202,12 @@ Error EGLManager::window_create(DisplayServer::WindowID p_window_id, void *p_dis
GLWindow &glwindow = windows[p_window_id];
glwindow.gldisplay_id = gldisplay_id;
- glwindow.egl_surface = eglCreatePlatformWindowSurface(gldisplay.egl_display, gldisplay.egl_config, p_native_window, nullptr);
+ if (GLAD_EGL_VERSION_1_5) {
+ glwindow.egl_surface = eglCreatePlatformWindowSurface(gldisplay.egl_display, gldisplay.egl_config, p_native_window, nullptr);
+ } else {
+ EGLNativeWindowType *native_window_type = (EGLNativeWindowType *)p_native_window;
+ glwindow.egl_surface = eglCreateWindowSurface(gldisplay.egl_display, gldisplay.egl_config, *native_window_type, nullptr);
+ }
if (glwindow.egl_surface == EGL_NO_SURFACE) {
return ERR_CANT_CREATE;
@@ -345,7 +354,7 @@ Error EGLManager::initialize() {
ERR_FAIL_COND_V_MSG(!version, ERR_UNAVAILABLE, "Can't load EGL.");
print_verbose(vformat("Loaded EGL %d.%d", GLAD_VERSION_MAJOR(version), GLAD_VERSION_MINOR(version)));
- ERR_FAIL_COND_V_MSG(!GLAD_EGL_VERSION_1_5, ERR_UNAVAILABLE, "EGL version is too old!");
+ ERR_FAIL_COND_V_MSG(!GLAD_EGL_VERSION_1_4, ERR_UNAVAILABLE, "EGL version is too old!");
eglTerminate(tmp_display);
#endif
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index a491a9b214..afefd38b20 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -1554,7 +1554,9 @@ void FileSystemDock::_try_duplicate_item(const FileOrFolder &p_item, const Strin
void FileSystemDock::_update_resource_paths_after_move(const HashMap<String, String> &p_renames, const HashMap<String, ResourceUID::ID> &p_uids) const {
// Update the paths in ResourceUID, so that UIDs remain valid.
for (const KeyValue<String, ResourceUID::ID> &pair : p_uids) {
- ResourceUID::get_singleton()->set_id(pair.value, p_renames[pair.key]);
+ if (p_renames.has(pair.key)) {
+ ResourceUID::get_singleton()->set_id(pair.value, p_renames[pair.key]);
+ }
}
// Rename all resources loaded, be it subresources or actual resources.
diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp
index 20b91d8bfd..eeefd1c90d 100644
--- a/editor/plugins/skeleton_3d_editor_plugin.cpp
+++ b/editor/plugins/skeleton_3d_editor_plugin.cpp
@@ -871,7 +871,9 @@ void Skeleton3DEditor::_notification(int p_what) {
skeleton->disconnect("pose_updated", callable_mp(this, &Skeleton3DEditor::_update_properties));
skeleton->set_transform_gizmo_visible(true);
#endif
- handles_mesh_instance->get_parent()->remove_child(handles_mesh_instance);
+ if (handles_mesh_instance->get_parent()) {
+ handles_mesh_instance->get_parent()->remove_child(handles_mesh_instance);
+ }
}
edit_mode_toggled(false);
} break;
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 7968fdef55..9722f656f7 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -2167,8 +2167,13 @@ void SceneTreeDock::_script_created(Ref<Script> p_script) {
}
undo_redo->commit_action();
+ // Avoid changing the currently edited object.
+ Object *edited_object = InspectorDock::get_inspector_singleton()->get_edited_object();
+
_push_item(p_script.ptr());
_update_script_button();
+
+ InspectorDock::get_inspector_singleton()->edit(edited_object);
}
void SceneTreeDock::_shader_created(Ref<Shader> p_shader) {
diff --git a/scene/3d/reflection_probe.cpp b/scene/3d/reflection_probe.cpp
index e533f08861..2e34f6aad0 100644
--- a/scene/3d/reflection_probe.cpp
+++ b/scene/3d/reflection_probe.cpp
@@ -68,8 +68,9 @@ Color ReflectionProbe::get_ambient_color() const {
}
void ReflectionProbe::set_max_distance(float p_distance) {
- max_distance = p_distance;
- RS::get_singleton()->reflection_probe_set_max_distance(probe, p_distance);
+ max_distance = CLAMP(p_distance, 0.0, 262'144.0);
+ // Reflection rendering breaks if distance exceeds 262,144 units (due to floating-point precision with the near plane being 0.01).
+ RS::get_singleton()->reflection_probe_set_max_distance(probe, max_distance);
}
float ReflectionProbe::get_max_distance() const {
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index f57afb66b3..66b14dc967 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -380,7 +380,7 @@ void BaseButton::shortcut_input(const Ref<InputEvent> &p_event) {
queue_redraw();
accept_event();
- if (shortcut_feedback) {
+ if (shortcut_feedback && is_inside_tree()) {
if (shortcut_feedback_timer == nullptr) {
shortcut_feedback_timer = memnew(Timer);
shortcut_feedback_timer->set_one_shot(true);
diff --git a/scene/gui/menu_bar.cpp b/scene/gui/menu_bar.cpp
index 371d6c69af..7418ba7333 100644
--- a/scene/gui/menu_bar.cpp
+++ b/scene/gui/menu_bar.cpp
@@ -561,6 +561,7 @@ void MenuBar::add_child_notify(Node *p_child) {
int index = DisplayServer::get_singleton()->global_menu_add_submenu_item("_main", atr(menu.name), submenu_name, _find_global_start_index() + menu_cache.size() - 1);
DisplayServer::get_singleton()->global_menu_set_item_tag("_main", index, global_menu_name + "#" + itos(menu_cache.size() - 1));
}
+ update_minimum_size();
}
void MenuBar::move_child_notify(Node *p_child) {
@@ -621,6 +622,8 @@ void MenuBar::remove_child_notify(Node *p_child) {
p_child->disconnect("renamed", callable_mp(this, &MenuBar::_refresh_menu_names));
p_child->disconnect("about_to_popup", callable_mp(this, &MenuBar::_popup_visibility_changed));
p_child->disconnect("popup_hide", callable_mp(this, &MenuBar::_popup_visibility_changed));
+
+ update_minimum_size();
}
void MenuBar::_bind_methods() {
@@ -808,6 +811,7 @@ void MenuBar::set_menu_title(int p_menu, const String &p_title) {
if (!global_menu_name.is_empty()) {
DisplayServer::get_singleton()->global_menu_set_item_text("_main", _find_global_start_index() + p_menu, atr(menu_cache[p_menu].name));
}
+ update_minimum_size();
}
String MenuBar::get_menu_title(int p_menu) const {
@@ -849,6 +853,7 @@ void MenuBar::set_menu_hidden(int p_menu, bool p_hidden) {
if (!global_menu_name.is_empty()) {
DisplayServer::get_singleton()->global_menu_set_item_hidden("_main", _find_global_start_index() + p_menu, p_hidden);
}
+ update_minimum_size();
}
bool MenuBar::is_menu_hidden(int p_menu) const {
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index dfaf7d88b7..ec9e2cacb4 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -2186,6 +2186,7 @@ void PopupMenu::scroll_to_item(int p_idx) {
}
bool PopupMenu::activate_item_by_event(const Ref<InputEvent> &p_event, bool p_for_global_only) {
+ ERR_FAIL_COND_V(p_event.is_null(), false);
Key code = Key::NONE;
Ref<InputEventKey> k = p_event;
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index c21a9d14cb..7d85468799 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -330,14 +330,23 @@ Vector<Control *> TabContainer::_get_tab_controls() const {
}
Variant TabContainer::_get_drag_data_fw(const Point2 &p_point, Control *p_from_control) {
+ if (!drag_to_rearrange_enabled) {
+ return Variant();
+ }
return tab_bar->_handle_get_drag_data("tab_container_tab", p_point);
}
bool TabContainer::_can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from_control) const {
+ if (!drag_to_rearrange_enabled) {
+ return false;
+ }
return tab_bar->_handle_can_drop_data("tab_container_tab", p_point, p_data);
}
void TabContainer::_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from_control) {
+ if (!drag_to_rearrange_enabled) {
+ return;
+ }
return tab_bar->_handle_drop_data("tab_container_tab", p_point, p_data, callable_mp(this, &TabContainer::_drag_move_tab), callable_mp(this, &TabContainer::_drag_move_tab_from));
}
@@ -815,11 +824,11 @@ Popup *TabContainer::get_popup() const {
}
void TabContainer::set_drag_to_rearrange_enabled(bool p_enabled) {
- tab_bar->set_drag_to_rearrange_enabled(p_enabled);
+ drag_to_rearrange_enabled = p_enabled;
}
bool TabContainer::get_drag_to_rearrange_enabled() const {
- return tab_bar->get_drag_to_rearrange_enabled();
+ return drag_to_rearrange_enabled;
}
void TabContainer::set_tabs_rearrange_group(int p_group_id) {
diff --git a/scene/gui/tab_container.h b/scene/gui/tab_container.h
index 5750c6b82e..b249576e28 100644
--- a/scene/gui/tab_container.h
+++ b/scene/gui/tab_container.h
@@ -46,6 +46,7 @@ class TabContainer : public Container {
bool use_hidden_tabs_for_min_size = false;
bool theme_changing = false;
Vector<Control *> children_removing;
+ bool drag_to_rearrange_enabled = false;
struct ThemeCache {
int side_margin = 0;
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 479480011c..86e726d9da 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -2948,6 +2948,8 @@ void TextEdit::_update_placeholder() {
return; // Not in tree?
}
+ const String placeholder_translated = atr(placeholder_text);
+
// Placeholder is generally smaller then text documents, and updates less so this should be fast enough for now.
placeholder_data_buf->clear();
placeholder_data_buf->set_width(text.get_width());
@@ -2958,9 +2960,9 @@ void TextEdit::_update_placeholder() {
placeholder_data_buf->set_direction((TextServer::Direction)text_direction);
}
placeholder_data_buf->set_preserve_control(draw_control_chars);
- placeholder_data_buf->add_string(placeholder_text, theme_cache.font, theme_cache.font_size, language);
+ placeholder_data_buf->add_string(placeholder_translated, theme_cache.font, theme_cache.font_size, language);
- placeholder_bidi_override = structured_text_parser(st_parser, st_args, placeholder_text);
+ placeholder_bidi_override = structured_text_parser(st_parser, st_args, placeholder_translated);
if (placeholder_bidi_override.is_empty()) {
TS->shaped_text_set_bidi_override(placeholder_data_buf->get_rid(), placeholder_bidi_override);
}
@@ -2985,7 +2987,7 @@ void TextEdit::_update_placeholder() {
placeholder_wraped_rows.clear();
for (int i = 0; i <= wrap_amount; i++) {
Vector2i line_range = placeholder_data_buf->get_line_range(i);
- placeholder_wraped_rows.push_back(placeholder_text.substr(line_range.x, line_range.y - line_range.x));
+ placeholder_wraped_rows.push_back(placeholder_translated.substr(line_range.x, line_range.y - line_range.x));
}
}
diff --git a/scene/resources/particle_process_material.cpp b/scene/resources/particle_process_material.cpp
index 9ceddbc7b1..6075db4ffb 100644
--- a/scene/resources/particle_process_material.cpp
+++ b/scene/resources/particle_process_material.cpp
@@ -985,10 +985,6 @@ void ParticleProcessMaterial::_update_shader() {
code += " VELOCITY = mix(VELOCITY,vec3(0.0),clamp(collision_friction, 0.0, 1.0));\n";
code += " } else {\n";
code += " VELOCITY = vec3(0.0);\n";
- // If turbulence is enabled, set the noise direction to up so the turbulence color is "neutral"
- if (turbulence_enabled) {
- code += " noise_direction = vec3(1.0, 0.0, 0.0);\n";
- }
code += " }\n";
code += " }\n";
} else if (collision_mode == COLLISION_HIDE_ON_CONTACT) {
@@ -1007,14 +1003,16 @@ void ParticleProcessMaterial::_update_shader() {
}
code += " \n";
code += " vec3 noise_direction = get_noise_direction(TRANSFORM[3].xyz);\n";
- // The following snippet causes massive performance hit. We don't need it as long as collision is disabled.
- // Refer to GH-83744 for more info.
- if (collision_mode != COLLISION_DISABLED) {
+
+ // Godot detects when the COLLIDED keyword is used. If it's used anywhere in the shader then Godot will generate the screen space SDF for collisions.
+ // We don't need it as long as collision is disabled. Refer to GH-83744 for more info.
+ if (collision_mode == COLLISION_RIGID) {
code += " if (!COLLIDED) {\n";
- code += " \n";
- code += " float vel_mag = length(final_velocity);\n";
- code += " float vel_infl = clamp(dynamic_params.turb_influence * turbulence_influence, 0.0,1.0);\n";
- code += " final_velocity = mix(final_velocity, normalize(noise_direction) * vel_mag * (1.0 + (1.0 - vel_infl) * 0.2), vel_infl);\n";
+ }
+ code += " float vel_mag = length(final_velocity);\n";
+ code += " float vel_infl = clamp(dynamic_params.turb_influence * turbulence_influence, 0.0,1.0);\n";
+ code += " final_velocity = mix(final_velocity, normalize(noise_direction) * vel_mag * (1.0 + (1.0 - vel_infl) * 0.2), vel_infl);\n";
+ if (collision_mode == COLLISION_RIGID) {
code += " }\n";
}
}