Added virtual method binding for get_gradient_color in GradientBase.

This commit is contained in:
Relintai 2022-06-15 14:34:51 +02:00
parent d320f3862f
commit 275d0604f8
2 changed files with 7 additions and 0 deletions

View File

@ -20,6 +20,10 @@ void GradientBase::set_points(const PoolRealArray &val) {
}
Color GradientBase::get_gradient_color(const float x) {
return call("_get_gradient_color", x);
}
Color GradientBase::_get_gradient_color(const float x) {
// if interpolation_type == 0:;
// return Gradients.gradient_type_1(x, points);
// elif interpolation_type == 1:;
@ -78,7 +82,9 @@ void GradientBase::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_points", "value"), &GradientBase::set_points);
ADD_PROPERTY(PropertyInfo(Variant::POOL_REAL_ARRAY, "points"), "set_points", "get_points");
BIND_VMETHOD(MethodInfo(Variant::COLOR, "_get_gradient_color", PropertyInfo(Variant::REAL, "x")));
ClassDB::bind_method(D_METHOD("get_gradient_color", "x"), &GradientBase::get_gradient_color);
ClassDB::bind_method(D_METHOD("_get_gradient_color", "x"), &GradientBase::_get_gradient_color);
ClassDB::bind_method(D_METHOD("get_point_value", "index"), &GradientBase::get_point_value);
ClassDB::bind_method(D_METHOD("get_point_color", "index"), &GradientBase::get_point_color);

View File

@ -17,6 +17,7 @@ public:
void set_points(const PoolRealArray &val);
Color get_gradient_color(const float x);
virtual Color _get_gradient_color(const float x);
float get_point_value(const int index);
Color get_point_color(const int index);