From 8f891535d04fd2efd50459f9dbd5f3f3058585ba Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sun, 25 Jul 2021 01:11:24 +0200 Subject: [PATCH] Improve MeshInstance3D UV preview in the editor - Use background and line colors that match better with the rest of the editor. - Use translucent lines to make overlapping lines visible. - Tweak the error message to mention the UV layer in question when there is no UV for a defined layer. (cherry picked from commit 8cdfd2e7063e3ab569b07e22ae07615820548b02) --- editor/plugins/mesh_instance_editor_plugin.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/editor/plugins/mesh_instance_editor_plugin.cpp b/editor/plugins/mesh_instance_editor_plugin.cpp index f9090f19841..ead6fad6da6 100644 --- a/editor/plugins/mesh_instance_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_editor_plugin.cpp @@ -332,7 +332,7 @@ void MeshInstanceEditor::_create_uv_lines(int p_layer) { PoolVector uv = a[p_layer == 0 ? Mesh::ARRAY_TEX_UV : Mesh::ARRAY_TEX_UV2]; if (uv.size() == 0) { - err_dialog->set_text(TTR("Model has no UV in this layer")); + err_dialog->set_text(vformat(TTR("Mesh has no UV in layer %d."), p_layer + 1)); err_dialog->popup_centered_minsize(); return; } @@ -385,9 +385,10 @@ void MeshInstanceEditor::_debug_uv_draw() { } debug_uv->set_clip_contents(true); - debug_uv->draw_rect(Rect2(Vector2(), debug_uv->get_size()), Color(0.2, 0.2, 0.0)); + debug_uv->draw_rect(Rect2(Vector2(), debug_uv->get_size()), get_color("dark_color_3", "Editor")); debug_uv->draw_set_transform(Vector2(), 0, debug_uv->get_size()); - debug_uv->draw_multiline(uv_lines, Color(1.0, 0.8, 0.7)); + // Use a translucent color to allow overlapping triangles to be visible. + debug_uv->draw_multiline(uv_lines, get_color("mono_color", "Editor") * Color(1, 1, 1, 0.5), Math::round(EDSCALE)); } void MeshInstanceEditor::_create_outline_mesh() {