summaryrefslogtreecommitdiff
path: root/tools/editor
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-11-19 00:21:46 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-11-19 00:21:46 -0300
commit2dac9ab2ef7ac9e015ef577f7ec0704f50cf6670 (patch)
treed3ab1014f8c75638f4b05d377ce2d502ee2d06fa /tools/editor
parent6a3484260d80cf3dcb88fe069b1cd2453f5fcb3d (diff)
parentcd4d4b97e37738259c57d1caa21e52b18ab9adf9 (diff)
Merge pull request #2447 from TheHX/issue_1275
Fix crash after undo when editing Polygon2D (#1275)
Diffstat (limited to 'tools/editor')
-rw-r--r--tools/editor/plugins/polygon_2d_editor_plugin.cpp11
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"))