diff --git a/modules/fbx/data/fbx_mesh_data.cpp b/modules/fbx/data/fbx_mesh_data.cpp index 2afc69dcf5c..1c4c9957e2a 100644 --- a/modules/fbx/data/fbx_mesh_data.cpp +++ b/modules/fbx/data/fbx_mesh_data.cpp @@ -115,7 +115,7 @@ struct SurfaceData { Array morphs; }; -MeshInstance *FBXMeshData::create_fbx_mesh(const ImportState &state, const FBXDocParser::MeshGeometry *mesh_geometry, const FBXDocParser::Model *model) { +MeshInstance *FBXMeshData::create_fbx_mesh(const ImportState &state, const FBXDocParser::MeshGeometry *mesh_geometry, const FBXDocParser::Model *model, bool use_compression) { // todo: make this just use a uint64_t FBX ID this is a copy of our original materials unfortunately. const std::vector &material_lookup = model->GetMaterials(); @@ -389,7 +389,8 @@ MeshInstance *FBXMeshData::create_fbx_mesh(const ImportState &state, const FBXDo mesh->add_surface_from_arrays( Mesh::PRIMITIVE_TRIANGLES, surface->surface_tool->commit_to_arrays(), - surface->morphs); + surface->morphs, + use_compression ? Mesh::ARRAY_COMPRESS_DEFAULT : 0); if (surface->material.is_valid()) { mesh->surface_set_name(in_mesh_surface_id, surface->material->get_name()); diff --git a/modules/fbx/data/fbx_mesh_data.h b/modules/fbx/data/fbx_mesh_data.h index 8fd98ef9cbb..41bc27ee929 100644 --- a/modules/fbx/data/fbx_mesh_data.h +++ b/modules/fbx/data/fbx_mesh_data.h @@ -75,7 +75,7 @@ struct FBXMeshData : Reference { // translate fbx mesh data from document context to FBX Mesh Geometry Context bool valid_weight_indexes = false; - MeshInstance *create_fbx_mesh(const ImportState &state, const FBXDocParser::MeshGeometry *mesh_geometry, const FBXDocParser::Model *model); + MeshInstance *create_fbx_mesh(const ImportState &state, const FBXDocParser::MeshGeometry *mesh_geometry, const FBXDocParser::Model *model, bool use_compression); void gen_weight_info(Ref st, int vertex_id) const; diff --git a/modules/fbx/editor_scene_importer_fbx.cpp b/modules/fbx/editor_scene_importer_fbx.cpp index 9093facc90f..378f9a0d849 100644 --- a/modules/fbx/editor_scene_importer_fbx.cpp +++ b/modules/fbx/editor_scene_importer_fbx.cpp @@ -639,7 +639,7 @@ Spatial *EditorSceneImporterFBX::_generate_scene( } // mesh node, mesh id - mesh_node = mesh_data_precached->create_fbx_mesh(state, mesh_geometry, fbx_node->fbx_model); + mesh_node = mesh_data_precached->create_fbx_mesh(state, mesh_geometry, fbx_node->fbx_model, (p_flags & IMPORT_USE_COMPRESSION) != 0); if (!state.MeshNodes.has(mesh_id)) { state.MeshNodes.insert(mesh_id, fbx_node); }