From 408939862b6eea4c2d52e6138871d4bb0d493d2d Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 7 Feb 2025 02:17:40 +0100 Subject: [PATCH] Add an option to display only the file part of image name. --- profiler/src/profiler/TracyView.hpp | 1 + profiler/src/profiler/TracyView_Samples.cpp | 12 +++++++++++- profiler/src/profiler/TracyView_Statistics.cpp | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/profiler/src/profiler/TracyView.hpp b/profiler/src/profiler/TracyView.hpp index 9975cec2..80db0574 100644 --- a/profiler/src/profiler/TracyView.hpp +++ b/profiler/src/profiler/TracyView.hpp @@ -517,6 +517,7 @@ private: AccumulationMode m_statAccumulationMode = AccumulationMode::SelfOnly; bool m_statSampleTime = true; int m_statMode = 0; + bool m_shortImageNames = false; int m_flameMode = 0; bool m_flameSort = false; bool m_flameRunningTime = false; diff --git a/profiler/src/profiler/TracyView_Samples.cpp b/profiler/src/profiler/TracyView_Samples.cpp index 1814ee49..e1fbde4c 100644 --- a/profiler/src/profiler/TracyView_Samples.cpp +++ b/profiler/src/profiler/TracyView_Samples.cpp @@ -522,7 +522,17 @@ void View::DrawSamplesStatistics( Vector& data, int64_t timeRange, Accu ImGui::Unindent( indentVal ); } ImGui::TableNextColumn(); - TextDisabledUnformatted( imageName ); + if( m_shortImageNames ) + { + const char* end = imageName + strlen( imageName ) - 1; + while( end > imageName && *end != '/' && *end != '\\' ) end--; + if( *end == '/' || *end == '\\' ) end++; + TextDisabledUnformatted( end ); + } + else + { + TextDisabledUnformatted( imageName ); + } ImGui::TableNextColumn(); const auto baseCnt = cnt; if( cnt > 0 ) diff --git a/profiler/src/profiler/TracyView_Statistics.cpp b/profiler/src/profiler/TracyView_Statistics.cpp index bf4cec7d..849e5296 100644 --- a/profiler/src/profiler/TracyView_Statistics.cpp +++ b/profiler/src/profiler/TracyView_Statistics.cpp @@ -474,6 +474,8 @@ void View::DrawStatistics() { TextDisabledUnformatted( "Image" ); ImGui::SameLine(); + ToggleButton( ICON_FA_SCISSORS, m_shortImageNames ); + ImGui::SameLine(); m_statisticsImageFilter.Draw( ICON_FA_FILTER "###imageFilter", 200 ); ImGui::SameLine(); if( ImGui::BeginCombo( "###imageCombo", nullptr, ImGuiComboFlags_NoPreview | ImGuiComboFlags_HeightLarge ) )