From de4f29f458fd07d9fb132e38662359e2850c566c Mon Sep 17 00:00:00 2001 From: kobewi Date: Thu, 21 Oct 2021 16:46:07 +0200 Subject: Remove node_hrcr hack --- scene/3d/mesh_instance_3d.cpp | 14 +++++++------- scene/3d/voxel_gi.cpp | 2 +- scene/gui/box_container.cpp | 2 +- scene/main/node.cpp | 7 +------ scene/main/node.h | 1 - 5 files changed, 10 insertions(+), 16 deletions(-) (limited to 'scene') diff --git a/scene/3d/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp index c148f95461..ae686143e4 100644 --- a/scene/3d/mesh_instance_3d.cpp +++ b/scene/3d/mesh_instance_3d.cpp @@ -244,7 +244,7 @@ Node *MeshInstance3D::create_trimesh_collision_node() { StaticBody3D *static_body = memnew(StaticBody3D); CollisionShape3D *cshape = memnew(CollisionShape3D); cshape->set_shape(shape); - static_body->add_child(cshape); + static_body->add_child(cshape, true); return static_body; } @@ -253,7 +253,7 @@ void MeshInstance3D::create_trimesh_collision() { ERR_FAIL_COND(!static_body); static_body->set_name(String(get_name()) + "_col"); - add_child(static_body); + add_child(static_body, true); if (get_owner()) { CollisionShape3D *cshape = Object::cast_to(static_body->get_child(0)); static_body->set_owner(get_owner()); @@ -274,7 +274,7 @@ Node *MeshInstance3D::create_convex_collision_node(bool p_clean, bool p_simplify StaticBody3D *static_body = memnew(StaticBody3D); CollisionShape3D *cshape = memnew(CollisionShape3D); cshape->set_shape(shape); - static_body->add_child(cshape); + static_body->add_child(cshape, true); return static_body; } @@ -283,7 +283,7 @@ void MeshInstance3D::create_convex_collision(bool p_clean, bool p_simplify) { ERR_FAIL_COND(!static_body); static_body->set_name(String(get_name()) + "_col"); - add_child(static_body); + add_child(static_body, true); if (get_owner()) { CollisionShape3D *cshape = Object::cast_to(static_body->get_child(0)); static_body->set_owner(get_owner()); @@ -306,7 +306,7 @@ Node *MeshInstance3D::create_multiple_convex_collisions_node() { for (int i = 0; i < shapes.size(); i++) { CollisionShape3D *cshape = memnew(CollisionShape3D); cshape->set_shape(shapes[i]); - static_body->add_child(cshape); + static_body->add_child(cshape, true); } return static_body; } @@ -316,7 +316,7 @@ void MeshInstance3D::create_multiple_convex_collisions() { ERR_FAIL_COND(!static_body); static_body->set_name(String(get_name()) + "_col"); - add_child(static_body); + add_child(static_body, true); if (get_owner()) { static_body->set_owner(get_owner()); int count = static_body->get_child_count(); @@ -460,7 +460,7 @@ void MeshInstance3D::create_debug_tangents() { MeshInstance3D *mi = memnew(MeshInstance3D); mi->set_mesh(am); mi->set_name("DebugTangents"); - add_child(mi); + add_child(mi, true); #ifdef TOOLS_ENABLED if (is_inside_tree() && this == get_tree()->get_edited_scene_root()) { diff --git a/scene/3d/voxel_gi.cpp b/scene/3d/voxel_gi.cpp index 377abd5b38..18b1632048 100644 --- a/scene/3d/voxel_gi.cpp +++ b/scene/3d/voxel_gi.cpp @@ -403,7 +403,7 @@ void VoxelGI::bake(Node *p_from_node, bool p_create_visual_debug) { if (p_create_visual_debug) { MultiMeshInstance3D *mmi = memnew(MultiMeshInstance3D); mmi->set_multimesh(baker.create_debug_multimesh()); - add_child(mmi); + add_child(mmi, true); #ifdef TOOLS_ENABLED if (is_inside_tree() && get_tree()->get_edited_scene_root() == this) { mmi->set_owner(this); diff --git a/scene/gui/box_container.cpp b/scene/gui/box_container.cpp index cf2df4e1a2..cb9f13e970 100644 --- a/scene/gui/box_container.cpp +++ b/scene/gui/box_container.cpp @@ -354,7 +354,7 @@ MarginContainer *VBoxContainer::add_margin_child(const String &p_label, Control add_child(l, false, INTERNAL_MODE_FRONT); MarginContainer *mc = memnew(MarginContainer); mc->add_theme_constant_override("margin_left", 0); - mc->add_child(p_control); + mc->add_child(p_control, true); add_child(mc, false, INTERNAL_MODE_FRONT); if (p_expand) { mc->set_v_size_flags(SIZE_EXPAND_FILL); diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 189aebb47d..cb26698394 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -908,17 +908,12 @@ void Node::set_name(const String &p_name) { } } -static bool node_hrcr = false; static SafeRefCount node_hrcr_count; void Node::init_node_hrcr() { node_hrcr_count.init(1); } -void Node::set_human_readable_collision_renaming(bool p_enabled) { - node_hrcr = p_enabled; -} - #ifdef TOOLS_ENABLED String Node::validate_child_name(Node *p_child) { StringName name = p_child->data.name; @@ -930,7 +925,7 @@ String Node::validate_child_name(Node *p_child) { void Node::_validate_child_name(Node *p_child, bool p_force_human_readable) { /* Make sure the name is unique */ - if (node_hrcr || p_force_human_readable) { + if (p_force_human_readable) { //this approach to autoset node names is human readable but very slow //it's turned on while running in the editor diff --git a/scene/main/node.h b/scene/main/node.h index e59a7a390a..c308ec4fac 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -437,7 +437,6 @@ public: void queue_delete(); //hacks for speed - static void set_human_readable_collision_renaming(bool p_enabled); static void init_node_hrcr(); void force_parent_owned() { data.parent_owned = true; } //hack to avoid duplicate nodes -- cgit v1.2.3