diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-09-28 20:18:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-28 20:18:04 +0200 |
commit | b7066efe9034d1daa9f4038b5600914d440bce62 (patch) | |
tree | e74a34c2940a2fc11316af2026a95e069bf99612 | |
parent | b07f020c99545b756cf58c20e47f06bdf3247ef5 (diff) | |
parent | 43424e132173553201cd26f5aca064ad30e96bda (diff) |
Merge pull request #41007 from fire/gltf-vertex-colors
Use the vertex colors by default in gltf.
-rw-r--r-- | editor/import/editor_scene_importer_gltf.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index bb144d2ed6..8caa4aeeaf 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -1226,6 +1226,12 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) { const Ref<Material> &mat = state.materials[material]; mesh.mesh->surface_set_material(mesh.mesh->get_surface_count() - 1, mat); + } else { + Ref<StandardMaterial3D> mat; + mat.instance(); + mat->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + + mesh.mesh->surface_set_material(mesh.mesh->get_surface_count() - 1, mat); } } @@ -1386,6 +1392,7 @@ Error EditorSceneImporterGLTF::_parse_materials(GLTFState &state) { if (d.has("name")) { material->set_name(d["name"]); } + material->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); if (d.has("pbrMetallicRoughness")) { const Dictionary &mr = d["pbrMetallicRoughness"]; |