summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2022-02-17 09:16:36 +0100
committerGitHub <noreply@github.com>2022-02-17 09:16:36 +0100
commitb890e5b8ad15265756b99d3cc38506be4fbc8152 (patch)
tree26909590ea93bc3798a9fcc7dfae084ccb6efdb2
parentd4766b2f6cab1f2e38ecfa7de3d0e68eb9139b8c (diff)
parent771170e7b06daea4f4dbf41d52dac4d74b11a9ec (diff)
Merge pull request #58189 from fazil47/gltf-export-default-material-fix
Default material is assigned to meshes without material for glTF export
-rw-r--r--modules/gltf/gltf_document.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp
index f555c8912d..d79b4f6c1b 100644
--- a/modules/gltf/gltf_document.cpp
+++ b/modules/gltf/gltf_document.cpp
@@ -5060,6 +5060,9 @@ GLTFMeshIndex GLTFDocument::_convert_mesh_to_gltf(Ref<GLTFState> state, MeshInst
String mat_name;
if (mat.is_valid()) {
mat_name = mat->get_name();
+ } else {
+ // Assign default material when no material is assigned.
+ mat = Ref<StandardMaterial3D>(memnew(StandardMaterial3D));
}
current_mesh->add_surface(import_mesh->surface_get_primitive_type(surface_i),
array, import_mesh->surface_get_blend_shape_arrays(surface_i), import_mesh->surface_get_lods(surface_i), mat,