MeshLibrary's SceneConverter will also processes the navigation layers for the items.

This commit is contained in:
Relintai 2023-09-05 12:25:26 +02:00
parent dfb5323cc1
commit 5331ac9b85

View File

@ -172,6 +172,7 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library,
Ref<NavigationMesh> navigation_mesh; Ref<NavigationMesh> navigation_mesh;
Transform navigation_mesh_transform; Transform navigation_mesh_transform;
uint32_t navigation_layers = 1;
for (int j = 0; j < mi->get_child_count(); j++) { for (int j = 0; j < mi->get_child_count(); j++) {
Node *child2 = mi->get_child(j); Node *child2 = mi->get_child(j);
if (!Object::cast_to<NavigationMeshInstance>(child2)) { if (!Object::cast_to<NavigationMeshInstance>(child2)) {
@ -180,12 +181,14 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library,
NavigationMeshInstance *sb = Object::cast_to<NavigationMeshInstance>(child2); NavigationMeshInstance *sb = Object::cast_to<NavigationMeshInstance>(child2);
navigation_mesh = sb->get_navigation_mesh(); navigation_mesh = sb->get_navigation_mesh();
navigation_mesh_transform = sb->get_transform(); navigation_mesh_transform = sb->get_transform();
navigation_layers = sb->get_navigation_layers();
if (!navigation_mesh.is_null()) { if (!navigation_mesh.is_null()) {
break; break;
} }
} }
if (!navigation_mesh.is_null()) { if (!navigation_mesh.is_null()) {
p_library->set_item_navigation_mesh(id, navigation_mesh); p_library->set_item_navigation_mesh(id, navigation_mesh);
p_library->set_item_navigation_layers(id, navigation_layers);
p_library->set_item_navigation_mesh_transform(id, navigation_mesh_transform); p_library->set_item_navigation_mesh_transform(id, navigation_mesh_transform);
} }
} }