mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 16:04:34 +00:00
Allow opening source files from withing call stack tree.
This commit is contained in:
parent
4e23ce9a24
commit
4c393a2b8d
@ -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<CallstackFrameTree>& tree, int& idx ) const
|
||||
void View::DrawFrameTreeLevel( std::vector<CallstackFrameTree>& tree, int& idx )
|
||||
{
|
||||
auto& io = ImGui::GetIO();
|
||||
|
||||
@ -6574,10 +6576,32 @@ void View::DrawFrameTreeLevel( std::vector<CallstackFrameTree>& 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();
|
||||
|
@ -103,7 +103,7 @@ private:
|
||||
void ListMemData( T ptr, T end, std::function<void(T&)> DrawAddress, const char* id = nullptr );
|
||||
|
||||
std::vector<CallstackFrameTree> GetCallstackFrameTree( const MemData& mem ) const;
|
||||
void DrawFrameTreeLevel( std::vector<CallstackFrameTree>& tree, int& idx ) const;
|
||||
void DrawFrameTreeLevel( std::vector<CallstackFrameTree>& tree, int& idx );
|
||||
|
||||
void DrawInfoWindow();
|
||||
void DrawZoneInfoWindow();
|
||||
@ -238,6 +238,7 @@ private:
|
||||
Namespace m_namespace;
|
||||
Animation m_zoomAnim;
|
||||
BuzzAnim<int> m_callstackBuzzAnim;
|
||||
BuzzAnim<int> m_callstackTreeBuzzAnim;
|
||||
|
||||
Vector<const ZoneEvent*> m_zoneInfoStack;
|
||||
Vector<const GpuEvent*> m_gpuInfoStack;
|
||||
|
Loading…
Reference in New Issue
Block a user