diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-06-20 09:39:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-20 09:39:29 +0200 |
commit | 4fcc5891450a7dca9c8ebae6ff3765f5f060c442 (patch) | |
tree | d10b935e7a77774960fefd93ac306db447cc2bfd /scene/main | |
parent | 60dcc4f39c0e6289dba691225c002cd6e77be6ba (diff) | |
parent | e28fd07b2bbe78db0f286604a6eb469d8a0664be (diff) |
Merge pull request #49693 from LightningAA/instance-is-not-a-verb
Rename `instance()`->`instantiate()` when it's a verb
Diffstat (limited to 'scene/main')
-rw-r--r-- | scene/main/http_request.cpp | 2 | ||||
-rw-r--r-- | scene/main/instance_placeholder.cpp | 2 | ||||
-rw-r--r-- | scene/main/node.cpp | 20 | ||||
-rw-r--r-- | scene/main/scene_tree.cpp | 6 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 10 |
5 files changed, 20 insertions, 20 deletions
diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp index 927b114fbc..f3c7d128ba 100644 --- a/scene/main/http_request.cpp +++ b/scene/main/http_request.cpp @@ -627,7 +627,7 @@ void HTTPRequest::_bind_methods() { } HTTPRequest::HTTPRequest() { - client.instance(); + client.instantiate(); timer = memnew(Timer); timer->set_one_shot(true); timer->connect("timeout", callable_mp(this, &HTTPRequest::_timeout)); diff --git a/scene/main/instance_placeholder.cpp b/scene/main/instance_placeholder.cpp index 1661984e30..89dac5f5a8 100644 --- a/scene/main/instance_placeholder.cpp +++ b/scene/main/instance_placeholder.cpp @@ -88,7 +88,7 @@ Node *InstancePlaceholder::create_instance(bool p_replace, const Ref<PackedScene if (!ps.is_valid()) { return nullptr; } - Node *scene = ps->instance(); + Node *scene = ps->instantiate(); if (!scene) { return nullptr; } diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 679fca0217..baf185c847 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1813,7 +1813,7 @@ bool Node::get_scene_instance_load_placeholder() const { Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const { Node *node = nullptr; - bool instanced = false; + bool instantiated = false; if (Object::cast_to<InstancePlaceholder>(this)) { const InstancePlaceholder *ip = Object::cast_to<const InstancePlaceholder>(this); @@ -1830,13 +1830,13 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const ges = PackedScene::GEN_EDIT_STATE_INSTANCE; } #endif - node = res->instance(ges); + node = res->instantiate(ges); ERR_FAIL_COND_V(!node, nullptr); - instanced = true; + instantiated = true; } else { - Object *obj = ClassDB::instance(get_class()); + Object *obj = ClassDB::instantiate(get_class()); ERR_FAIL_COND_V(!obj, nullptr); node = Object::cast_to<Node>(obj); if (!node) { @@ -1856,9 +1856,9 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const List<const Node *> node_tree; node_tree.push_front(this); - if (instanced) { - // Since nodes in the instanced hierarchy won't be duplicated explicitly, we need to make an inventory - // of all the nodes in the tree of the instanced scene in order to transfer the values of the properties + if (instantiated) { + // Since nodes in the instantiated hierarchy won't be duplicated explicitly, we need to make an inventory + // of all the nodes in the tree of the instantiated scene in order to transfer the values of the properties Vector<const Node *> instance_roots; instance_roots.push_back(this); @@ -1866,8 +1866,8 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const for (List<const Node *>::Element *N = node_tree.front(); N; N = N->next()) { for (int i = 0; i < N->get()->get_child_count(); ++i) { Node *descendant = N->get()->get_child(i); - // Skip nodes not really belonging to the instanced hierarchy; they'll be processed normally later - // but remember non-instanced nodes that are hidden below instanced ones + // Skip nodes not really belonging to the instantiated hierarchy; they'll be processed normally later + // but remember non-instantiated nodes that are hidden below instantiated ones if (!instance_roots.has(descendant->get_owner())) { if (descendant->get_parent() && descendant->get_parent() != this && descendant->data.owner != descendant->get_parent()) { hidden_roots.push_back(descendant); @@ -1950,7 +1950,7 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const if (get_child(i)->data.parent_owned) { continue; } - if (instanced && get_child(i)->data.owner == this) { + if (instantiated && get_child(i)->data.owner == this) { continue; //part of instance } diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 918eca7def..6c46db7801 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -1093,7 +1093,7 @@ Error SceneTree::change_scene(const String &p_path) { Error SceneTree::change_scene_to(const Ref<PackedScene> &p_scene) { Node *new_scene = nullptr; if (p_scene.is_valid()) { - new_scene = p_scene->instance(); + new_scene = p_scene->instantiate(); ERR_FAIL_COND_V(!new_scene, ERR_CANT_CREATE); } @@ -1114,7 +1114,7 @@ void SceneTree::add_current_scene(Node *p_current) { Ref<SceneTreeTimer> SceneTree::create_timer(float p_delay_sec, bool p_process_always) { Ref<SceneTreeTimer> stt; - stt.instance(); + stt.instantiate(); stt->set_process_always(p_process_always); stt->set_time_left(p_delay_sec); timers.push_back(stt); @@ -1123,7 +1123,7 @@ Ref<SceneTreeTimer> SceneTree::create_timer(float p_delay_sec, bool p_process_al Ref<Tween> SceneTree::create_tween() { Ref<Tween> tween; - tween.instance(); + tween.instantiate(); tween->set_valid(true); tweens.push_back(tween); return tween; diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 84a6dbe889..4ba50eeaa8 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -594,7 +594,7 @@ void Viewport::_process_picking() { if (!has_mouse_event) { Ref<InputEventMouseMotion> mm; - mm.instance(); + mm.instantiate(); mm->set_device(InputEvent::DEVICE_ID_INTERNAL); mm->set_global_position(physics_last_mousepos); @@ -2585,7 +2585,7 @@ void Viewport::_drop_mouse_focus() { for (int i = 0; i < 3; i++) { if (mask & (1 << i)) { Ref<InputEventMouseButton> mb; - mb.instance(); + mb.instantiate(); mb->set_position(c->get_local_mouse_position()); mb->set_global_position(c->get_local_mouse_position()); mb->set_button_index(i + 1); @@ -2661,7 +2661,7 @@ void Viewport::_post_gui_grab_click_focus() { for (int i = 0; i < 3; i++) { if (mask & (1 << i)) { Ref<InputEventMouseButton> mb; - mb.instance(); + mb.instantiate(); //send unclick @@ -2679,7 +2679,7 @@ void Viewport::_post_gui_grab_click_focus() { for (int i = 0; i < 3; i++) { if (mask & (1 << i)) { Ref<InputEventMouseButton> mb; - mb.instance(); + mb.instantiate(); //send click @@ -3698,7 +3698,7 @@ Viewport::Viewport() { viewport = RenderingServer::get_singleton()->viewport_create(); texture_rid = RenderingServer::get_singleton()->viewport_get_texture(viewport); - default_texture.instance(); + default_texture.instantiate(); default_texture->vp = const_cast<Viewport *>(this); viewport_textures.insert(default_texture.ptr()); default_texture->proxy = RS::get_singleton()->texture_proxy_create(texture_rid); |