truncate model name

This commit is contained in:
Filip Sykala 2021-07-21 08:34:43 +02:00
parent 87a6c8cb73
commit 6bcc576b5f
2 changed files with 7 additions and 3 deletions

View File

@ -46,11 +46,13 @@ void GLGizmoSimplify::on_render_input_window(float x, float y, float bottom_limi
{ {
const int min_triangle_count = 4; // tetrahedron const int min_triangle_count = 4; // tetrahedron
// GUI size constants // GUI size constants
// TODO: calculate from translation text sizes
const int top_left_width = 100; const int top_left_width = 100;
const int bottom_left_width = 100; const int bottom_left_width = 100;
const int input_width = 100; const int input_width = 100;
const int input_small_width = 80; const int input_small_width = 80;
const int window_offset = 100; const int window_offset = 100;
const int max_char_in_name = 25;
int flag = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | int flag = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize |
ImGuiWindowFlags_NoCollapse; ImGuiWindowFlags_NoCollapse;
@ -85,7 +87,10 @@ void GLGizmoSimplify::on_render_input_window(float x, float y, float bottom_limi
m_imgui->text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, _L("Mesh name") + ":"); m_imgui->text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, _L("Mesh name") + ":");
ImGui::SameLine(top_left_width); ImGui::SameLine(top_left_width);
m_imgui->text(volume->name); std::string name = volume->name;
if (name.length() > max_char_in_name)
name = name.substr(0, max_char_in_name-3) + "...";
m_imgui->text(name);
m_imgui->text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, _L("Triangles") + ":"); m_imgui->text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, _L("Triangles") + ":");
ImGui::SameLine(top_left_width); ImGui::SameLine(top_left_width);
m_imgui->text(std::to_string(triangle_count)); m_imgui->text(std::to_string(triangle_count));

View File

@ -234,7 +234,6 @@ TEST_CASE("Reduce one edge by Quadric Edge Collapse", "[its]")
TEST_CASE("Simplify mesh by Quadric edge collapse to 5%", "[its]") TEST_CASE("Simplify mesh by Quadric edge collapse to 5%", "[its]")
{ {
TriangleMesh mesh = load_model("frog_legs.obj"); TriangleMesh mesh = load_model("frog_legs.obj");
//TriangleMesh mesh; load_obj("C:/Users/filip/Documents/models/scarecrow_torso.obj", &mesh);
double original_volume = its_volume(mesh.its); double original_volume = its_volume(mesh.its);
uint32_t wanted_count = mesh.its.indices.size() * 0.05; uint32_t wanted_count = mesh.its.indices.size() * 0.05;
REQUIRE_FALSE(mesh.empty()); REQUIRE_FALSE(mesh.empty());