Skip to content

Commit

Permalink
Merge pull request #41007 from fire/gltf-vertex-colors
Browse files Browse the repository at this point in the history
Use the vertex colors by default in gltf.
  • Loading branch information
akien-mga authored Sep 28, 2020
2 parents b07f020 + 43424e1 commit b7066ef
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions editor/import/editor_scene_importer_gltf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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"];
Expand Down

0 comments on commit b7066ef

Please sign in to comment.