Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Fix Curve point count expansion preserving points

kobewic2ef9d3d5bc7
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp
index aba9908659e..bc6532aef1f 100644
--- a/scene/resources/curve.cpp
+++ b/scene/resources/curve.cpp
@@ -53,8 +53,10 @@ void Curve::set_point_count(int p_count) {
_points.resize(p_count);
mark_dirty();
} else {
+ const real_t default_offset = old_size == 0 ? CLAMP((real_t)0.0, _min_domain, _max_domain) : _max_domain;
+ const real_t default_value = CLAMP((real_t)0.0, _min_value, _max_value);
for (int i = p_count - old_size; i > 0; i--) {
- _add_point(Vector2());
+ _add_point(Vector2(default_offset, default_value));
}
}
notify_property_list_changed();