From 771170e7b06daea4f4dbf41d52dac4d74b11a9ec Mon Sep 17 00:00:00 2001 From: Fazil Babu Date: Wed, 16 Feb 2022 19:59:51 +0530 Subject: [PATCH] Default material is assigned to meshes without material for glTF export --- modules/gltf/gltf_document.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index f555c8912d5..d79b4f6c1bc 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -5060,6 +5060,9 @@ GLTFMeshIndex GLTFDocument::_convert_mesh_to_gltf(Ref 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(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,