diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2022-07-24 18:47:57 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2022-08-30 22:08:38 +0200 |
commit | ae18928748047413db4d405a5d79a4bbfca05aca (patch) | |
tree | e846230db73e02f529b7d55da741dbad21c7f307 /editor | |
parent | de5f13e9356c1c075ced91893a67164f062b36bc (diff) |
Rename Curve/Curve2D/Curve3D/Gradient `interpolate()` to `sample()`
"sampling" is a more accurate term than "interpolating" for what's
happening when using that function.
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/curve_editor_plugin.cpp | 6 | ||||
-rw-r--r-- | editor/project_converter_3_to_4.cpp | 1 |
2 files changed, 4 insertions, 3 deletions
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index 9a31263f9a..0e84381279 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -579,7 +579,7 @@ template <typename T> static void plot_curve_accurate(const Curve &curve, float step, T plot_func) { if (curve.get_point_count() <= 1) { // Not enough points to make a curve, so it's just a straight line - float y = curve.interpolate(0); + float y = curve.sample(0); plot_func(Vector2(0, y), Vector2(1.f, y), true); } else { @@ -603,7 +603,7 @@ static void plot_curve_accurate(const Curve &curve, float step, T plot_func) { for (float x = step; x < len; x += step) { pos.x = a.x + x; - pos.y = curve.interpolate_local_nocheck(i - 1, x); + pos.y = curve.sample_local_nocheck(i - 1, x); plot_func(prev_pos, pos, true); prev_pos = pos; } @@ -817,7 +817,7 @@ Ref<Texture2D> CurvePreviewGenerator::generate(const Ref<Resource> &p_from, cons int prev_y = 0; for (int x = 0; x < im.get_width(); ++x) { float t = static_cast<float>(x) / im.get_width(); - float v = (curve.interpolate_baked(t) - curve.get_min_value()) / range_y; + float v = (curve.sample_baked(t) - curve.get_min_value()) / range_y; int y = CLAMP(im.get_height() - v * im.get_height(), 0, im.get_height()); // Plot point diff --git a/editor/project_converter_3_to_4.cpp b/editor/project_converter_3_to_4.cpp index 83275a2a7b..6e24004f0e 100644 --- a/editor/project_converter_3_to_4.cpp +++ b/editor/project_converter_3_to_4.cpp @@ -397,6 +397,7 @@ static const char *gdscript_function_renames[][2] = { { "http_unescape", "uri_decode" }, // String { "import_scene_from_other_importer", "_import_scene" }, //EditorSceneFormatImporter { "instance_set_surface_material", "instance_set_surface_override_material" }, // RenderingServer + { "interpolate", "sample" }, // Curve, Curve2D, Curve3D, Gradient { "intersect_polygons_2d", "intersect_polygons" }, // Geometry2D { "intersect_polyline_with_polygon_2d", "intersect_polyline_with_polygon" }, // Geometry2D { "is_a_parent_of", "is_ancestor_of" }, // Node |