summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-06-08 13:16:31 +0200
committerGitHub <noreply@github.com>2020-06-08 13:16:31 +0200
commitf6430eec2c39382870a433a1267df5fa695e40a9 (patch)
tree9947461d8ca1425ebdb5fce4c8e30ad99ea73f7f /editor
parent96f3e33a6b3be4404de806a21cb4706eba9dab69 (diff)
parent9175af6f1368b22d26b9fff1b4e5380f39d9dc2c (diff)
Merge pull request #39152 from abustin/fbx_mesh_compression_fix_master
Respect 'mesh compression' editor import option in Assimp and glTF importers [master]
Diffstat (limited to 'editor')
-rw-r--r--editor/import/editor_scene_importer_gltf.cpp6
-rw-r--r--editor/import/editor_scene_importer_gltf.h3
2 files changed, 8 insertions, 1 deletions
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp
index 6ffff09ce5..e340f41e3b 100644
--- a/editor/import/editor_scene_importer_gltf.cpp
+++ b/editor/import/editor_scene_importer_gltf.cpp
@@ -952,6 +952,9 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
return OK;
}
+ bool compress_vert_data = state.import_flags & IMPORT_USE_COMPRESSION;
+ uint32_t mesh_flags = compress_vert_data ? Mesh::ARRAY_COMPRESS_DEFAULT : 0;
+
Array meshes = state.json["meshes"];
for (GLTFMeshIndex i = 0; i < meshes.size(); i++) {
print_verbose("glTF: Parsing mesh: " + itos(i));
@@ -1206,7 +1209,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
}
//just add it
- mesh.mesh->add_surface_from_arrays(primitive, array, morphs);
+ mesh.mesh->add_surface_from_arrays(primitive, array, morphs, Dictionary(), mesh_flags);
if (p.has("material")) {
const int material = p["material"];
@@ -2951,6 +2954,7 @@ Node *EditorSceneImporterGLTF::import_scene(const String &p_path, uint32_t p_fla
String version = asset["version"];
+ state.import_flags = p_flags;
state.major_version = version.get_slice(".", 0).to_int();
state.minor_version = version.get_slice(".", 1).to_int();
state.use_named_skin_binds = p_flags & IMPORT_USE_NAMED_SKIN_BINDS;
diff --git a/editor/import/editor_scene_importer_gltf.h b/editor/import/editor_scene_importer_gltf.h
index eee978ce16..d45410fa57 100644
--- a/editor/import/editor_scene_importer_gltf.h
+++ b/editor/import/editor_scene_importer_gltf.h
@@ -279,6 +279,9 @@ class EditorSceneImporterGLTF : public EditorSceneImporter {
Map<GLTFNodeIndex, Node *> scene_nodes;
+ // EditorSceneImporter::ImportFlags
+ uint32_t import_flags;
+
~GLTFState() {
for (int i = 0; i < nodes.size(); i++) {
memdelete(nodes[i]);