1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

add "add point" and "select point" handles to polygon 2d editor

This commit is contained in:
Bernhard Liebl
2017-11-27 14:01:34 +01:00
parent 17b4f43e0e
commit 91b8b94635
2 changed files with 8 additions and 4 deletions

View File

@@ -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<Texture> default_handle = get_icon("EditorHandle", "EditorIcons");
Ref<Texture> selected_handle = get_icon("EditorHandleSelected", "EditorIcons");
const Ref<Texture> 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<Texture> 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);
}
}