Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
9175af6f
Commit
9175af6f
authored
May 23, 2020
by
Alex Bustin
Committed by
Alex Bustin
May 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Respect 'mesh compression' editor import option in Assimp (ie. FBX) and glTF importers
parent
57d21ebe
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
2 deletions
+15
-2
editor_scene_importer_gltf.cpp
editor/import/editor_scene_importer_gltf.cpp
+5
-1
editor_scene_importer_gltf.h
editor/import/editor_scene_importer_gltf.h
+3
-0
editor_scene_importer_assimp.cpp
modules/assimp/editor_scene_importer_assimp.cpp
+4
-1
import_state.h
modules/assimp/import_state.h
+3
-0
No files found.
editor/import/editor_scene_importer_gltf.cpp
View file @
9175af6f
...
...
@@ -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
;
...
...
editor/import/editor_scene_importer_gltf.h
View file @
9175af6f
...
...
@@ -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
]);
...
...
modules/assimp/editor_scene_importer_assimp.cpp
View file @
9175af6f
...
...
@@ -298,6 +298,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
++
)
{
...
...
@@ -829,6 +830,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
;
...
...
@@ -1266,7 +1269,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
));
}
...
...
modules/assimp/import_state.h
View file @
9175af6f
...
...
@@ -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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment