summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Michel Bernard <jmb462@gmail.com>2022-02-11 20:10:57 +0100
committerJean-Michel Bernard <jmb462@gmail.com>2022-02-11 23:18:23 +0100
commitb0ebbd8ecebac52836fa9ecfc27635f5d12268f2 (patch)
tree18a816205da9ca3dd9cd064af44e7f6f0639d767
parenta0558b8af84a5e98cf9d44a888db48470e009e09 (diff)
Hide Polygon2D lines and handles when node is not visible in tree.
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp
index c6bde4c98a..5a98a84717 100644
--- a/editor/plugins/abstract_polygon_2d_editor.cpp
+++ b/editor/plugins/abstract_polygon_2d_editor.cpp
@@ -245,6 +245,10 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
return false;
}
+ if (!_get_node()->is_visible_in_tree()) {
+ return false;
+ }
+
Ref<InputEventMouseButton> mb = p_event;
if (!_has_resource()) {
@@ -478,6 +482,10 @@ void AbstractPolygon2DEditor::forward_canvas_draw_over_viewport(Control *p_overl
return;
}
+ if (!_get_node()->is_visible_in_tree()) {
+ return;
+ }
+
Transform2D xform = canvas_item_editor->get_canvas_transform() * _get_node()->get_global_transform();
// All polygon points are sharp, so use the sharp handle icon
const Ref<Texture2D> handle = get_theme_icon(SNAME("EditorPathSharpHandle"), SNAME("EditorIcons"));