Add a context menu item in texture viewer to open in resource inspector

This commit is contained in:
baldurk
2018-02-12 17:42:56 +00:00
parent c437772271
commit d7ecf8a1b3
+9
View File
@@ -1807,10 +1807,12 @@ void TextureViewer::OpenResourceContextMenu(ResourceId id, const rdcarray<EventU
QAction showDisabled(tr("Show Disabled"), this);
QAction showEmpty(tr("Show Empty"), this);
QAction openLockedTab(tr("Open new Locked Tab"), this);
QAction openResourceInspector(tr("Open in Resource Inspector"), this);
QAction usageTitle(tr("Used:"), this);
QAction imageLayout(this);
openLockedTab.setIcon(Icons::action_hover());
openResourceInspector.setIcon(Icons::link());
showDisabled.setChecked(m_ShowDisabled);
showDisabled.setChecked(m_ShowEmpty);
@@ -1832,6 +1834,7 @@ void TextureViewer::OpenResourceContextMenu(ResourceId id, const rdcarray<EventU
{
contextMenu.addSeparator();
contextMenu.addAction(&openLockedTab);
contextMenu.addAction(&openResourceInspector);
contextMenu.addSeparator();
contextMenu.addAction(&usageTitle);
@@ -1840,6 +1843,12 @@ void TextureViewer::OpenResourceContextMenu(ResourceId id, const rdcarray<EventU
QObject::connect(&openLockedTab, &QAction::triggered, this,
&TextureViewer::texContextItem_triggered);
QObject::connect(&openResourceInspector, &QAction::triggered, [this, id]() {
m_Ctx.ShowResourceInspector();
m_Ctx.GetResourceInspector()->Inspect(id);
});
CombineUsageEvents(m_Ctx, usage,
[this, &contextMenu](uint32_t start, uint32_t end, ResourceUsage use) {
AddResourceUsageEntry(contextMenu, start, end, use);