From cd4d4b97e37738259c57d1caa21e52b18ab9adf9 Mon Sep 17 00:00:00 2001 From: Franklin Sobrinho Date: Mon, 7 Sep 2015 12:14:20 -0300 Subject: Fix issue #1275 --- tools/editor/plugins/polygon_2d_editor_plugin.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'tools/editor') 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(); 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")) -- cgit v1.2.3