From 7f5fb7314648a503d39c48df89ed1af59cae053c Mon Sep 17 00:00:00 2001 From: Eric M Date: Wed, 15 Apr 2020 22:03:12 +1000 Subject: [PATCH] Added selection outline to locked nodes. --- editor/plugins/canvas_item_editor_plugin.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 43a88a32c89..cd3df08276b 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -3200,13 +3200,15 @@ void CanvasItemEditor::_draw_selection() { RID ci = viewport->get_canvas_item(); - List selection = _get_edited_canvas_items(false, false); + List selection = _get_edited_canvas_items(true, false); bool single = selection.size() == 1; for (List::Element *E = selection.front(); E; E = E->next()) { CanvasItem *canvas_item = Object::cast_to(E->get()); CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data(canvas_item); + bool item_locked = canvas_item->has_meta("_edit_lock_"); + // Draw the previous position if we are dragging the node if (show_helpers && (drag_type == DRAG_MOVE || drag_type == DRAG_ROTATE || @@ -3246,6 +3248,10 @@ void CanvasItemEditor::_draw_selection() { Color c = Color(1, 0.6, 0.4, 0.7); + if (item_locked) { + c = Color(0.7, 0.7, 0.7, 0.7); + } + for (int i = 0; i < 4; i++) { viewport->draw_line(endpoints[i], endpoints[(i + 1) % 4], c, Math::round(2 * EDSCALE)); } @@ -3258,7 +3264,7 @@ void CanvasItemEditor::_draw_selection() { viewport->draw_set_transform_matrix(viewport->get_transform()); } - if (single && (tool == TOOL_SELECT || tool == TOOL_MOVE || tool == TOOL_SCALE || tool == TOOL_ROTATE || tool == TOOL_EDIT_PIVOT)) { //kind of sucks + if (single && !item_locked && (tool == TOOL_SELECT || tool == TOOL_MOVE || tool == TOOL_SCALE || tool == TOOL_ROTATE || tool == TOOL_EDIT_PIVOT)) { //kind of sucks // Draw the pivot if (canvas_item->_edit_use_pivot()) {