Merge pull request #62494 from TechnoPorg/gradient-fix-precision

This commit is contained in:
Rémi Verschelde 2022-06-28 21:57:39 +02:00 committed by GitHub
commit 0cd049e411
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -382,7 +382,7 @@ void GradientEdit::_color_changed(const Color &p_color) {
emit_signal(SNAME("ramp_changed"));
}
void GradientEdit::set_ramp(const Vector<real_t> &p_offsets, const Vector<Color> &p_colors) {
void GradientEdit::set_ramp(const Vector<float> &p_offsets, const Vector<Color> &p_colors) {
ERR_FAIL_COND(p_offsets.size() != p_colors.size());
points.clear();
for (int i = 0; i < p_offsets.size(); i++) {
@ -396,8 +396,8 @@ void GradientEdit::set_ramp(const Vector<real_t> &p_offsets, const Vector<Color>
update();
}
Vector<real_t> GradientEdit::get_offsets() const {
Vector<real_t> ret;
Vector<float> GradientEdit::get_offsets() const {
Vector<float> ret;
for (int i = 0; i < points.size(); i++) {
ret.push_back(points[i].offset);
}

View file

@ -67,8 +67,8 @@ protected:
static void _bind_methods();
public:
void set_ramp(const Vector<real_t> &p_offsets, const Vector<Color> &p_colors);
Vector<real_t> get_offsets() const;
void set_ramp(const Vector<float> &p_offsets, const Vector<Color> &p_colors);
Vector<float> get_offsets() const;
Vector<Color> get_colors() const;
void set_points(Vector<Gradient::Point> &p_points);
Vector<Gradient::Point> &get_points();