Revert "Do not emit NOTIFICATION_READY more than once (breaking change)"

This reverts commit b6eab006db.

This commit broke compatibility in an undesired way, as outlined in
https://github.com/godotengine/godot/issues/3290#issuecomment-263388003
This commit is contained in:
Rémi Verschelde 2016-11-30 00:07:29 +01:00
parent ab637bc812
commit 440c37fbd9
2 changed files with 6 additions and 7 deletions

View file

@ -22635,7 +22635,7 @@
Nodes are the base bricks with which Godot games are developed. They can be set as children of other nodes, resulting in a tree arrangement. A given node can contain any number of nodes as children (but there is only one scene tree root node) with the requirement that all siblings (direct children of a node) should have unique names.
Any tree of nodes is called a [i]scene[/i]. Scenes can be saved to the disk and then instanced into other scenes. This allows for very high flexibility in the architecture and data model of the projects. Nodes can optionally be added to groups. This makes it easy to reach a number of nodes from the code (for example an "enemies" group) to perform grouped actions.
[b]Scene tree:[/b] The [SceneTree] contains the active tree of nodes. When a node is added to the scene tree, it receives the NOTIFICATION_ENTER_TREE notification and its [method _enter_tree] callback is triggered. Children nodes are always added [i]after[/i] their parent node, i.e. the [method _enter_tree] callback of a parent node will be triggered before its child's.
Once all nodes have been added in the scene tree for the first time, they receive the NOTIFICATION_READY notification and their respective [method _ready] callbacks are triggered. For groups of nodes, the [method _ready] callback is called in reverse order, from the children up to the parent nodes.
Once all nodes have been added in the scene tree, they receive the NOTIFICATION_READY notification and their respective [method _ready] callbacks are triggered. For groups of nodes, the [method _ready] callback is called in reverse order, from the children up to the parent nodes.
It means that when adding a scene to the scene tree, the following order will be used for the callbacks: [method _enter_tree] of the parent, [method _enter_tree] of the children, [method _ready] of the children and finally [method _ready] of the parent (and that recursively for the whole scene).
[b]Processing:[/b] Nodes can be set to the "process" state, so that they receive a callback on each frame requesting them to process (do something). Normal processing (callback [method _process], toggled with [method set_process]) happens as fast as possible and is dependent on the frame rate, so the processing time [i]delta[/i] is variable. Fixed processing (callback [method _fixed_process], toggled with [method set_fixed_process]) happens a fixed amount of times per second (by default 60) and is useful to link itself to the physics.
Nodes can also process input events. When set, the [method _input] function will be called for each input that the program receives. In many cases, this can be overkill (unless used for simple projects), and the [method _unhandled_input] function might be preferred; it is called when the input event was not handled by anyone else (typically, GUI [Control] nodes), ensuring that the node only receives the events that were meant for it.
@ -23269,7 +23269,6 @@
<constant name="NOTIFICATION_MOVED_IN_PARENT" value="12">
</constant>
<constant name="NOTIFICATION_READY" value="13">
Notification received the first time the object is added into the scene tree, but after all it's children have received it.
</constant>
<constant name="NOTIFICATION_FIXED_PROCESS" value="16">
</constant>

View file

@ -166,16 +166,14 @@ void Node::_notification(int p_notification) {
void Node::_propagate_ready() {
data.ready_notified=true;
data.blocked++;
for (int i=0;i<data.children.size();i++) {
data.children[i]->_propagate_ready();
}
data.blocked--;
if(!data.ready_notified) {
data.ready_notified=true;
notification(NOTIFICATION_READY);
}
notification(NOTIFICATION_READY);
}
@ -2665,7 +2663,9 @@ void Node::_set_tree(SceneTree *p_tree) {
_propagate_enter_tree();
_propagate_ready(); //reverse_notification(NOTIFICATION_READY);
if (!data.parent || data.parent->data.ready_notified) { // No parent (root) or parent ready
_propagate_ready(); //reverse_notification(NOTIFICATION_READY);
}
tree_changed_b=data.tree;