summaryrefslogtreecommitdiff
path: root/modules/assimp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/assimp')
-rw-r--r--modules/assimp/editor_scene_importer_assimp.cpp8
-rw-r--r--modules/assimp/import_state.h3
2 files changed, 7 insertions, 4 deletions
diff --git a/modules/assimp/editor_scene_importer_assimp.cpp b/modules/assimp/editor_scene_importer_assimp.cpp
index fed54a76b7..aedc4b690a 100644
--- a/modules/assimp/editor_scene_importer_assimp.cpp
+++ b/modules/assimp/editor_scene_importer_assimp.cpp
@@ -44,7 +44,6 @@
#include <assimp/scene.h>
#include <assimp/Importer.hpp>
#include <assimp/LogStream.hpp>
-#include <string>
// move into assimp
aiBone *get_bone_by_name(const aiScene *scene, aiString bone_name) {
@@ -102,8 +101,6 @@ void EditorSceneImporterAssimp::_bind_methods() {
Node *EditorSceneImporterAssimp::import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps,
List<String> *r_missing_deps, Error *r_err) {
Assimp::Importer importer;
- std::wstring w_path = ProjectSettings::get_singleton()->globalize_path(p_path).c_str();
- std::string s_path(w_path.begin(), w_path.end());
importer.SetPropertyBool(AI_CONFIG_PP_FD_REMOVE, true);
// Cannot remove pivot points because the static mesh will be in the wrong place
importer.SetPropertyBool(AI_CONFIG_IMPORT_FBX_PRESERVE_PIVOTS, false);
@@ -299,6 +296,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
state.assimp_scene = scene;
state.max_bone_weights = p_max_bone_weights;
state.animation_player = nullptr;
+ state.import_flags = p_flags;
// populate light map
for (unsigned int l = 0; l < scene->mNumLights; l++) {
@@ -830,6 +828,8 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat
Ref<ArrayMesh> mesh;
mesh.instance();
bool has_uvs = false;
+ bool compress_vert_data = state.import_flags & IMPORT_USE_COMPRESSION;
+ uint32_t mesh_flags = compress_vert_data ? Mesh::ARRAY_COMPRESS_DEFAULT : 0;
Map<String, uint32_t> morph_mesh_string_lookup;
@@ -1267,7 +1267,7 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat
morphs[j] = array_copy;
}
- mesh->add_surface_from_arrays(primitive, array_mesh, morphs);
+ mesh->add_surface_from_arrays(primitive, array_mesh, morphs, Dictionary(), mesh_flags);
mesh->surface_set_material(i, mat);
mesh->surface_set_name(i, AssimpUtils::get_assimp_string(ai_mesh->mName));
}
diff --git a/modules/assimp/import_state.h b/modules/assimp/import_state.h
index 4a3bd17acb..ee22800ac4 100644
--- a/modules/assimp/import_state.h
+++ b/modules/assimp/import_state.h
@@ -87,6 +87,9 @@ struct ImportState {
// this means we can detect
// what bones are for other armatures
List<aiBone *> bone_stack;
+
+ // EditorSceneImporter::ImportFlags
+ uint32_t import_flags;
};
struct AssimpImageData {