diff options
Diffstat (limited to 'scene/main/node.cpp')
| -rw-r--r-- | scene/main/node.cpp | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 667b4639a..292e4d1a7 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -64,7 +64,7 @@ void Node::_notification(int p_notification) { } } break; - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { if (data.pause_mode==PAUSE_MODE_INHERIT) { @@ -83,12 +83,12 @@ void Node::_notification(int p_notification) { if (data.unhandled_key_input) add_to_group("_vp_unhandled_key_input"+itos(get_viewport()->get_instance_ID())); - get_scene()->node_count++; + get_tree()->node_count++; } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { - get_scene()->node_count--; + get_tree()->node_count--; if (data.input) remove_from_group("_vp_input"+itos(get_viewport()->get_instance_ID())); if (data.unhandled_input) @@ -104,7 +104,7 @@ void Node::_notification(int p_notification) { Variant::CallError err; get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_ready,NULL,0); } - //emit_signal(SceneStringNames::get_singleton()->enter_scene); + //emit_signal(SceneStringNames::get_singleton()->enter_tree); } break; case NOTIFICATION_POSTINITIALIZE: { @@ -150,11 +150,11 @@ void Node::_propagate_ready() { } -void Node::_propagate_enter_scene() { - // this needs to happen to all childs before any ENTER_SCENE +void Node::_propagate_enter_tree() { + // this needs to happen to all childs before any enter_tree if (data.parent) { - data.scene=data.parent->data.scene; + data.tree=data.parent->data.tree; data.depth=data.parent->data.depth+1; } else { @@ -165,25 +165,25 @@ void Node::_propagate_enter_scene() { if (!data.viewport) data.viewport = data.parent->data.viewport; - data.inside_scene=true; + data.inside_tree=true; const StringName *K=NULL; while ((K=data.grouped.next(K))) { - data.scene->add_to_group(*K,this); + data.tree->add_to_group(*K,this); } - notification(NOTIFICATION_ENTER_SCENE); + notification(NOTIFICATION_ENTER_TREE); if (get_script_instance()) { Variant::CallError err; - get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_enter_scene,NULL,0); + get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_enter_tree,NULL,0); } - emit_signal(SceneStringNames::get_singleton()->enter_scene); + emit_signal(SceneStringNames::get_singleton()->enter_tree); data.blocked++; @@ -191,8 +191,8 @@ void Node::_propagate_enter_scene() { for (int i=0;i<data.children.size();i++) { - if (!data.children[i]->is_inside_scene()) // could have been added in ENTER_SCENE - data.children[i]->_propagate_enter_scene(); + if (!data.children[i]->is_inside_tree()) // could have been added in enter_tree + data.children[i]->_propagate_enter_tree(); } data.blocked--; @@ -201,7 +201,7 @@ void Node::_propagate_enter_scene() { -void Node::_propagate_exit_scene() { +void Node::_propagate_exit_tree() { //block while removing children @@ -209,7 +209,7 @@ void Node::_propagate_exit_scene() { for (int i=data.children.size()-1;i>=0;i--) { - data.children[i]->_propagate_exit_scene(); + data.children[i]->_propagate_exit_tree(); } data.blocked--; @@ -217,29 +217,29 @@ void Node::_propagate_exit_scene() { if (get_script_instance()) { Variant::CallError err; - get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_exit_scene,NULL,0); + get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_exit_tree,NULL,0); } - emit_signal(SceneStringNames::get_singleton()->exit_scene); + emit_signal(SceneStringNames::get_singleton()->exit_tree); - notification(NOTIFICATION_EXIT_SCENE,true); - if (data.scene) - data.scene->node_removed(this); + notification(NOTIFICATION_EXIT_TREE,true); + if (data.tree) + data.tree->node_removed(this); // exit groups const StringName *K=NULL; while ((K=data.grouped.next(K))) { - data.scene->remove_from_group(*K,this); + data.tree->remove_from_group(*K,this); } data.viewport = NULL; - if (data.scene) - data.scene->tree_changed(); + if (data.tree) + data.tree->tree_changed(); - data.inside_scene=false; - data.scene=NULL; + data.inside_tree=false; + data.tree=NULL; data.depth=-1; } @@ -260,8 +260,8 @@ void Node::move_child(Node *p_child,int p_pos) { data.children.remove( p_child->data.pos ); data.children.insert( p_pos, p_child ); - if (data.scene) { - data.scene->tree_changed(); + if (data.tree) { + data.tree->tree_changed(); } data.blocked++; @@ -333,7 +333,7 @@ void Node::set_pause_mode(PauseMode p_mode) { bool prev_inherits=data.pause_mode==PAUSE_MODE_INHERIT; data.pause_mode=p_mode; - if (!is_inside_scene()) + if (!is_inside_tree()) return; //pointless if ((data.pause_mode==PAUSE_MODE_INHERIT) == prev_inherits) return; ///nothing changed @@ -372,9 +372,9 @@ void Node::_propagate_pause_owner(Node*p_owner) { bool Node::can_process() const { - ERR_FAIL_COND_V( !is_inside_scene(), false ); + ERR_FAIL_COND_V( !is_inside_tree(), false ); - if (get_scene()->is_paused()) { + if (get_tree()->is_paused()) { if (data.pause_mode==PAUSE_MODE_PROCESS) return true; @@ -395,8 +395,8 @@ bool Node::can_process() const { float Node::get_fixed_process_delta_time() const { - if (data.scene) - return data.scene->get_fixed_process_time(); + if (data.tree) + return data.tree->get_fixed_process_time(); else return 0; } @@ -419,8 +419,8 @@ void Node::set_process(bool p_idle_process) { float Node::get_process_delta_time() const { - if (data.scene) - return data.scene->get_idle_process_time(); + if (data.tree) + return data.tree->get_idle_process_time(); else return 0; } @@ -442,7 +442,7 @@ void Node::set_process_input(bool p_enable) { return; data.input=p_enable; - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (p_enable) @@ -462,7 +462,7 @@ void Node::set_process_unhandled_input(bool p_enable) { if (p_enable==data.unhandled_input) return; data.unhandled_input=p_enable; - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (p_enable) @@ -482,7 +482,7 @@ void Node::set_process_unhandled_key_input(bool p_enable) { if (p_enable==data.unhandled_key_input) return; data.unhandled_key_input=p_enable; - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (p_enable) @@ -520,10 +520,10 @@ void Node::set_name(const String& p_name) { data.parent->_validate_child_name(this); } - if (is_inside_scene()) { + if (is_inside_tree()) { emit_signal("renamed"); - get_scene()->tree_changed(); + get_tree()->tree_changed(); } } @@ -630,8 +630,8 @@ void Node::_add_child_nocheck(Node* p_child,const StringName& p_name) { data.children.push_back( p_child ); p_child->data.parent=this; - if (data.scene) { - p_child->_set_scene(data.scene); + if (data.tree) { + p_child->_set_tree(data.tree); } /* Notify */ @@ -719,7 +719,7 @@ void Node::remove_child(Node *p_child) { //if (data.scene) { does not matter - p_child->_set_scene(NULL); + p_child->_set_tree(NULL); //} remove_child_notify(p_child); @@ -755,7 +755,7 @@ Node *Node::get_child(int p_index) const { Node *Node::_get_node(const NodePath& p_path) const { - ERR_FAIL_COND_V( !data.inside_scene && p_path.is_absolute(), NULL ); + ERR_FAIL_COND_V( !data.inside_tree && p_path.is_absolute(), NULL ); Node *current=NULL; Node *root=NULL; @@ -851,8 +851,8 @@ bool Node::is_a_parent_of(const Node *p_node) const { bool Node::is_greater_than(const Node *p_node) const { ERR_FAIL_NULL_V(p_node,false); - ERR_FAIL_COND_V( !data.inside_scene, false ); - ERR_FAIL_COND_V( !p_node->data.inside_scene, false ); + ERR_FAIL_COND_V( !data.inside_tree, false ); + ERR_FAIL_COND_V( !p_node->data.inside_tree, false ); ERR_FAIL_COND_V( data.depth<0, false); ERR_FAIL_COND_V( p_node->data.depth<0, false); @@ -1023,7 +1023,7 @@ NodePath Node::get_path_to(const Node *p_node) const { NodePath Node::get_path() const { - ERR_FAIL_COND_V(!is_inside_scene(),NodePath()); + ERR_FAIL_COND_V(!is_inside_tree(),NodePath()); const Node *n = this; Vector<StringName> path; @@ -1052,8 +1052,8 @@ void Node::add_to_group(const StringName& p_identifier,bool p_persistent) { GroupData gd; - if (data.scene) - data.scene->add_to_group(p_identifier,this); + if (data.tree) + data.tree->add_to_group(p_identifier,this); gd.persistent=p_persistent; @@ -1070,8 +1070,8 @@ void Node::remove_from_group(const StringName& p_identifier) { ERR_FAIL_COND(!g); - if (data.scene) - data.scene->remove_from_group(p_identifier,this); + if (data.tree) + data.tree->remove_from_group(p_identifier,this); data.grouped.erase(p_identifier); @@ -1131,7 +1131,7 @@ void Node::_propagate_reverse_notification(int p_notification) { void Node::_propagate_deferred_notification(int p_notification, bool p_reverse) { - ERR_FAIL_COND(!is_inside_scene()); + ERR_FAIL_COND(!is_inside_tree()); data.blocked++; @@ -1624,29 +1624,29 @@ Node *Node::get_node_and_resource(const NodePath& p_path,RES& r_res) const { return node; } -void Node::_set_scene(SceneMainLoop *p_scene) { +void Node::_set_tree(SceneTree *p_tree) { - SceneMainLoop *tree_changed_a=NULL; - SceneMainLoop *tree_changed_b=NULL; + SceneTree *tree_changed_a=NULL; + SceneTree *tree_changed_b=NULL; // ERR_FAIL_COND(p_scene && data.parent && !data.parent->data.scene); //nobug if both are null - if (data.scene) { - _propagate_exit_scene(); + if (data.tree) { + _propagate_exit_tree(); - tree_changed_a=data.scene; + tree_changed_a=data.tree; } - data.scene=p_scene; + data.tree=p_tree; - if (data.scene) { + if (data.tree) { - _propagate_enter_scene(); + _propagate_enter_tree(); _propagate_ready(); //reverse_notification(NOTIFICATION_READY); - tree_changed_b=data.scene; + tree_changed_b=data.tree; } @@ -1664,7 +1664,7 @@ static void _Node_debug_sn(Object *p_obj) { if (!n) return; - if (n->is_inside_scene()) + if (n->is_inside_tree()) return; Node *p=n; @@ -1696,8 +1696,8 @@ void Node::print_stray_nodes() { void Node::queue_delete() { - ERR_FAIL_COND( !is_inside_scene() ); - get_scene()->queue_delete(this); + ERR_FAIL_COND( !is_inside_tree() ); + get_tree()->queue_delete(this); } Array Node::_get_children() const { @@ -1742,7 +1742,7 @@ void Node::_bind_methods() { ObjectTypeDB::bind_method(_MD("has_node_and_resource","path"),&Node::has_node_and_resource); ObjectTypeDB::bind_method(_MD("get_node_and_resource","path"),&Node::_get_node_and_resource); - ObjectTypeDB::bind_method(_MD("is_inside_scene"),&Node::is_inside_scene); + ObjectTypeDB::bind_method(_MD("is_inside_tree"),&Node::is_inside_tree); ObjectTypeDB::bind_method(_MD("is_a_parent_of","node:Node"),&Node::is_a_parent_of); ObjectTypeDB::bind_method(_MD("is_greater_than","node:Node"),&Node::is_greater_than); ObjectTypeDB::bind_method(_MD("get_path"),&Node::get_path); @@ -1779,7 +1779,7 @@ void Node::_bind_methods() { ObjectTypeDB::bind_method(_MD("print_stray_nodes"),&Node::_print_stray_nodes); ObjectTypeDB::bind_method(_MD("get_position_in_parent"),&Node::get_position_in_parent); - ObjectTypeDB::bind_method(_MD("get_scene:SceneMainLoop"),&Node::get_scene); + ObjectTypeDB::bind_method(_MD("get_tree:SceneTree"),&Node::get_tree); ObjectTypeDB::bind_method(_MD("duplicate:Node"),&Node::duplicate); ObjectTypeDB::bind_method(_MD("replace_by","node:Node","keep_data"),&Node::replace_by,DEFVAL(false)); @@ -1794,8 +1794,8 @@ void Node::_bind_methods() { #endif - BIND_CONSTANT( NOTIFICATION_ENTER_SCENE ); - BIND_CONSTANT( NOTIFICATION_EXIT_SCENE ); + BIND_CONSTANT( NOTIFICATION_ENTER_TREE ); + BIND_CONSTANT( NOTIFICATION_EXIT_TREE ); BIND_CONSTANT( NOTIFICATION_MOVED_IN_PARENT ); //BIND_CONSTANT( NOTIFICATION_PARENT_DECONFIGURED ); BIND_CONSTANT( NOTIFICATION_READY ); @@ -1812,8 +1812,8 @@ void Node::_bind_methods() { BIND_CONSTANT( PAUSE_MODE_PROCESS ); ADD_SIGNAL( MethodInfo("renamed") ); - ADD_SIGNAL( MethodInfo("enter_scene") ); - ADD_SIGNAL( MethodInfo("exit_scene") ); + ADD_SIGNAL( MethodInfo("enter_tree") ); + ADD_SIGNAL( MethodInfo("exit_tree") ); // ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/process" ),_SCS("set_process"),_SCS("is_processing") ); // ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/fixed_process" ), _SCS("set_fixed_process"),_SCS("is_fixed_processing") ); @@ -1823,8 +1823,8 @@ void Node::_bind_methods() { BIND_VMETHOD( MethodInfo("_process",PropertyInfo(Variant::REAL,"delta")) ); BIND_VMETHOD( MethodInfo("_fixed_process",PropertyInfo(Variant::REAL,"delta")) ); - BIND_VMETHOD( MethodInfo("_enter_scene") ); - BIND_VMETHOD( MethodInfo("_exit_scene") ); + BIND_VMETHOD( MethodInfo("_enter_tree") ); + BIND_VMETHOD( MethodInfo("_exit_tree") ); BIND_VMETHOD( MethodInfo("_ready") ); BIND_VMETHOD( MethodInfo("_input",PropertyInfo(Variant::INPUT_EVENT,"event")) ); BIND_VMETHOD( MethodInfo("_unhandled_input",PropertyInfo(Variant::INPUT_EVENT,"event")) ); @@ -1841,10 +1841,10 @@ Node::Node() { data.depth=-1; data.blocked=0; data.parent=NULL; - data.scene=NULL; + data.tree=NULL; data.fixed_process=false; data.idle_process=false; - data.inside_scene=false; + data.inside_tree=false; data.owner=NULL; data.OW=NULL; |
