Skip to content

Commit

Permalink
[3.x] Remove hardcoded names in generated objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Shatur authored and akien-mga committed Jul 2, 2022
1 parent 3000d8d commit 5ccc941
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions editor/import/resource_importer_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,22 +444,18 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
BoxShape *boxShape = memnew(BoxShape);
boxShape->set_extents(Vector3(1, 1, 1));
colshape->set_shape(boxShape);
colshape->set_name("BoxShape");
} else if (empty_draw_type == "SINGLE_ARROW") {
RayShape *rayShape = memnew(RayShape);
rayShape->set_length(1);
colshape->set_shape(rayShape);
colshape->set_name("RayShape");
Object::cast_to<Spatial>(sb)->rotate_x(Math_PI / 2);
} else if (empty_draw_type == "IMAGE") {
PlaneShape *planeShape = memnew(PlaneShape);
colshape->set_shape(planeShape);
colshape->set_name("PlaneShape");
} else {
SphereShape *sphereShape = memnew(SphereShape);
sphereShape->set_radius(1);
colshape->set_shape(sphereShape);
colshape->set_name("SphereShape");
}
sb->add_child(colshape);
colshape->set_owner(sb->get_owner());
Expand All @@ -486,7 +482,6 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
p_node->replace_by(rigid_body);
rigid_body->set_transform(mi->get_transform());
p_node = rigid_body;
mi->set_name("mesh");
mi->set_transform(Transform());
rigid_body->add_child(mi);
mi->set_owner(rigid_body->get_owner());
Expand Down Expand Up @@ -526,7 +521,6 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>

if (shapes.size()) {
StaticBody *col = memnew(StaticBody);
col->set_name("static_collision");
mi->add_child(col);
col->set_owner(mi->get_owner());

Expand Down Expand Up @@ -615,7 +609,6 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>

if (shapes.size()) {
StaticBody *col = memnew(StaticBody);
col->set_name("static_collision");
p_node->add_child(col);
col->set_owner(p_node->get_owner());

Expand Down Expand Up @@ -1161,7 +1154,6 @@ void ResourceImporterScene::_add_shapes(Node *p_node, const List<Ref<Shape>> &p_
cshape->set_shape(E->get());
p_node->add_child(cshape);

cshape->set_name("shape" + itos(idx));
cshape->set_owner(p_node->get_owner());
idx++;
}
Expand Down

1 comment on commit 5ccc941

@jamie-pate
Copy link
Contributor

@jamie-pate jamie-pate commented on 5ccc941 Jul 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this documented as a breaking change? Any scenes that inherit from imported scenes nose their modifications to imported nodes on re-import.

e.g. we have an imported scene where there is a debug meshinstance that we set visible=false in the scene that inherits from a .dae file..
In order to preserve this we need to change the name of the node in the inherited .tscn file from "mesh" to "DoorLeft-rigid'
(we didn't use "DoorLeft-colonly" because it's a rigid body, but it's not supposed to show the mesh)

@fire

Please sign in to comment.