Merge pull request #41007 from fire/gltf-vertex-colors

Use the vertex colors by default in gltf.
This commit is contained in:
Rémi Verschelde 2020-09-28 20:18:04 +02:00 committed by GitHub
commit b7066efe90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1225,6 +1225,12 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
ERR_FAIL_INDEX_V(material, state.materials.size(), ERR_FILE_CORRUPT);
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"];