Merge pull request #11770 from Noshyaar/pr-๓

CurveEditor: fix can't edit right tangent
This commit is contained in:
Andreas Haas 2017-10-03 00:26:12 +02:00 committed by GitHub
commit 3c1dab7be7
2 changed files with 14 additions and 14 deletions

View file

@ -53,12 +53,12 @@ CurveEditor::CurveEditor() {
_presets_menu = memnew(PopupMenu); _presets_menu = memnew(PopupMenu);
_presets_menu->set_name("_presets_menu"); _presets_menu->set_name("_presets_menu");
_presets_menu->add_item("Flat0", PRESET_FLAT0); _presets_menu->add_item(TTR("Flat0"), PRESET_FLAT0);
_presets_menu->add_item("Flat1", PRESET_FLAT1); _presets_menu->add_item(TTR("Flat1"), PRESET_FLAT1);
_presets_menu->add_item("Linear", PRESET_LINEAR); _presets_menu->add_item(TTR("Linear"), PRESET_LINEAR);
_presets_menu->add_item("Ease in", PRESET_EASE_IN); _presets_menu->add_item(TTR("Ease in"), PRESET_EASE_IN);
_presets_menu->add_item("Ease out", PRESET_EASE_OUT); _presets_menu->add_item(TTR("Ease out"), PRESET_EASE_OUT);
_presets_menu->add_item("Smoothstep", PRESET_SMOOTHSTEP); _presets_menu->add_item(TTR("Smoothstep"), PRESET_SMOOTHSTEP);
_presets_menu->connect("id_pressed", this, "_on_preset_item_selected"); _presets_menu->connect("id_pressed", this, "_on_preset_item_selected");
_context_menu->add_child(_presets_menu); _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_left_mode(_selected_point) == Curve::TANGENT_LINEAR :
_curve_ref->get_point_right_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 { } else {
_context_menu->add_separator(); _context_menu->add_separator();
if (_selected_point > 0) { if (_selected_point > 0) {
_context_menu->add_check_item(TTR("Left linear"), CONTEXT_LEFT_LINEAR); _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); _curve_ref->get_point_left_mode(_selected_point) == Curve::TANGENT_LINEAR);
} }
if (_selected_point + 1 < _curve_ref->get_point_count()) { if (_selected_point + 1 < _curve_ref->get_point_count()) {
_context_menu->add_check_item(TTR("Right linear"), CONTEXT_RIGHT_LINEAR); _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); _curve_ref->get_point_right_mode(_selected_point) == Curve::TANGENT_LINEAR);
} }
} }

View file

@ -485,17 +485,17 @@ void Curve::_bind_methods() {
ClassDB::bind_method(D_METHOD("clear_points"), &Curve::clear_points); 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("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_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", "offset"), &Curve::interpolate);
ClassDB::bind_method(D_METHOD("interpolate_baked", "offset"), &Curve::interpolate_baked); 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_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_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_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_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("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("set_min_value", "min"), &Curve::set_min_value);
ClassDB::bind_method(D_METHOD("get_max_value"), &Curve::get_max_value); ClassDB::bind_method(D_METHOD("get_max_value"), &Curve::get_max_value);