some checks for node removed, may fix #20863

This commit is contained in:
Juan Linietsky 2018-08-24 08:28:53 -03:00
parent f123694b4e
commit 0161e95f01
3 changed files with 12 additions and 0 deletions

View file

@ -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() {

View file

@ -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() {

View file

@ -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();