From 91b8b9463520242183af6dd2c4f999ea714ebbd6 Mon Sep 17 00:00:00 2001 From: Bernhard Liebl Date: Mon, 27 Nov 2017 14:01:34 +0100 Subject: add "add point" and "select point" handles to polygon 2d editor --- editor/icons/icon_editor_handle_add.svg | 5 +++++ editor/plugins/abstract_polygon_2d_editor.cpp | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 editor/icons/icon_editor_handle_add.svg (limited to 'editor') diff --git a/editor/icons/icon_editor_handle_add.svg b/editor/icons/icon_editor_handle_add.svg new file mode 100644 index 0000000000..be61cd53f9 --- /dev/null +++ b/editor/icons/icon_editor_handle_add.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index 1c4569d117..cabdfa761d 100644 --- a/editor/plugins/abstract_polygon_2d_editor.cpp +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -497,8 +497,7 @@ void AbstractPolygon2DEditor::forward_draw_over_viewport(Control *p_overlay) { Control *vpc = canvas_item_editor->get_viewport_control(); Transform2D xform = canvas_item_editor->get_canvas_transform() * _get_node()->get_global_transform(); - Ref default_handle = get_icon("EditorHandle", "EditorIcons"); - Ref selected_handle = get_icon("EditorHandleSelected", "EditorIcons"); + const Ref handle = get_icon("EditorHandle", "EditorIcons"); const Vertex active_point = get_active_point(); const int n_polygons = _get_polygon_count(); @@ -572,8 +571,8 @@ void AbstractPolygon2DEditor::forward_draw_over_viewport(Control *p_overlay) { const Vector2 p = (vertex == edited_point) ? edited_point.pos : (points[i] + offset); const Vector2 point = xform.xform(p); - Ref handle = vertex == active_point ? selected_handle : default_handle; - vpc->draw_texture(handle, point - handle->get_size() * 0.5); + const Color modulate = vertex == active_point ? Color(0.5, 1, 2) : Color(1, 1, 1); + vpc->draw_texture(handle, point - handle->get_size() * 0.5, modulate); } } -- cgit v1.2.3