mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 00:50:40 +00:00
Add annotation display in resource inspector and as standalone panel
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include <QTimer>
|
||||
#include "Code/Resources.h"
|
||||
#include "Code/pyrenderdoc/PythonContext.h"
|
||||
#include "Widgets/AnnotationDisplay.h"
|
||||
#include "Windows/APIInspector.h"
|
||||
#include "Windows/BufferViewer.h"
|
||||
#include "Windows/CommentView.h"
|
||||
@@ -2261,6 +2262,18 @@ IAPIInspector *CaptureContext::GetAPIInspector()
|
||||
return m_APIInspector;
|
||||
}
|
||||
|
||||
IAnnotationViewer *CaptureContext::GetAnnotationViewer()
|
||||
{
|
||||
if(m_AnnotationViewer)
|
||||
return m_AnnotationViewer;
|
||||
|
||||
m_AnnotationViewer = new AnnotationDisplay(*this, true, m_MainWindow);
|
||||
m_AnnotationViewer->setObjectName(lit("annotationViewer"));
|
||||
setupDockWindow(m_AnnotationViewer, true);
|
||||
|
||||
return m_AnnotationViewer;
|
||||
}
|
||||
|
||||
ITextureViewer *CaptureContext::GetTextureViewer()
|
||||
{
|
||||
if(m_TextureViewer)
|
||||
@@ -2426,6 +2439,11 @@ void CaptureContext::ShowAPIInspector()
|
||||
m_MainWindow->showAPIInspector();
|
||||
}
|
||||
|
||||
void CaptureContext::ShowAnnotationViewer()
|
||||
{
|
||||
m_MainWindow->showAnnotationViewer();
|
||||
}
|
||||
|
||||
void CaptureContext::ShowTextureViewer()
|
||||
{
|
||||
m_MainWindow->showTextureViewer();
|
||||
@@ -2692,6 +2710,10 @@ QWidget *CaptureContext::CreateBuiltinWindow(const rdcstr &objectName)
|
||||
{
|
||||
return GetAPIInspector()->Widget();
|
||||
}
|
||||
else if(objectName == "annotationViewer")
|
||||
{
|
||||
return GetAnnotationViewer()->Widget();
|
||||
}
|
||||
else if(objectName == "capDialog")
|
||||
{
|
||||
return GetCaptureDialog()->Widget();
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
class MainWindow;
|
||||
class EventBrowser;
|
||||
class APIInspector;
|
||||
class AnnotationDisplay;
|
||||
class PipelineStateViewer;
|
||||
class BufferViewer;
|
||||
class TextureViewer;
|
||||
@@ -212,6 +213,7 @@ public:
|
||||
IMainWindow *GetMainWindow() override;
|
||||
IEventBrowser *GetEventBrowser() override;
|
||||
IAPIInspector *GetAPIInspector() override;
|
||||
IAnnotationViewer *GetAnnotationViewer() override;
|
||||
ITextureViewer *GetTextureViewer() override;
|
||||
IBufferViewer *GetMeshPreview() override;
|
||||
IPipelineStateViewer *GetPipelineViewer() override;
|
||||
@@ -227,6 +229,7 @@ public:
|
||||
|
||||
bool HasEventBrowser() override { return m_EventBrowser != NULL; }
|
||||
bool HasAPIInspector() override { return m_APIInspector != NULL; }
|
||||
bool HasAnnotationViewer() override { return m_AnnotationViewer != NULL; }
|
||||
bool HasTextureViewer() override { return m_TextureViewer != NULL; }
|
||||
bool HasPipelineViewer() override { return m_PipelineViewer != NULL; }
|
||||
bool HasMeshPreview() override { return m_MeshPreview != NULL; }
|
||||
@@ -241,6 +244,7 @@ public:
|
||||
bool HasResourceInspector() override { return m_ResourceInspector != NULL; }
|
||||
void ShowEventBrowser() override;
|
||||
void ShowAPIInspector() override;
|
||||
void ShowAnnotationViewer() override;
|
||||
void ShowTextureViewer() override;
|
||||
void ShowMeshPreview() override;
|
||||
void ShowPipelineViewer() override;
|
||||
@@ -435,6 +439,7 @@ private:
|
||||
MainWindow *m_MainWindow = NULL;
|
||||
EventBrowser *m_EventBrowser = NULL;
|
||||
APIInspector *m_APIInspector = NULL;
|
||||
AnnotationDisplay *m_AnnotationViewer = NULL;
|
||||
TextureViewer *m_TextureViewer = NULL;
|
||||
BufferViewer *m_MeshPreview = NULL;
|
||||
PipelineStateViewer *m_PipelineViewer = NULL;
|
||||
|
||||
@@ -592,6 +592,16 @@ DECLARE_REFLECTION_STRUCT(BugReport);
|
||||
":type: str"); \
|
||||
CONFIG_SETTING_VAL(public, QString, rdcstr, ExternalTool_RadeonGPUProfiler, "") \
|
||||
\
|
||||
DOCUMENT( \
|
||||
"``True`` if the user has had the annotation viewer displayed when hidden upon loading a" \
|
||||
"capture that contains annotations. After this is set to true, we won't auto-show the \n" \
|
||||
"annotation viewer automatically.\n" \
|
||||
"\n" \
|
||||
"Defaults to ``False``." \
|
||||
"" \
|
||||
":type: bool"); \
|
||||
CONFIG_SETTING_VAL(public, bool, bool, Annotations_HasAutoShown, false) \
|
||||
\
|
||||
DOCUMENT( \
|
||||
"``True`` if the user has seen the first tip, which should always be shown first before " \
|
||||
"randomising.\n" \
|
||||
|
||||
@@ -504,6 +504,36 @@ protected:
|
||||
|
||||
DECLARE_REFLECTION_STRUCT(IAPIInspector);
|
||||
|
||||
DOCUMENT(R"(The annotation viewer window.
|
||||
|
||||
This window is retrieved by calling :meth:`CaptureContext.GetAnnotationViewer`.
|
||||
)");
|
||||
struct IAnnotationViewer
|
||||
{
|
||||
DOCUMENT(R"(Retrieves the PySide2 QWidget for this :class:`AnnotationViewer` if PySide2 is available, or otherwise
|
||||
returns a unique opaque pointer that can be passed back to any RenderDoc functions expecting a
|
||||
QWidget.
|
||||
|
||||
:return: Return the widget handle, either a PySide2 handle or an opaque handle.
|
||||
:rtype: QWidget
|
||||
)");
|
||||
virtual QWidget *Widget() = 0;
|
||||
|
||||
DOCUMENT(R"(Expand the annotation view to reveal a given path and select it.
|
||||
|
||||
If the path does not exist, this will do nothing.
|
||||
|
||||
:param str keyPath: The key path to the annotation.
|
||||
)");
|
||||
virtual void RevealAnnotation(const rdcstr &keyPath) = 0;
|
||||
|
||||
protected:
|
||||
IAnnotationViewer() = default;
|
||||
~IAnnotationViewer() = default;
|
||||
};
|
||||
|
||||
DECLARE_REFLECTION_STRUCT(IAnnotationViewer);
|
||||
|
||||
DOCUMENT(R"(Specifies a pipeline stage for the :class:`PipelineStateViewer`.
|
||||
|
||||
.. data:: VertexInput
|
||||
@@ -2505,6 +2535,13 @@ on the UI thread.
|
||||
)");
|
||||
virtual IAPIInspector *GetAPIInspector() = 0;
|
||||
|
||||
DOCUMENT(R"(Retrieve the current singleton :class:`AnnotationViewer`.
|
||||
|
||||
:return: The current window, which is created (but not shown) it there wasn't one open.
|
||||
:rtype: AnnotationViewer
|
||||
)");
|
||||
virtual IAnnotationViewer *GetAnnotationViewer() = 0;
|
||||
|
||||
DOCUMENT(R"(Retrieve the current singleton :class:`TextureViewer`.
|
||||
|
||||
:return: The current window, which is created (but not shown) it there wasn't one open.
|
||||
@@ -2603,6 +2640,13 @@ on the UI thread.
|
||||
)");
|
||||
virtual bool HasAPIInspector() = 0;
|
||||
|
||||
DOCUMENT(R"(Check if there is a current :class:`AnnotationViewer` open.
|
||||
|
||||
:return: ``True`` if there is a window open.
|
||||
:rtype: bool
|
||||
)");
|
||||
virtual bool HasAnnotationViewer() = 0;
|
||||
|
||||
DOCUMENT(R"(Check if there is a current :class:`TextureViewer` open.
|
||||
|
||||
:return: ``True`` if there is a window open.
|
||||
@@ -2691,6 +2735,9 @@ on the UI thread.
|
||||
virtual void ShowEventBrowser() = 0;
|
||||
DOCUMENT("Raise the current :class:`APIInspector`, showing it in the default place if needed.");
|
||||
virtual void ShowAPIInspector() = 0;
|
||||
DOCUMENT(
|
||||
"Raise the current :class:`AnnotationViewer`, showing it in the default place if needed.");
|
||||
virtual void ShowAnnotationViewer() = 0;
|
||||
DOCUMENT("Raise the current :class:`TextureViewer`, showing it in the default place if needed.");
|
||||
virtual void ShowTextureViewer() = 0;
|
||||
DOCUMENT(R"(Raise the current mesh previewing :class:`BufferViewer`, showing it in the default
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2025 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#include "AnnotationDisplay.h"
|
||||
#include <QHeaderView>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
AnnotationDisplay::AnnotationDisplay(ICaptureContext &ctx, bool standalone, QWidget *parent)
|
||||
: QFrame(parent), m_Ctx(ctx), m_Standalone(standalone)
|
||||
{
|
||||
m_Tree = new RDTreeWidget(this);
|
||||
|
||||
m_Tree->setColumns({lit("Key"), tr("Value")});
|
||||
m_Tree->header()->resizeSection(0, 150);
|
||||
m_Tree->setFont(Formatter::PreferredFont());
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
layout->setSpacing(0);
|
||||
layout->setMargin(m_Standalone ? 3 : 0);
|
||||
|
||||
layout->addWidget(m_Tree);
|
||||
|
||||
if(!m_Standalone)
|
||||
{
|
||||
setFrameStyle(QFrame::NoFrame);
|
||||
m_Tree->setFrameStyle(QFrame::NoFrame);
|
||||
}
|
||||
|
||||
setWindowTitle(tr("Annotation Viewer"));
|
||||
|
||||
if(m_Standalone)
|
||||
m_Ctx.AddCaptureViewer(this);
|
||||
}
|
||||
|
||||
AnnotationDisplay::~AnnotationDisplay()
|
||||
{
|
||||
if(m_Standalone)
|
||||
m_Ctx.RemoveCaptureViewer(this);
|
||||
}
|
||||
|
||||
void AnnotationDisplay::RevealAnnotation(const rdcstr &keyPath)
|
||||
{
|
||||
if(m_Annotation)
|
||||
{
|
||||
const SDObject *obj = m_Annotation->FindChildByKeyPath(keyPath);
|
||||
|
||||
RDTreeWidgetItem *item = m_Items[obj];
|
||||
if(item)
|
||||
{
|
||||
m_Tree->setSelectedItem(item);
|
||||
m_Tree->scrollToItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AnnotationDisplay::OnCaptureLoaded()
|
||||
{
|
||||
setAnnotationObject(NULL);
|
||||
}
|
||||
|
||||
void AnnotationDisplay::OnCaptureClosed()
|
||||
{
|
||||
setAnnotationObject(NULL);
|
||||
}
|
||||
|
||||
void AnnotationDisplay::OnSelectedEventChanged(uint32_t eventId)
|
||||
{
|
||||
APIEvent ev = m_Ctx.GetEventBrowser()->GetAPIEventForEID(eventId);
|
||||
|
||||
setAnnotationObject(ev.annotations);
|
||||
}
|
||||
|
||||
void AnnotationDisplay::addStructuredChildren(RDTreeWidgetItem *parent, const SDObject &parentObj)
|
||||
{
|
||||
for(const SDObject *obj : parentObj)
|
||||
{
|
||||
if(obj->type.flags & SDTypeFlags::Hidden)
|
||||
continue;
|
||||
|
||||
if(obj->name.beginsWith("__"))
|
||||
continue;
|
||||
|
||||
QVariant name;
|
||||
|
||||
if(parentObj.type.basetype == SDBasic::Array)
|
||||
name = QFormatStr("[%1]").arg(parent->childCount());
|
||||
else
|
||||
name = obj->name;
|
||||
|
||||
RDTreeWidgetItem *item = new RDTreeWidgetItem({name, QString()});
|
||||
|
||||
m_Items[obj] = item;
|
||||
item->setTag(QVariant::fromValue((void *)obj));
|
||||
|
||||
if(obj->type.basetype == SDBasic::Chunk || obj->type.basetype == SDBasic::Struct ||
|
||||
obj->type.basetype == SDBasic::Array)
|
||||
addStructuredChildren(item, *obj);
|
||||
else
|
||||
item->setText(1, SDObject2Variant(obj, false));
|
||||
|
||||
parent->addChild(item);
|
||||
}
|
||||
}
|
||||
|
||||
void AnnotationDisplay::setAnnotationObject(const SDObject *annotation)
|
||||
{
|
||||
m_Tree->updateExpansion(m_Expansion, 0);
|
||||
|
||||
m_Annotation = annotation;
|
||||
|
||||
m_Items.clear();
|
||||
m_Tree->invisibleRootItem()->clear();
|
||||
|
||||
if(m_Annotation)
|
||||
{
|
||||
m_Tree->beginUpdate();
|
||||
addStructuredChildren(m_Tree->invisibleRootItem(), *m_Annotation);
|
||||
m_Tree->endUpdate();
|
||||
}
|
||||
|
||||
m_Tree->applyExpansion(m_Expansion, 0);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2025 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Extended/RDTreeWidget.h"
|
||||
|
||||
// can be used either as an embedded control in the resource inspector, or as a separate panel for
|
||||
// monitoring API events
|
||||
class AnnotationDisplay : public QFrame, public IAnnotationViewer, public ICaptureViewer
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AnnotationDisplay(ICaptureContext &ctx, bool standalone, QWidget *parent = 0);
|
||||
~AnnotationDisplay();
|
||||
|
||||
// IAnnotationViewer
|
||||
QWidget *Widget() override { return this; }
|
||||
void RevealAnnotation(const rdcstr &keyPath) override;
|
||||
|
||||
// ICaptureViewer
|
||||
void OnCaptureLoaded() override;
|
||||
void OnCaptureClosed() override;
|
||||
void OnSelectedEventChanged(uint32_t eventId) override;
|
||||
void OnEventChanged(uint32_t eventId) override {}
|
||||
|
||||
void setAnnotationObject(const SDObject *annotation);
|
||||
|
||||
signals:
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
ICaptureContext &m_Ctx;
|
||||
const SDObject *m_Annotation = NULL;
|
||||
|
||||
RDTreeWidget *m_Tree;
|
||||
RDTreeViewExpansionState m_Expansion;
|
||||
|
||||
// if this is a standalone viewer or not
|
||||
bool m_Standalone = false;
|
||||
|
||||
QMap<const SDObject *, RDTreeWidgetItem *> m_Items;
|
||||
|
||||
void addStructuredChildren(RDTreeWidgetItem *parent, const SDObject &parentObj);
|
||||
};
|
||||
@@ -2271,6 +2271,15 @@ void MainWindow::OnCaptureLoaded()
|
||||
|
||||
if(m_Ctx.HasEventBrowser())
|
||||
ToolWindowManager::raiseToolWindow(m_Ctx.GetEventBrowser()->Widget());
|
||||
|
||||
// the first time we load a capture with annotations, show/bring the annotation viewer to the
|
||||
// front. After that, if the user hides it we won't show it again.
|
||||
if(!m_Ctx.Config().Annotations_HasAutoShown && m_Ctx.FrameInfo().containsAnnotations)
|
||||
{
|
||||
m_Ctx.ShowAnnotationViewer();
|
||||
m_Ctx.Config().Annotations_HasAutoShown = true;
|
||||
ToolWindowManager::raiseToolWindow(m_Ctx.GetAnnotationViewer()->Widget());
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::OnCaptureClosed()
|
||||
@@ -2500,6 +2509,38 @@ void MainWindow::on_action_API_Inspector_triggered()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_action_Annotation_Viewer_triggered()
|
||||
{
|
||||
QWidget *annotViewer = m_Ctx.GetAnnotationViewer()->Widget();
|
||||
|
||||
if(ui->toolWindowManager->toolWindows().contains(annotViewer))
|
||||
{
|
||||
ToolWindowManager::raiseToolWindow(annotViewer);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_Ctx.HasAPIInspector() &&
|
||||
ui->toolWindowManager->toolWindows().contains(m_Ctx.GetAPIInspector()->Widget()))
|
||||
{
|
||||
ToolWindowManager::AreaReference ref(
|
||||
ToolWindowManager::AddTo, ui->toolWindowManager->areaOf(m_Ctx.GetAPIInspector()->Widget()));
|
||||
ui->toolWindowManager->addToolWindow(annotViewer, ref);
|
||||
}
|
||||
else if(m_Ctx.HasEventBrowser() &&
|
||||
ui->toolWindowManager->toolWindows().contains(m_Ctx.GetEventBrowser()->Widget()))
|
||||
{
|
||||
ToolWindowManager::AreaReference ref(
|
||||
ToolWindowManager::BottomOf,
|
||||
ui->toolWindowManager->areaOf(m_Ctx.GetEventBrowser()->Widget()));
|
||||
ui->toolWindowManager->addToolWindow(annotViewer, ref);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->toolWindowManager->addToolWindow(annotViewer, leftToolArea());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_action_Event_Browser_triggered()
|
||||
{
|
||||
QWidget *eventBrowser = m_Ctx.GetEventBrowser()->Widget();
|
||||
|
||||
@@ -129,6 +129,7 @@ public:
|
||||
|
||||
void showEventBrowser() { on_action_Event_Browser_triggered(); }
|
||||
void showAPIInspector() { on_action_API_Inspector_triggered(); }
|
||||
void showAnnotationViewer() { on_action_Annotation_Viewer_triggered(); }
|
||||
void showMeshPreview() { on_action_Mesh_Output_triggered(); }
|
||||
void showTextureViewer() { on_action_Texture_Viewer_triggered(); }
|
||||
void showPipelineViewer() { on_action_Pipeline_State_triggered(); }
|
||||
@@ -156,6 +157,7 @@ private slots:
|
||||
void on_action_Close_Capture_triggered();
|
||||
void on_action_Mesh_Output_triggered();
|
||||
void on_action_API_Inspector_triggered();
|
||||
void on_action_Annotation_Viewer_triggered();
|
||||
void on_action_Event_Browser_triggered();
|
||||
void on_action_Texture_Viewer_triggered();
|
||||
void on_action_Pipeline_State_triggered();
|
||||
|
||||
@@ -159,6 +159,7 @@
|
||||
<addaction name="action_Texture_Viewer"/>
|
||||
<addaction name="action_Pipeline_State"/>
|
||||
<addaction name="action_API_Inspector"/>
|
||||
<addaction name="action_Annotation_Viewer"/>
|
||||
<addaction name="action_Mesh_Output"/>
|
||||
<addaction name="action_Errors_and_Warnings"/>
|
||||
<addaction name="action_Timeline"/>
|
||||
@@ -272,6 +273,11 @@
|
||||
<string>&API Inspector</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Annotation_Viewer">
|
||||
<property name="text">
|
||||
<string>A&nnotation Viewer</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Mesh_Output">
|
||||
<property name="text">
|
||||
<string>&Mesh Viewer</string>
|
||||
|
||||
@@ -671,6 +671,10 @@ struct CaptureContextInvoker : ObjectForwarder<ICaptureContext>
|
||||
{
|
||||
return InvokeRetFunction<IAPIInspector *>(&ICaptureContext::GetAPIInspector);
|
||||
}
|
||||
virtual IAnnotationViewer *GetAnnotationViewer() override
|
||||
{
|
||||
return InvokeRetFunction<IAnnotationViewer *>(&ICaptureContext::GetAnnotationViewer);
|
||||
}
|
||||
virtual ITextureViewer *GetTextureViewer() override
|
||||
{
|
||||
return InvokeRetFunction<ITextureViewer *>(&ICaptureContext::GetTextureViewer);
|
||||
@@ -728,6 +732,10 @@ struct CaptureContextInvoker : ObjectForwarder<ICaptureContext>
|
||||
{
|
||||
return InvokeRetFunction<bool>(&ICaptureContext::HasAPIInspector);
|
||||
}
|
||||
virtual bool HasAnnotationViewer() override
|
||||
{
|
||||
return InvokeRetFunction<bool>(&ICaptureContext::HasAnnotationViewer);
|
||||
}
|
||||
virtual bool HasTextureViewer() override
|
||||
{
|
||||
return InvokeRetFunction<bool>(&ICaptureContext::HasTextureViewer);
|
||||
@@ -785,6 +793,10 @@ struct CaptureContextInvoker : ObjectForwarder<ICaptureContext>
|
||||
{
|
||||
InvokeVoidFunction(&ICaptureContext::ShowAPIInspector);
|
||||
}
|
||||
virtual void ShowAnnotationViewer() override
|
||||
{
|
||||
InvokeVoidFunction(&ICaptureContext::ShowAnnotationViewer);
|
||||
}
|
||||
virtual void ShowTextureViewer() override
|
||||
{
|
||||
InvokeVoidFunction(&ICaptureContext::ShowTextureViewer);
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <QKeyEvent>
|
||||
#include <QMenu>
|
||||
#include "Code/Resources.h"
|
||||
#include "Widgets/AnnotationDisplay.h"
|
||||
#include "Widgets/Extended/RDHeaderView.h"
|
||||
#include "toolwindowmanager/ToolWindowManagerArea.h"
|
||||
#include "ui_ResourceInspector.h"
|
||||
@@ -366,6 +367,9 @@ void ResourceInspector::Inspect(ResourceId id)
|
||||
{
|
||||
ANALYTIC_SET(UIFeatures.ResourceInspect, true);
|
||||
|
||||
if(m_AnnotationView)
|
||||
m_AnnotationView->setAnnotationObject(desc->annotations);
|
||||
|
||||
SetResourceNameDisplay(m_Ctx.GetResourceName(id));
|
||||
|
||||
ui->relatedResources->beginUpdate();
|
||||
@@ -414,6 +418,8 @@ void ResourceInspector::Inspect(ResourceId id)
|
||||
{
|
||||
m_Resource = ResourceId();
|
||||
SetResourceNameDisplay(tr("No Resource Selected"));
|
||||
if(m_AnnotationView)
|
||||
m_AnnotationView->setAnnotationObject(NULL);
|
||||
}
|
||||
|
||||
ui->initChunks->setUpdatesEnabled(true);
|
||||
@@ -479,6 +485,18 @@ void ResourceInspector::OnCaptureLoaded()
|
||||
{
|
||||
ui->renameResource->setEnabled(true);
|
||||
|
||||
if(m_Ctx.FrameInfo().containsAnnotations && m_AnnotationView == NULL)
|
||||
{
|
||||
m_AnnotationView = new AnnotationDisplay(m_Ctx, false, this);
|
||||
m_AnnotationView->setWindowTitle(tr("Resource Annotations"));
|
||||
|
||||
ui->dockarea->addToolWindow(
|
||||
m_AnnotationView,
|
||||
ToolWindowManager::AreaReference(ToolWindowManager::BottomOf,
|
||||
ui->dockarea->areaOf(ui->relatedResources), 0.5f));
|
||||
ui->dockarea->setToolWindowProperties(m_AnnotationView, ToolWindowManager::HideCloseButton);
|
||||
}
|
||||
|
||||
m_ResourceModel->reset();
|
||||
m_ResourceCacheID = m_Ctx.ResourceNameCacheID();
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ class RDTreeWidgetItem;
|
||||
class ResourceListItemModel;
|
||||
class StructuredDataItemModel;
|
||||
class RichTextViewDelegate;
|
||||
class AnnotationDisplay;
|
||||
|
||||
class ResourceSorterModel : public QCollatorSortFilterProxyModel
|
||||
{
|
||||
@@ -130,4 +131,6 @@ private:
|
||||
StructuredDataItemModel *m_ChunksModel;
|
||||
RichTextViewDelegate *m_delegate;
|
||||
bool m_SplitByMarker = false;
|
||||
|
||||
AnnotationDisplay *m_AnnotationView = NULL;
|
||||
};
|
||||
|
||||
@@ -209,6 +209,7 @@ SOURCES += Code/qrenderdoc.cpp \
|
||||
Widgets/ReplayOptionsSelector.cpp \
|
||||
Widgets/TextureGoto.cpp \
|
||||
Widgets/RangeHistogram.cpp \
|
||||
Widgets/AnnotationDisplay.cpp \
|
||||
Widgets/CollapseGroupBox.cpp \
|
||||
Windows/Dialogs/TextureSaveDialog.cpp \
|
||||
Windows/Dialogs/CaptureDialog.cpp \
|
||||
@@ -296,6 +297,7 @@ HEADERS += Code/CaptureContext.h \
|
||||
Widgets/ThumbnailStrip.h \
|
||||
Widgets/ReplayOptionsSelector.h \
|
||||
Widgets/TextureGoto.h \
|
||||
Widgets/AnnotationDisplay.h \
|
||||
Widgets/RangeHistogram.h \
|
||||
Widgets/CollapseGroupBox.h \
|
||||
Windows/Dialogs/TextureSaveDialog.h \
|
||||
|
||||
@@ -647,6 +647,7 @@
|
||||
<ClCompile Include="$(IntDir)generated\moc_QRDUtils.cpp" />
|
||||
<ClCompile Include="$(IntDir)generated\moc_PipelineFlowChart.cpp" />
|
||||
<ClCompile Include="$(IntDir)generated\moc_RangeHistogram.cpp" />
|
||||
<ClCompile Include="$(IntDir)generated\moc_AnnotationDisplay.cpp" />
|
||||
<ClCompile Include="$(IntDir)generated\moc_CollapseGroupBox.cpp" />
|
||||
<ClCompile Include="$(IntDir)generated\moc_RDDoubleSpinBox.cpp" />
|
||||
<ClCompile Include="$(IntDir)generated\moc_RDSplitter.cpp" />
|
||||
@@ -727,6 +728,7 @@
|
||||
<ClCompile Include="Widgets\Extended\RDTreeWidget.cpp" />
|
||||
<ClCompile Include="Widgets\PipelineFlowChart.cpp" />
|
||||
<ClCompile Include="Widgets\RangeHistogram.cpp" />
|
||||
<ClCompile Include="Widgets\AnnotationDisplay.cpp" />
|
||||
<ClCompile Include="Widgets\Extended\RDDoubleSpinBox.cpp" />
|
||||
<ClCompile Include="Widgets\Extended\RDSplitter.cpp" />
|
||||
<ClCompile Include="Widgets\Extended\RDLabel.cpp" />
|
||||
@@ -1155,6 +1157,12 @@
|
||||
<Message>MOC %(Filename).h</Message>
|
||||
<Outputs>$(IntDir)generated\moc_%(Filename).cpp</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="Widgets\AnnotationDisplay.h">
|
||||
<AdditionalInputs>%(Fullpath);$(QtBinDir)\moc.exe;%(AdditionalInputs)</AdditionalInputs>
|
||||
<Command>"$(QtBinDir)\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(QtIncludeDir)" -I"$(QtIncludeDir)\QtWidgets" -I"$(QtIncludeDir)\QtGui" -I"$(QtIncludeDir)\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp"</Command>
|
||||
<Message>MOC %(Filename).h</Message>
|
||||
<Outputs>$(IntDir)generated\moc_%(Filename).cpp</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="Widgets\RangeHistogram.h">
|
||||
<AdditionalInputs>%(Fullpath);$(QtBinDir)\moc.exe;%(AdditionalInputs)</AdditionalInputs>
|
||||
<Command>"$(QtBinDir)\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(QtIncludeDir)" -I"$(QtIncludeDir)\QtWidgets" -I"$(QtIncludeDir)\QtGui" -I"$(QtIncludeDir)\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp"</Command>
|
||||
|
||||
@@ -771,6 +771,12 @@
|
||||
<ClCompile Include="Widgets\ComputeDebugSelector.cpp">
|
||||
<Filter>Widgets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Widgets\AnnotationDisplay.cpp">
|
||||
<Filter>Widgets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(IntDir)generated\moc_AnnotationDisplay.cpp">
|
||||
<Filter>Generated Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(IntDir)generated\moc_ProjectionGuessDialog.cpp">
|
||||
<Filter>Generated Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -1592,6 +1598,9 @@
|
||||
<CustomBuild Include="Widgets\ComputeDebugSelector.ui">
|
||||
<Filter>Widgets</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="Widgets\AnnotationDisplay.h">
|
||||
<Filter>Widgets</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="Windows\Dialogs\CameraControlsDialog.h">
|
||||
<Filter>Windows\Dialogs</Filter>
|
||||
</CustomBuild>
|
||||
|
||||
Reference in New Issue
Block a user