summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/navigation_agent_2d.cpp25
-rw-r--r--scene/2d/navigation_agent_2d.h10
-rw-r--r--scene/3d/collision_shape_3d.cpp2
-rw-r--r--scene/3d/navigation_agent_3d.cpp23
-rw-r--r--scene/3d/navigation_agent_3d.h12
-rw-r--r--scene/gui/graph_edit.cpp2
-rw-r--r--scene/gui/view_panner.cpp2
-rw-r--r--scene/main/window.cpp2
-rw-r--r--scene/resources/text_file.cpp5
-rw-r--r--scene/resources/visual_shader_nodes.cpp7
10 files changed, 55 insertions, 35 deletions
diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp
index 85f6840fde..6aa7779b09 100644
--- a/scene/2d/navigation_agent_2d.cpp
+++ b/scene/2d/navigation_agent_2d.cpp
@@ -108,7 +108,6 @@ void NavigationAgent2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "time_horizon", PROPERTY_HINT_RANGE, "0.1,10,0.01,suffix:s"), "set_time_horizon", "get_time_horizon");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "max_speed", PROPERTY_HINT_RANGE, "0.1,10000,0.01,suffix:px/s"), "set_max_speed", "get_max_speed");
-#ifdef DEBUG_ENABLED
ClassDB::bind_method(D_METHOD("set_debug_enabled", "enabled"), &NavigationAgent2D::set_debug_enabled);
ClassDB::bind_method(D_METHOD("get_debug_enabled"), &NavigationAgent2D::get_debug_enabled);
ClassDB::bind_method(D_METHOD("set_debug_use_custom", "enabled"), &NavigationAgent2D::set_debug_use_custom);
@@ -126,7 +125,6 @@ void NavigationAgent2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "debug_path_custom_color"), "set_debug_path_custom_color", "get_debug_path_custom_color");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "debug_path_custom_point_size", PROPERTY_HINT_RANGE, "1,50,1,suffix:px"), "set_debug_path_custom_point_size", "get_debug_path_custom_point_size");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "debug_path_custom_line_width", PROPERTY_HINT_RANGE, "1,50,1,suffix:px"), "set_debug_path_custom_line_width", "get_debug_path_custom_line_width");
-#endif // DEBUG_ENABLED
ADD_SIGNAL(MethodInfo("path_changed"));
ADD_SIGNAL(MethodInfo("target_reached"));
@@ -436,9 +434,8 @@ real_t NavigationAgent2D::get_path_max_distance() {
}
void NavigationAgent2D::set_target_position(Vector2 p_position) {
- if (target_position.is_equal_approx(p_position)) {
- return;
- }
+ // Intentionally not checking for equality of the parameter, as we want to update the path even if the target position is the same in case the world changed.
+ // Revisit later when the navigation server can update the path without requesting a new path.
target_position = p_position;
target_position_submitted = true;
@@ -491,9 +488,9 @@ Vector2 NavigationAgent2D::get_final_position() {
}
void NavigationAgent2D::set_velocity(Vector2 p_velocity) {
- if (target_velocity.is_equal_approx(p_velocity)) {
- return;
- }
+ // Intentionally not checking for equality of the parameter.
+ // We need to always submit the velocity to the navigation server, even when it is the same, in order to run avoidance every frame.
+ // Revisit later when the navigation server can update avoidance without users resubmitting the velocity.
target_velocity = p_velocity;
velocity_submitted = true;
@@ -670,14 +667,15 @@ void NavigationAgent2D::_check_distance_to_target() {
////////DEBUG////////////////////////////////////////////////////////////
-#ifdef DEBUG_ENABLED
void NavigationAgent2D::set_debug_enabled(bool p_enabled) {
+#ifdef DEBUG_ENABLED
if (debug_enabled == p_enabled) {
return;
}
debug_enabled = p_enabled;
debug_path_dirty = true;
+#endif // DEBUG_ENABLED
}
bool NavigationAgent2D::get_debug_enabled() const {
@@ -685,12 +683,14 @@ bool NavigationAgent2D::get_debug_enabled() const {
}
void NavigationAgent2D::set_debug_use_custom(bool p_enabled) {
+#ifdef DEBUG_ENABLED
if (debug_use_custom == p_enabled) {
return;
}
debug_use_custom = p_enabled;
debug_path_dirty = true;
+#endif // DEBUG_ENABLED
}
bool NavigationAgent2D::get_debug_use_custom() const {
@@ -698,12 +698,14 @@ bool NavigationAgent2D::get_debug_use_custom() const {
}
void NavigationAgent2D::set_debug_path_custom_color(Color p_color) {
+#ifdef DEBUG_ENABLED
if (debug_path_custom_color == p_color) {
return;
}
debug_path_custom_color = p_color;
debug_path_dirty = true;
+#endif // DEBUG_ENABLED
}
Color NavigationAgent2D::get_debug_path_custom_color() const {
@@ -711,12 +713,14 @@ Color NavigationAgent2D::get_debug_path_custom_color() const {
}
void NavigationAgent2D::set_debug_path_custom_point_size(float p_point_size) {
+#ifdef DEBUG_ENABLED
if (Math::is_equal_approx(debug_path_custom_point_size, p_point_size)) {
return;
}
debug_path_custom_point_size = MAX(0.1, p_point_size);
debug_path_dirty = true;
+#endif // DEBUG_ENABLED
}
float NavigationAgent2D::get_debug_path_custom_point_size() const {
@@ -724,18 +728,21 @@ float NavigationAgent2D::get_debug_path_custom_point_size() const {
}
void NavigationAgent2D::set_debug_path_custom_line_width(float p_line_width) {
+#ifdef DEBUG_ENABLED
if (Math::is_equal_approx(debug_path_custom_line_width, p_line_width)) {
return;
}
debug_path_custom_line_width = p_line_width;
debug_path_dirty = true;
+#endif // DEBUG_ENABLED
}
float NavigationAgent2D::get_debug_path_custom_line_width() const {
return debug_path_custom_line_width;
}
+#ifdef DEBUG_ENABLED
void NavigationAgent2D::_navigation_debug_changed() {
debug_path_dirty = true;
}
diff --git a/scene/2d/navigation_agent_2d.h b/scene/2d/navigation_agent_2d.h
index 5278c81f66..1614c70229 100644
--- a/scene/2d/navigation_agent_2d.h
+++ b/scene/2d/navigation_agent_2d.h
@@ -73,14 +73,16 @@ class NavigationAgent2D : public Node {
// No initialized on purpose
uint32_t update_frame_id = 0;
-#ifdef DEBUG_ENABLED
+ // Debug properties for exposed bindings
bool debug_enabled = false;
- bool debug_path_dirty = true;
- RID debug_path_instance;
float debug_path_custom_point_size = 4.0;
float debug_path_custom_line_width = 1.0;
bool debug_use_custom = false;
Color debug_path_custom_color = Color(1.0, 1.0, 1.0, 1.0);
+#ifdef DEBUG_ENABLED
+ // Debug properties internal only
+ bool debug_path_dirty = true;
+ RID debug_path_instance;
private:
void _navigation_debug_changed();
@@ -182,7 +184,6 @@ public:
PackedStringArray get_configuration_warnings() const override;
-#ifdef DEBUG_ENABLED
void set_debug_enabled(bool p_enabled);
bool get_debug_enabled() const;
@@ -197,7 +198,6 @@ public:
void set_debug_path_custom_line_width(float p_line_width);
float get_debug_path_custom_line_width() const;
-#endif // DEBUG_ENABLED
private:
void update_navigation();
diff --git a/scene/3d/collision_shape_3d.cpp b/scene/3d/collision_shape_3d.cpp
index dbd50cfd19..f1d918ad9b 100644
--- a/scene/3d/collision_shape_3d.cpp
+++ b/scene/3d/collision_shape_3d.cpp
@@ -124,7 +124,7 @@ PackedStringArray CollisionShape3D::get_configuration_warnings() const {
PackedStringArray warnings = Node::get_configuration_warnings();
if (!Object::cast_to<CollisionObject3D>(get_parent())) {
- warnings.push_back(RTR("CollisionShape3D only serves to provide a collision shape to a CollisionObject3D derived node. Please only use it as a child of Area3D, StaticBody3D, RigidBody3D, CharacterBody3D, etc. to give them a shape."));
+ warnings.push_back(RTR("CollisionShape3D only serves to provide a collision shape to a CollisionObject3D derived node.\nPlease only use it as a child of Area3D, StaticBody3D, RigidBody3D, CharacterBody3D, etc. to give them a shape."));
}
if (!shape.is_valid()) {
diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp
index 524304425c..081e7505d0 100644
--- a/scene/3d/navigation_agent_3d.cpp
+++ b/scene/3d/navigation_agent_3d.cpp
@@ -121,7 +121,6 @@ void NavigationAgent3D::_bind_methods() {
ADD_SIGNAL(MethodInfo("navigation_finished"));
ADD_SIGNAL(MethodInfo("velocity_computed", PropertyInfo(Variant::VECTOR3, "safe_velocity")));
-#ifdef DEBUG_ENABLED
ClassDB::bind_method(D_METHOD("set_debug_enabled", "enabled"), &NavigationAgent3D::set_debug_enabled);
ClassDB::bind_method(D_METHOD("get_debug_enabled"), &NavigationAgent3D::get_debug_enabled);
ClassDB::bind_method(D_METHOD("set_debug_use_custom", "enabled"), &NavigationAgent3D::set_debug_use_custom);
@@ -136,7 +135,6 @@ void NavigationAgent3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_use_custom"), "set_debug_use_custom", "get_debug_use_custom");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "debug_path_custom_color"), "set_debug_path_custom_color", "get_debug_path_custom_color");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "debug_path_custom_point_size", PROPERTY_HINT_RANGE, "1,50,1,suffix:px"), "set_debug_path_custom_point_size", "get_debug_path_custom_point_size");
-#endif // DEBUG_ENABLED
}
void NavigationAgent3D::_notification(int p_what) {
@@ -461,9 +459,8 @@ real_t NavigationAgent3D::get_path_max_distance() {
}
void NavigationAgent3D::set_target_position(Vector3 p_position) {
- if (target_position.is_equal_approx(p_position)) {
- return;
- }
+ // Intentionally not checking for equality of the parameter, as we want to update the path even if the target position is the same in case the world changed.
+ // Revisit later when the navigation server can update the path without requesting a new path.
target_position = p_position;
target_position_submitted = true;
@@ -516,9 +513,9 @@ Vector3 NavigationAgent3D::get_final_position() {
}
void NavigationAgent3D::set_velocity(Vector3 p_velocity) {
- if (target_velocity.is_equal_approx(p_velocity)) {
- return;
- }
+ // Intentionally not checking for equality of the parameter.
+ // We need to always submit the velocity to the navigation server, even when it is the same, in order to run avoidance every frame.
+ // Revisit later when the navigation server can update avoidance without users resubmitting the velocity.
target_velocity = p_velocity;
velocity_submitted = true;
@@ -696,14 +693,15 @@ void NavigationAgent3D::_check_distance_to_target() {
////////DEBUG////////////////////////////////////////////////////////////
-#ifdef DEBUG_ENABLED
void NavigationAgent3D::set_debug_enabled(bool p_enabled) {
+#ifdef DEBUG_ENABLED
if (debug_enabled == p_enabled) {
return;
}
debug_enabled = p_enabled;
debug_path_dirty = true;
+#endif // DEBUG_ENABLED
}
bool NavigationAgent3D::get_debug_enabled() const {
@@ -711,12 +709,14 @@ bool NavigationAgent3D::get_debug_enabled() const {
}
void NavigationAgent3D::set_debug_use_custom(bool p_enabled) {
+#ifdef DEBUG_ENABLED
if (debug_use_custom == p_enabled) {
return;
}
debug_use_custom = p_enabled;
debug_path_dirty = true;
+#endif // DEBUG_ENABLED
}
bool NavigationAgent3D::get_debug_use_custom() const {
@@ -724,12 +724,14 @@ bool NavigationAgent3D::get_debug_use_custom() const {
}
void NavigationAgent3D::set_debug_path_custom_color(Color p_color) {
+#ifdef DEBUG_ENABLED
if (debug_path_custom_color == p_color) {
return;
}
debug_path_custom_color = p_color;
debug_path_dirty = true;
+#endif // DEBUG_ENABLED
}
Color NavigationAgent3D::get_debug_path_custom_color() const {
@@ -737,18 +739,21 @@ Color NavigationAgent3D::get_debug_path_custom_color() const {
}
void NavigationAgent3D::set_debug_path_custom_point_size(float p_point_size) {
+#ifdef DEBUG_ENABLED
if (Math::is_equal_approx(debug_path_custom_point_size, p_point_size)) {
return;
}
debug_path_custom_point_size = p_point_size;
debug_path_dirty = true;
+#endif // DEBUG_ENABLED
}
float NavigationAgent3D::get_debug_path_custom_point_size() const {
return debug_path_custom_point_size;
}
+#ifdef DEBUG_ENABLED
void NavigationAgent3D::_navigation_debug_changed() {
debug_path_dirty = true;
}
diff --git a/scene/3d/navigation_agent_3d.h b/scene/3d/navigation_agent_3d.h
index 209b2a0989..072ca1d3e8 100644
--- a/scene/3d/navigation_agent_3d.h
+++ b/scene/3d/navigation_agent_3d.h
@@ -75,14 +75,16 @@ class NavigationAgent3D : public Node {
// No initialized on purpose
uint32_t update_frame_id = 0;
-#ifdef DEBUG_ENABLED
+ // Debug properties for exposed bindings
bool debug_enabled = false;
- bool debug_path_dirty = true;
- RID debug_path_instance;
- Ref<ArrayMesh> debug_path_mesh;
float debug_path_custom_point_size = 4.0;
bool debug_use_custom = false;
Color debug_path_custom_color = Color(1.0, 1.0, 1.0, 1.0);
+#ifdef DEBUG_ENABLED
+ // Debug properties internal only
+ bool debug_path_dirty = true;
+ RID debug_path_instance;
+ Ref<ArrayMesh> debug_path_mesh;
Ref<StandardMaterial3D> debug_agent_path_line_custom_material;
Ref<StandardMaterial3D> debug_agent_path_point_custom_material;
@@ -196,7 +198,6 @@ public:
PackedStringArray get_configuration_warnings() const override;
-#ifdef DEBUG_ENABLED
void set_debug_enabled(bool p_enabled);
bool get_debug_enabled() const;
@@ -208,7 +209,6 @@ public:
void set_debug_path_custom_point_size(float p_point_size);
float get_debug_path_custom_point_size() const;
-#endif // DEBUG_ENABLED
private:
void update_navigation();
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index fe2eed6755..a6a2fb8d7c 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -193,7 +193,7 @@ void GraphEditMinimap::_adjust_graph_scroll(const Vector2 &p_offset) {
PackedStringArray GraphEdit::get_configuration_warnings() const {
PackedStringArray warnings = Control::get_configuration_warnings();
- warnings.push_back(RTR("Please be aware that GraphEdit and GraphNode will undergo extensive refactoring in a future beta version involving compatibility-breaking API changes."));
+ warnings.push_back(RTR("Please be aware that GraphEdit and GraphNode will undergo extensive refactoring in a future 4.x version involving compatibility-breaking API changes."));
return warnings;
}
diff --git a/scene/gui/view_panner.cpp b/scene/gui/view_panner.cpp
index 145497fa61..51af886709 100644
--- a/scene/gui/view_panner.cpp
+++ b/scene/gui/view_panner.cpp
@@ -125,7 +125,7 @@ bool ViewPanner::gui_input(const Ref<InputEvent> &p_event, Rect2 p_canvas_rect)
Ref<InputEventPanGesture> pan_gesture = p_event;
if (pan_gesture.is_valid()) {
- callback_helper(pan_callback, varray(-pan_gesture->get_delta(), p_event));
+ callback_helper(pan_callback, varray(-pan_gesture->get_delta() * scroll_speed, p_event));
}
Ref<InputEventScreenDrag> screen_drag = p_event;
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index 44df648552..771e074d48 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -1462,7 +1462,7 @@ void Window::popup_centered(const Size2i &p_minsize) {
}
Rect2i popup_rect;
- popup_rect.size = _clamp_window_size(p_minsize);
+ popup_rect.size = _clamp_window_size(get_size().max(p_minsize));
if (parent_rect != Rect2()) {
popup_rect.position = parent_rect.position + (parent_rect.size - popup_rect.size) / 2;
diff --git a/scene/resources/text_file.cpp b/scene/resources/text_file.cpp
index 9b61a95edb..77ff0f55b1 100644
--- a/scene/resources/text_file.cpp
+++ b/scene/resources/text_file.cpp
@@ -67,5 +67,10 @@ Error TextFile::load_text(const String &p_path) {
ERR_FAIL_COND_V_MSG(s.parse_utf8((const char *)w) != OK, ERR_INVALID_DATA, "Script '" + p_path + "' contains invalid unicode (UTF-8), so it was not loaded. Please ensure that scripts are saved in valid UTF-8 unicode.");
text = s;
path = p_path;
+#ifdef TOOLS_ENABLED
+ if (ResourceLoader::get_timestamp_on_load()) {
+ set_last_modified_time(FileAccess::get_modified_time(path));
+ }
+#endif // TOOLS_ENABLED
return OK;
}
diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp
index 0695492e7f..7550f598f8 100644
--- a/scene/resources/visual_shader_nodes.cpp
+++ b/scene/resources/visual_shader_nodes.cpp
@@ -3349,10 +3349,10 @@ String VisualShaderNodeUVFunc::generate_code(Shader::Mode p_mode, VisualShader::
switch (func) {
case FUNC_PANNING: {
- code += vformat(" %s = fma(%s, %s, %s);\n", p_output_vars[0], offset_pivot, scale, uv);
+ code += vformat(" %s = %s * %s + %s;\n", p_output_vars[0], offset_pivot, scale, uv);
} break;
case FUNC_SCALING: {
- code += vformat(" %s = fma((%s - %s), %s, %s);\n", p_output_vars[0], uv, offset_pivot, scale, offset_pivot);
+ code += vformat(" %s = (%s - %s) * %s + %s;\n", p_output_vars[0], uv, offset_pivot, scale, offset_pivot);
} break;
default:
break;
@@ -7482,6 +7482,9 @@ String VisualShaderNodeMultiplyAdd::get_output_port_name(int p_port) const {
}
String VisualShaderNodeMultiplyAdd::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
+ if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") {
+ return " " + p_output_vars[0] + " = (" + p_input_vars[0] + " * " + p_input_vars[1] + ") + " + p_input_vars[2] + ";\n";
+ }
return " " + p_output_vars[0] + " = fma(" + p_input_vars[0] + ", " + p_input_vars[1] + ", " + p_input_vars[2] + ");\n";
}