1
0
Fork 0

Merge pull request #49458 from JFonS/fix_unwrap_xform

Rename get_parent_spatial() to get_parent_node_3d()
This commit is contained in:
Rémi Verschelde 2021-06-14 18:32:33 +02:00 committed by GitHub
commit 07b8fffa7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 6 deletions

View File

@ -20,7 +20,7 @@
Forces the transform to update. Transform changes in physics are not instant for performance reasons. Transforms are accumulated and then set. Use this if you need an up-to-date transform when doing physics operations. Forces the transform to update. Transform changes in physics are not instant for performance reasons. Transforms are accumulated and then set. Use this if you need an up-to-date transform when doing physics operations.
</description> </description>
</method> </method>
<method name="get_parent_spatial" qualifiers="const"> <method name="get_parent_node_3d" qualifiers="const">
<return type="Node3D"> <return type="Node3D">
</return> </return>
<description> <description>

View File

@ -1213,7 +1213,7 @@ void ResourceImporterScene::_generate_meshes(Node *p_node, const Dictionary &p_m
Node3D *n = src_mesh_node; Node3D *n = src_mesh_node;
while (n) { while (n) {
xf = n->get_transform() * xf; xf = n->get_transform() * xf;
n = n->get_parent_spatial(); n = n->get_parent_node_3d();
} }
Vector<uint8_t> lightmap_cache; Vector<uint8_t> lightmap_cache;

View File

@ -285,8 +285,12 @@ Transform3D Node3D::get_local_gizmo_transform() const {
} }
#endif #endif
Node3D *Node3D::get_parent_spatial() const { Node3D *Node3D::get_parent_node_3d() const {
return data.parent; if (data.top_level) {
return nullptr;
}
return Object::cast_to<Node3D>(get_parent());
} }
Transform3D Node3D::get_relative_transform(const Node *p_parent) const { Transform3D Node3D::get_relative_transform(const Node *p_parent) const {
@ -751,7 +755,7 @@ void Node3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_scale"), &Node3D::get_scale); ClassDB::bind_method(D_METHOD("get_scale"), &Node3D::get_scale);
ClassDB::bind_method(D_METHOD("set_global_transform", "global"), &Node3D::set_global_transform); ClassDB::bind_method(D_METHOD("set_global_transform", "global"), &Node3D::set_global_transform);
ClassDB::bind_method(D_METHOD("get_global_transform"), &Node3D::get_global_transform); ClassDB::bind_method(D_METHOD("get_global_transform"), &Node3D::get_global_transform);
ClassDB::bind_method(D_METHOD("get_parent_spatial"), &Node3D::get_parent_spatial); ClassDB::bind_method(D_METHOD("get_parent_node_3d"), &Node3D::get_parent_node_3d);
ClassDB::bind_method(D_METHOD("set_ignore_transform_notification", "enabled"), &Node3D::set_ignore_transform_notification); ClassDB::bind_method(D_METHOD("set_ignore_transform_notification", "enabled"), &Node3D::set_ignore_transform_notification);
ClassDB::bind_method(D_METHOD("set_as_top_level", "enable"), &Node3D::set_as_top_level); ClassDB::bind_method(D_METHOD("set_as_top_level", "enable"), &Node3D::set_as_top_level);
ClassDB::bind_method(D_METHOD("is_set_as_top_level"), &Node3D::is_set_as_top_level); ClassDB::bind_method(D_METHOD("is_set_as_top_level"), &Node3D::is_set_as_top_level);

View File

@ -125,7 +125,7 @@ public:
NOTIFICATION_LOCAL_TRANSFORM_CHANGED = 44, NOTIFICATION_LOCAL_TRANSFORM_CHANGED = 44,
}; };
Node3D *get_parent_spatial() const; Node3D *get_parent_node_3d() const;
Ref<World3D> get_world_3d() const; Ref<World3D> get_world_3d() const;