Merge pull request #43298 from RevoluPowered/fbx-bugfix-mesh-compression-flags
FBX respect mesh compression flags
This commit is contained in:
commit
8135fdd382
3 changed files with 5 additions and 4 deletions
|
@ -115,7 +115,7 @@ struct SurfaceData {
|
||||||
Array morphs;
|
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.
|
// todo: make this just use a uint64_t FBX ID this is a copy of our original materials unfortunately.
|
||||||
const std::vector<const FBXDocParser::Material *> &material_lookup = model->GetMaterials();
|
const std::vector<const FBXDocParser::Material *> &material_lookup = model->GetMaterials();
|
||||||
|
@ -389,7 +389,8 @@ MeshInstance *FBXMeshData::create_fbx_mesh(const ImportState &state, const FBXDo
|
||||||
mesh->add_surface_from_arrays(
|
mesh->add_surface_from_arrays(
|
||||||
Mesh::PRIMITIVE_TRIANGLES,
|
Mesh::PRIMITIVE_TRIANGLES,
|
||||||
surface->surface_tool->commit_to_arrays(),
|
surface->surface_tool->commit_to_arrays(),
|
||||||
surface->morphs);
|
surface->morphs,
|
||||||
|
use_compression ? Mesh::ARRAY_COMPRESS_DEFAULT : 0);
|
||||||
|
|
||||||
if (surface->material.is_valid()) {
|
if (surface->material.is_valid()) {
|
||||||
mesh->surface_set_name(in_mesh_surface_id, surface->material->get_name());
|
mesh->surface_set_name(in_mesh_surface_id, surface->material->get_name());
|
||||||
|
|
|
@ -75,7 +75,7 @@ struct FBXMeshData : Reference {
|
||||||
// translate fbx mesh data from document context to FBX Mesh Geometry Context
|
// translate fbx mesh data from document context to FBX Mesh Geometry Context
|
||||||
bool valid_weight_indexes = false;
|
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<SurfaceTool> st, int vertex_id) const;
|
void gen_weight_info(Ref<SurfaceTool> st, int vertex_id) const;
|
||||||
|
|
||||||
|
|
|
@ -639,7 +639,7 @@ Spatial *EditorSceneImporterFBX::_generate_scene(
|
||||||
}
|
}
|
||||||
|
|
||||||
// mesh node, mesh id
|
// 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)) {
|
if (!state.MeshNodes.has(mesh_id)) {
|
||||||
state.MeshNodes.insert(mesh_id, fbx_node);
|
state.MeshNodes.insert(mesh_id, fbx_node);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue