diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 00bb474f..553da072 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -693,6 +693,7 @@ bool View::DrawImpl() } m_callstackBuzzAnim.Update( io.DeltaTime ); + m_callstackTreeBuzzAnim.Update( io.DeltaTime ); return keepOpen; } @@ -6496,6 +6497,7 @@ void View::DrawMemory() if( ImGui::TreeNode( "Call stack tree" ) ) { ImGui::TextDisabled( "Press ctrl key to display allocation info tooltip." ); + ImGui::TextDisabled( "Right click on file name to open source file." ); auto& mem = m_worker.GetMemData(); auto tree = GetCallstackFrameTree( mem ); @@ -6509,7 +6511,7 @@ void View::DrawMemory() ImGui::End(); } -void View::DrawFrameTreeLevel( std::vector& tree, int& idx ) const +void View::DrawFrameTreeLevel( std::vector& tree, int& idx ) { auto& io = ImGui::GetIO(); @@ -6574,10 +6576,32 @@ void View::DrawFrameTreeLevel( std::vector& tree, int& idx ) ImGui::EndTooltip(); } - if( v.allocExclusive != v.allocInclusive ) + float indentVal = 0.f; + if( m_callstackTreeBuzzAnim.Match( idx ) ) + { + const auto time = m_callstackTreeBuzzAnim.Time(); + indentVal = sin( time * 60.f ) * 10.f * time; + ImGui::SameLine( 0, ImGui::GetStyle().ItemSpacing.x + indentVal ); + } + else { ImGui::SameLine(); - ImGui::TextDisabled( "%s:%i", m_worker.GetString( frame->file ), frame->line ); + } + ImGui::TextDisabled( "%s:%i", m_worker.GetString( frame->file ), frame->line ); + if( ImGui::IsItemClicked( 1 ) ) + { + if( FileExists( m_worker.GetString( frame->file ) ) ) + { + SetTextEditorFile( m_worker.GetString( frame->file ), frame->line ); + } + else + { + m_callstackTreeBuzzAnim.Enable( idx, 0.5f ); + } + } + + if( v.allocExclusive != v.allocInclusive ) + { ImGui::SameLine(); ImGui::TextColored( ImVec4( 0.4, 0.4, 0.1, 1.0 ), "I:" ); ImGui::SameLine(); diff --git a/server/TracyView.hpp b/server/TracyView.hpp index a6d9bc2d..60433e51 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -103,7 +103,7 @@ private: void ListMemData( T ptr, T end, std::function DrawAddress, const char* id = nullptr ); std::vector GetCallstackFrameTree( const MemData& mem ) const; - void DrawFrameTreeLevel( std::vector& tree, int& idx ) const; + void DrawFrameTreeLevel( std::vector& tree, int& idx ); void DrawInfoWindow(); void DrawZoneInfoWindow(); @@ -238,6 +238,7 @@ private: Namespace m_namespace; Animation m_zoomAnim; BuzzAnim m_callstackBuzzAnim; + BuzzAnim m_callstackTreeBuzzAnim; Vector m_zoneInfoStack; Vector m_gpuInfoStack;