From 88702dad39d492aab625f544bee1081a1eaad585 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 26 Jun 2026 20:00:03 +0200 Subject: [PATCH] Allow setting frame image playback limit to an annotation of range limit. --- profiler/src/profiler/TracyView_Playback.cpp | 31 ++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/profiler/src/profiler/TracyView_Playback.cpp b/profiler/src/profiler/TracyView_Playback.cpp index 000bb720..64fe56cd 100644 --- a/profiler/src/profiler/TracyView_Playback.cpp +++ b/profiler/src/profiler/TracyView_Playback.cpp @@ -254,6 +254,37 @@ void View::DrawPlayback() m_playback.range = { r0 - 1, r1 - 1 }; limitChanged = true; } + + ImGui::TextDisabled( ICON_FA_COPY " Copy from:" ); + ImGui::SameLine(); + if( SmallButtonDisablable( ICON_FA_NOTE_STICKY " Annotation", m_annotations.empty() ) ) ImGui::OpenPopup( "PlaybackRangeAnnotation" ); + if( ImGui::BeginPopup( "PlaybackRangeAnnotation" ) ) + { + for( auto& v : m_annotations ) + { + SmallColorBox( v->color ); + ImGui::SameLine(); + if( ImGui::Selectable( v->text.empty() ? "" : v->text.c_str() ) ) + { + m_playback.range = GetPlaybackFrameRangeFromTime( v->range.min, v->range.max ); + limitChanged = true; + } + ImGui::SameLine(); + ImGui::Spacing(); + ImGui::SameLine(); + ImGui::TextDisabled( "%s - %s (%s)", TimeToStringExact( v->range.min ), TimeToStringExact( v->range.max ), TimeToString( v->range.max - v->range.min ) ); + } + ImGui::EndPopup(); + } + for( auto& r : m_ranges ) + { + ImGui::SameLine(); + if( SmallButtonDisablable( r.name, r.range->min == 0 && r.range->max == 0 ) ) + { + m_playback.range = GetPlaybackFrameRangeFromTime( r.range->min, r.range->max ); + limitChanged = true; + } + } ImGui::Unindent(); if( limitChanged )