From f6cb4a0275268daadd868d5f2e6b137e40d2c9a3 Mon Sep 17 00:00:00 2001 From: aXu-AP <1621768+aXu-AP@users.noreply.github.com> Date: Wed, 20 Nov 2024 19:40:35 +0200 Subject: [PATCH] Revert "Remove signal connections" This reverts commit f94c2f6d7df551991da766501fc5fbac3dc47e26. --- editor/plugins/polygon_2d_editor_plugin.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index 7b2d851c5877..5669c4d65386 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -59,12 +59,19 @@ Node2D *Polygon2DEditor::_get_node() const { void Polygon2DEditor::_set_node(Node *p_polygon) { CanvasItem *draw = Object::cast_to(uv_edit_draw); + if (node) { + node->disconnect("draw", callable_mp(draw, &CanvasItem::queue_redraw)); + node->disconnect("draw", callable_mp(this, &Polygon2DEditor::_update_available_modes)); + } node = Object::cast_to(p_polygon); _update_polygon_editing_state(); uv_edit_draw->queue_redraw(); if (node) { _menu_option(MODE_EDIT_UV); + // Whenever polygon gets redrawn, there's possible changes for the editor as well. + node->connect("draw", callable_mp(draw, &CanvasItem::queue_redraw)); + node->connect("draw", callable_mp(this, &Polygon2DEditor::_update_available_modes)); } }