Use the vertex colors by default in gltf.

This commit is contained in:
K. S. Ernest (iFire) Lee 2020-08-03 11:42:34 -07:00
parent b07f020c99
commit 43424e1321

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"];