summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Haas <Hinsbart@users.noreply.github.com>2017-10-03 00:26:12 +0200
committerGitHub <noreply@github.com>2017-10-03 00:26:12 +0200
commit3c1dab7be708eb89396cb565764ec9afe5cc346d (patch)
treedbce9b42b8ad064ce0aa9b85f8b6f707e92bb2f7
parentb0194a33f65970948ef66819913bf3034a3a22e8 (diff)
parent0ce4d82bbfde8fba8e22e07635817fc649214c1e (diff)
Merge pull request #11770 from Noshyaar/pr-๓
CurveEditor: fix can't edit right tangent
-rw-r--r--editor/plugins/curve_editor_plugin.cpp18
-rw-r--r--scene/resources/curve.cpp10
2 files changed, 14 insertions, 14 deletions
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index 067629c460..2754aeed06 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 daa8fc1874..79cc94c911 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);