Merge pull request #15911 from Zephilinox/ready_signal

Add ready signal to Node
This commit is contained in:
Juan Linietsky 2018-05-07 17:56:10 -03:00 committed by GitHub
commit 7b065a59fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 1 deletions

View File

@ -780,6 +780,11 @@
</member> </member>
</members> </members>
<signals> <signals>
<signal name="ready">
<description>
Emitted when the node is ready.
</description>
</signal>
<signal name="renamed"> <signal name="renamed">
<description> <description>
Emitted when the node is renamed. Emitted when the node is renamed.

View File

@ -136,7 +136,6 @@ void Node::_notification(int p_notification) {
get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_ready, NULL, 0); get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_ready, NULL, 0);
} }
//emit_signal(SceneStringNames::get_singleton()->enter_tree);
} break; } break;
case NOTIFICATION_POSTINITIALIZE: { case NOTIFICATION_POSTINITIALIZE: {
@ -180,6 +179,7 @@ void Node::_propagate_ready() {
if (data.ready_first) { if (data.ready_first) {
data.ready_first = false; data.ready_first = false;
notification(NOTIFICATION_READY); notification(NOTIFICATION_READY);
emit_signal(SceneStringNames::get_singleton()->ready);
} }
} }
@ -2814,6 +2814,7 @@ void Node::_bind_methods() {
BIND_ENUM_CONSTANT(DUPLICATE_SCRIPTS); BIND_ENUM_CONSTANT(DUPLICATE_SCRIPTS);
BIND_ENUM_CONSTANT(DUPLICATE_USE_INSTANCING); BIND_ENUM_CONSTANT(DUPLICATE_USE_INSTANCING);
ADD_SIGNAL(MethodInfo("ready"));
ADD_SIGNAL(MethodInfo("renamed")); ADD_SIGNAL(MethodInfo("renamed"));
ADD_SIGNAL(MethodInfo("tree_entered")); ADD_SIGNAL(MethodInfo("tree_entered"));
ADD_SIGNAL(MethodInfo("tree_exiting")); ADD_SIGNAL(MethodInfo("tree_exiting"));

View File

@ -51,6 +51,7 @@ SceneStringNames::SceneStringNames() {
tree_entered = StaticCString::create("tree_entered"); tree_entered = StaticCString::create("tree_entered");
tree_exiting = StaticCString::create("tree_exiting"); tree_exiting = StaticCString::create("tree_exiting");
tree_exited = StaticCString::create("tree_exited"); tree_exited = StaticCString::create("tree_exited");
ready = StaticCString::create("ready");
item_rect_changed = StaticCString::create("item_rect_changed"); item_rect_changed = StaticCString::create("item_rect_changed");
size_flags_changed = StaticCString::create("size_flags_changed"); size_flags_changed = StaticCString::create("size_flags_changed");
minimum_size_changed = StaticCString::create("minimum_size_changed"); minimum_size_changed = StaticCString::create("minimum_size_changed");

View File

@ -71,6 +71,7 @@ public:
StringName tree_entered; StringName tree_entered;
StringName tree_exiting; StringName tree_exiting;
StringName tree_exited; StringName tree_exited;
StringName ready;
StringName size_flags_changed; StringName size_flags_changed;
StringName minimum_size_changed; StringName minimum_size_changed;
StringName sleeping_state_changed; StringName sleeping_state_changed;