From a826fb8d8b861efb0f7d14698148c5571687e082 Mon Sep 17 00:00:00 2001 From: Zephilinox Date: Sat, 20 Jan 2018 21:57:59 +0000 Subject: Add ready signal to Node Closes #15889 --- doc/classes/Node.xml | 5 +++++ scene/main/node.cpp | 3 ++- scene/scene_string_names.cpp | 1 + scene/scene_string_names.h | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index 6f64c865cd..d9b3b6128b 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -735,6 +735,11 @@ + + + Emitted when the node is ready. + + Emitted when the node is renamed. diff --git a/scene/main/node.cpp b/scene/main/node.cpp index ac85dd64af..b5b1f79d42 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -136,7 +136,6 @@ void Node::_notification(int p_notification) { get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_ready, NULL, 0); } - //emit_signal(SceneStringNames::get_singleton()->enter_tree); } break; case NOTIFICATION_POSTINITIALIZE: { @@ -180,6 +179,7 @@ void Node::_propagate_ready() { if (data.ready_first) { data.ready_first = false; notification(NOTIFICATION_READY); + emit_signal(SceneStringNames::get_singleton()->ready); } } @@ -2952,6 +2952,7 @@ void Node::_bind_methods() { BIND_ENUM_CONSTANT(DUPLICATE_SCRIPTS); BIND_ENUM_CONSTANT(DUPLICATE_USE_INSTANCING); + ADD_SIGNAL(MethodInfo("ready")); ADD_SIGNAL(MethodInfo("renamed")); ADD_SIGNAL(MethodInfo("tree_entered")); ADD_SIGNAL(MethodInfo("tree_exiting")); diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp index fdce0eb2b6..2dc32b893d 100644 --- a/scene/scene_string_names.cpp +++ b/scene/scene_string_names.cpp @@ -51,6 +51,7 @@ SceneStringNames::SceneStringNames() { tree_entered = StaticCString::create("tree_entered"); tree_exiting = StaticCString::create("tree_exiting"); tree_exited = StaticCString::create("tree_exited"); + ready = StaticCString::create("ready"); item_rect_changed = StaticCString::create("item_rect_changed"); size_flags_changed = StaticCString::create("size_flags_changed"); minimum_size_changed = StaticCString::create("minimum_size_changed"); diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h index 63a9a5db4d..2e6da26d68 100644 --- a/scene/scene_string_names.h +++ b/scene/scene_string_names.h @@ -71,6 +71,7 @@ public: StringName tree_entered; StringName tree_exiting; StringName tree_exited; + StringName ready; StringName size_flags_changed; StringName minimum_size_changed; StringName sleeping_state_changed; -- cgit v1.2.3