Only display "go to parent" if there is a parent.

This commit is contained in:
Bartosz Taudul 2018-08-18 02:12:34 +02:00
parent 91c397f25c
commit 0757930521

View File

@ -3461,15 +3461,15 @@ void View::DrawZoneInfoWindow()
{ {
ZoomToZone( ev ); ZoomToZone( ev );
} }
ImGui::SameLine(); auto parent = GetZoneParent( ev );
#ifdef TRACY_EXTENDED_FONT if( parent )
if( ImGui::Button( ICON_FA_ARROW_UP " Go to parent" ) )
#else
if( ImGui::Button( "Go to parent" ) )
#endif
{ {
auto parent = GetZoneParent( ev ); ImGui::SameLine();
if( parent ) #ifdef TRACY_EXTENDED_FONT
if( ImGui::Button( ICON_FA_ARROW_UP " Go to parent" ) )
#else
if( ImGui::Button( "Go to parent" ) )
#endif
{ {
ShowZoneInfo( *parent ); ShowZoneInfo( *parent );
} }
@ -3693,7 +3693,6 @@ void View::DrawZoneInfoWindow()
ImGui::Separator(); ImGui::Separator();
std::vector<const ZoneEvent*> zoneTrace; std::vector<const ZoneEvent*> zoneTrace;
auto parent = GetZoneParent( ev );
while( parent ) while( parent )
{ {
zoneTrace.emplace_back( parent ); zoneTrace.emplace_back( parent );
@ -3811,15 +3810,15 @@ void View::DrawGpuInfoWindow()
{ {
ZoomToZone( ev ); ZoomToZone( ev );
} }
ImGui::SameLine(); auto parent = GetZoneParent( ev );
#ifdef TRACY_EXTENDED_FONT if( parent )
if( ImGui::Button( ICON_FA_ARROW_UP " Go to parent" ) )
#else
if( ImGui::Button( "Go to parent" ) )
#endif
{ {
auto parent = GetZoneParent( ev ); ImGui::SameLine();
if( parent ) #ifdef TRACY_EXTENDED_FONT
if( ImGui::Button( ICON_FA_ARROW_UP " Go to parent" ) )
#else
if( ImGui::Button( "Go to parent" ) )
#endif
{ {
ShowZoneInfo( *parent, m_gpuInfoWindowThread ); ShowZoneInfo( *parent, m_gpuInfoWindowThread );
} }
@ -3924,7 +3923,6 @@ void View::DrawGpuInfoWindow()
ImGui::Separator(); ImGui::Separator();
std::vector<const GpuEvent*> zoneTrace; std::vector<const GpuEvent*> zoneTrace;
auto parent = GetZoneParent( ev );
while( parent ) while( parent )
{ {
zoneTrace.emplace_back( parent ); zoneTrace.emplace_back( parent );