From 0161e95f01a6a9c096eec75328e4f19c23cf5c25 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 24 Aug 2018 08:28:53 -0300 Subject: some checks for node removed, may fix #20863 --- editor/plugins/particles_editor_plugin.cpp | 2 ++ editor/plugins/skeleton_editor_plugin.cpp | 9 +++++++++ editor/plugins/skeleton_editor_plugin.h | 1 + 3 files changed, 12 insertions(+) (limited to 'editor/plugins') diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp index 6a99dcb9a5..3c381158a4 100644 --- a/editor/plugins/particles_editor_plugin.cpp +++ b/editor/plugins/particles_editor_plugin.cpp @@ -262,6 +262,7 @@ void ParticlesEditor::_notification(int p_notification) { if (p_notification == NOTIFICATION_ENTER_TREE) { options->set_icon(options->get_popup()->get_icon("Particles", "EditorIcons")); + get_tree()->connect("node_removed", this, "_node_removed"); } } @@ -444,6 +445,7 @@ void ParticlesEditor::_bind_methods() { ClassDB::bind_method("_menu_option", &ParticlesEditor::_menu_option); ClassDB::bind_method("_generate_aabb", &ParticlesEditor::_generate_aabb); + ClassDB::bind_method("_node_removed", &ParticlesEditor::_node_removed); } ParticlesEditor::ParticlesEditor() { diff --git a/editor/plugins/skeleton_editor_plugin.cpp b/editor/plugins/skeleton_editor_plugin.cpp index fe7d1df50c..d871922c8b 100644 --- a/editor/plugins/skeleton_editor_plugin.cpp +++ b/editor/plugins/skeleton_editor_plugin.cpp @@ -126,7 +126,15 @@ PhysicalBone *SkeletonEditor::create_physical_bone(int bone_id, int bone_child_i } void SkeletonEditor::edit(Skeleton *p_node) { + skeleton = p_node; + +} + +void SkeletonEditor::_notification(int p_what) { + if (p_what==NOTIFICATION_ENTER_TREE) { + get_tree()->connect("node_removed", this, "_node_removed"); + } } void SkeletonEditor::_node_removed(Node *p_node) { @@ -139,6 +147,7 @@ void SkeletonEditor::_node_removed(Node *p_node) { void SkeletonEditor::_bind_methods() { ClassDB::bind_method("_on_click_option", &SkeletonEditor::_on_click_option); + ClassDB::bind_method("_node_removed", &SkeletonEditor::_node_removed); } SkeletonEditor::SkeletonEditor() { diff --git a/editor/plugins/skeleton_editor_plugin.h b/editor/plugins/skeleton_editor_plugin.h index b9bdf91902..0ab94c15b5 100644 --- a/editor/plugins/skeleton_editor_plugin.h +++ b/editor/plugins/skeleton_editor_plugin.h @@ -61,6 +61,7 @@ class SkeletonEditor : public Node { friend class SkeletonEditorPlugin; protected: + void _notification(int p_what); void _node_removed(Node *p_node); static void _bind_methods(); -- cgit v1.2.3