summaryrefslogtreecommitdiff
path: root/editor/import
diff options
context:
space:
mode:
authorscurest <scurest@users.noreply.github.com>2023-01-07 16:45:28 -0600
committerscurest <scurest@users.noreply.github.com>2023-01-07 17:07:31 -0600
commit649857416dc1080d1b049da22d11a9bc20f84fc4 (patch)
tree7400257b36ee737ad664c167a85fecfb75672a55 /editor/import
parent091fa5fb7f552d2d9be01077705d3590ba0b7872 (diff)
Mark OBJ vertex colors sRGB in materials (only if has vertex colors)
Diffstat (limited to 'editor/import')
-rw-r--r--editor/import/resource_importer_obj.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp
index 5da4659767..f1fd1d5a03 100644
--- a/editor/import/resource_importer_obj.cpp
+++ b/editor/import/resource_importer_obj.cpp
@@ -373,7 +373,11 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh>> &r_meshes, bool p_
print_verbose("OBJ: Current material " + current_material + " has " + itos(material_map.has(current_material_library) && material_map[current_material_library].has(current_material)));
if (material_map.has(current_material_library) && material_map[current_material_library].has(current_material)) {
- surf_tool->set_material(material_map[current_material_library][current_material]);
+ Ref<StandardMaterial3D> &material = material_map[current_material_library][current_material];
+ if (!colors.is_empty()) {
+ material->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true);
+ }
+ surf_tool->set_material(material);
}
mesh = surf_tool->commit(mesh, mesh_flags);