summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-01-04 01:24:37 +0100
committerGitHub <noreply@github.com>2018-01-04 01:24:37 +0100
commit2870ffe44347cf6012f1264907d744d8968bfbf4 (patch)
treef9b47adc00685f09ef00f4affaf7289e0a62f161
parentd65ac7378c77648124e0e8acd09cea8fd0d104cd (diff)
parent335c1d188026ef60c1f545f24668a3d15dde8327 (diff)
Merge pull request #15301 from YeldhamDev/curve_menu_fix
Small fixes for the Curve Editor's context menu
-rw-r--r--editor/plugins/curve_editor_plugin.cpp23
1 files changed, 3 insertions, 20 deletions
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index c865ddd4b0..3be68f21af 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -347,7 +347,8 @@ void CurveEditor::open_context_menu(Vector2 pos) {
_context_menu->set_item_checked(_context_menu->get_item_index(CONTEXT_LINEAR), is_linear);
} else {
- _context_menu->add_separator();
+ if (_selected_point > 0 || _selected_point + 1 < _curve_ref->get_point_count())
+ _context_menu->add_separator();
if (_selected_point > 0) {
_context_menu->add_check_item(TTR("Left linear"), CONTEXT_LEFT_LINEAR);
@@ -367,6 +368,7 @@ void CurveEditor::open_context_menu(Vector2 pos) {
_context_menu->add_submenu_item(TTR("Load preset"), _presets_menu->get_name());
+ _context_menu->set_size(Size2(0, 0));
_context_menu->popup();
}
@@ -566,7 +568,6 @@ static void plot_curve_accurate(const Curve &curve, float step, T plot_func) {
Vector2 prev_pos = a;
float len = b.x - a.x;
- //float step = 4.f / view_size.x;
for (float x = step; x < len; x += step) {
pos.x = a.x + x;
@@ -694,24 +695,6 @@ void CurveEditor::_draw() {
CanvasItemPlotCurve plot_func(*this, line_color, edge_line_color);
plot_curve_accurate(curve, 4.f / view_size.x, plot_func);
- /*// TEST draw baked curve
- {
- Vector2 pos = Vector2(0, curve.interpolate_baked(0));
- Vector2 prev_pos = pos;
-
- float len = 1.0;
- float step = 4.f / view_size.x;
-
- for(float x = step; x < len; x += step) {
- pos.x = x;
- pos.y = curve.interpolate_baked(x);
- draw_line(get_point_view_pos(prev_pos), get_point_view_pos(pos), Color(0,1,0));
- prev_pos = pos;
- }
-
- draw_line(get_point_view_pos(prev_pos), get_point_view_pos(Vector2(1, curve.interpolate_baked(1))), Color(0,1,0));
- }//*/
-
// Draw points
draw_set_transform_matrix(Transform2D());