diff options
Diffstat (limited to 'tools/editor')
-rw-r--r-- | tools/editor/plugins/polygon_2d_editor_plugin.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.cpp b/tools/editor/plugins/polygon_2d_editor_plugin.cpp index 3029dcf2ab..cd82297365 100644 --- a/tools/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/tools/editor/plugins/polygon_2d_editor_plugin.cpp @@ -54,6 +54,8 @@ void Polygon2DEditor::_notification(int p_what) { b_snap_enable->set_icon( get_icon("Snap", "EditorIcons")); uv_icon_zoom->set_texture( get_icon("Zoom", "EditorIcons")); + get_tree()->connect("node_removed", this, "_node_removed"); + } break; case NOTIFICATION_FIXED_PROCESS: { @@ -65,8 +67,10 @@ void Polygon2DEditor::_notification(int p_what) { void Polygon2DEditor::_node_removed(Node *p_node) { if(p_node==node) { - node=NULL; + edit(NULL); hide(); + + canvas_item_editor->get_viewport_control()->update(); } } @@ -757,16 +761,13 @@ void Polygon2DEditor::edit(Node *p_collision_polygon) { node=p_collision_polygon->cast_to<Polygon2D>(); if (!canvas_item_editor->get_viewport_control()->is_connected("draw",this,"_canvas_draw")) canvas_item_editor->get_viewport_control()->connect("draw",this,"_canvas_draw"); - node->connect("exit_tree",this,"_node_removed",varray(),CONNECT_ONESHOT); + wip.clear(); wip_active=false; edited_point=-1; } else { - if (node) - node->disconnect("exit_tree",this,"_node_removed"); - node=NULL; if (canvas_item_editor->get_viewport_control()->is_connected("draw",this,"_canvas_draw")) |