From 0ce4d82bbfde8fba8e22e07635817fc649214c1e Mon Sep 17 00:00:00 2001 From: Poommetee Ketson Date: Mon, 2 Oct 2017 14:39:12 +0700 Subject: [PATCH] CurveEditor: fix can't edit right tangent --- editor/plugins/curve_editor_plugin.cpp | 18 +++++++++--------- scene/resources/curve.cpp | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index 067629c460a..2754aeed06e 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -53,12 +53,12 @@ CurveEditor::CurveEditor() { _presets_menu = memnew(PopupMenu); _presets_menu->set_name("_presets_menu"); - _presets_menu->add_item("Flat0", PRESET_FLAT0); - _presets_menu->add_item("Flat1", PRESET_FLAT1); - _presets_menu->add_item("Linear", PRESET_LINEAR); - _presets_menu->add_item("Ease in", PRESET_EASE_IN); - _presets_menu->add_item("Ease out", PRESET_EASE_OUT); - _presets_menu->add_item("Smoothstep", PRESET_SMOOTHSTEP); + _presets_menu->add_item(TTR("Flat0"), PRESET_FLAT0); + _presets_menu->add_item(TTR("Flat1"), PRESET_FLAT1); + _presets_menu->add_item(TTR("Linear"), PRESET_LINEAR); + _presets_menu->add_item(TTR("Ease in"), PRESET_EASE_IN); + _presets_menu->add_item(TTR("Ease out"), PRESET_EASE_OUT); + _presets_menu->add_item(TTR("Smoothstep"), PRESET_SMOOTHSTEP); _presets_menu->connect("id_pressed", this, "_on_preset_item_selected"); _context_menu->add_child(_presets_menu); } @@ -344,19 +344,19 @@ void CurveEditor::open_context_menu(Vector2 pos) { _curve_ref->get_point_left_mode(_selected_point) == Curve::TANGENT_LINEAR : _curve_ref->get_point_right_mode(_selected_point) == Curve::TANGENT_LINEAR; - _context_menu->set_item_checked(CONTEXT_LINEAR, is_linear); + _context_menu->set_item_checked(_context_menu->get_item_index(CONTEXT_LINEAR), is_linear); } else { _context_menu->add_separator(); if (_selected_point > 0) { _context_menu->add_check_item(TTR("Left linear"), CONTEXT_LEFT_LINEAR); - _context_menu->set_item_checked(CONTEXT_LEFT_LINEAR, + _context_menu->set_item_checked(_context_menu->get_item_index(CONTEXT_LEFT_LINEAR), _curve_ref->get_point_left_mode(_selected_point) == Curve::TANGENT_LINEAR); } if (_selected_point + 1 < _curve_ref->get_point_count()) { _context_menu->add_check_item(TTR("Right linear"), CONTEXT_RIGHT_LINEAR); - _context_menu->set_item_checked(CONTEXT_RIGHT_LINEAR, + _context_menu->set_item_checked(_context_menu->get_item_index(CONTEXT_RIGHT_LINEAR), _curve_ref->get_point_right_mode(_selected_point) == Curve::TANGENT_LINEAR); } } diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp index daa8fc18749..79cc94c9113 100644 --- a/scene/resources/curve.cpp +++ b/scene/resources/curve.cpp @@ -485,17 +485,17 @@ void Curve::_bind_methods() { ClassDB::bind_method(D_METHOD("clear_points"), &Curve::clear_points); ClassDB::bind_method(D_METHOD("get_point_position", "index"), &Curve::get_point_position); ClassDB::bind_method(D_METHOD("set_point_value", "index", "y"), &Curve::set_point_value); - ClassDB::bind_method(D_METHOD("set_point_offset", "index", "offset"), &Curve::set_point_value); + ClassDB::bind_method(D_METHOD("set_point_offset", "index", "offset"), &Curve::set_point_offset); ClassDB::bind_method(D_METHOD("interpolate", "offset"), &Curve::interpolate); ClassDB::bind_method(D_METHOD("interpolate_baked", "offset"), &Curve::interpolate_baked); ClassDB::bind_method(D_METHOD("get_point_left_tangent", "index"), &Curve::get_point_left_tangent); - ClassDB::bind_method(D_METHOD("get_point_right_tangent", "index"), &Curve::get_point_left_tangent); + ClassDB::bind_method(D_METHOD("get_point_right_tangent", "index"), &Curve::get_point_right_tangent); ClassDB::bind_method(D_METHOD("get_point_left_mode", "index"), &Curve::get_point_left_mode); - ClassDB::bind_method(D_METHOD("get_point_right_mode", "index"), &Curve::get_point_left_mode); + ClassDB::bind_method(D_METHOD("get_point_right_mode", "index"), &Curve::get_point_right_mode); ClassDB::bind_method(D_METHOD("set_point_left_tangent", "index", "tangent"), &Curve::set_point_left_tangent); - ClassDB::bind_method(D_METHOD("set_point_right_tangent", "index", "tangent"), &Curve::set_point_left_tangent); + ClassDB::bind_method(D_METHOD("set_point_right_tangent", "index", "tangent"), &Curve::set_point_right_tangent); ClassDB::bind_method(D_METHOD("set_point_left_mode", "index", "mode"), &Curve::set_point_left_mode); - ClassDB::bind_method(D_METHOD("set_point_right_mode", "index", "mode"), &Curve::set_point_left_mode); + ClassDB::bind_method(D_METHOD("set_point_right_mode", "index", "mode"), &Curve::set_point_right_mode); ClassDB::bind_method(D_METHOD("get_min_value"), &Curve::get_min_value); ClassDB::bind_method(D_METHOD("set_min_value", "min"), &Curve::set_min_value); ClassDB::bind_method(D_METHOD("get_max_value"), &Curve::get_max_value);