diff options
Diffstat (limited to 'scene/resources/gradient.cpp')
-rw-r--r-- | scene/resources/gradient.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/scene/resources/gradient.cpp b/scene/resources/gradient.cpp index 2ccabe0b80..d271c906ff 100644 --- a/scene/resources/gradient.cpp +++ b/scene/resources/gradient.cpp @@ -103,8 +103,9 @@ void Gradient::set_offsets(const Vector<float> &p_offsets) { } void Gradient::set_colors(const Vector<Color> &p_colors) { - if (points.size() < p_colors.size()) + if (points.size() < p_colors.size()) { is_sorted = false; + } points.resize(p_colors.size()); for (int i = 0; i < points.size(); i++) { points.write[i].color = p_colors[i]; @@ -141,8 +142,9 @@ void Gradient::set_points(Vector<Gradient::Point> &p_points) { void Gradient::set_offset(int pos, const float offset) { ERR_FAIL_COND(pos < 0); - if (points.size() <= pos) + if (points.size() <= pos) { points.resize(pos + 1); + } points.write[pos].offset = offset; is_sorted = false; emit_signal(CoreStringNames::get_singleton()->changed); |