diff --git a/qrenderdoc/Code/CaptureContext.cpp b/qrenderdoc/Code/CaptureContext.cpp index 9d1af8ce1..cd344aa68 100644 --- a/qrenderdoc/Code/CaptureContext.cpp +++ b/qrenderdoc/Code/CaptureContext.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -732,6 +733,19 @@ void CaptureContext::LoadCapture(const rdcstr &captureFile, const ReplayOptions [this]() { return !m_LoadInProgress; }, [this]() { return UpdateLoadProgress(); }); + if(local) + { + m_Watcher = new QFileSystemWatcher({captureFile}, GetMainWindow()->Widget()); + + QObject::connect(m_Watcher, &QFileSystemWatcher::fileChanged, [this]() { + Replay().AsyncInvoke([this](IReplayController *r) { + r->FileChanged(); + r->SetFrameEvent(m_EventID, true); + GUIInvoke::call(GetMainWindow()->Widget(), [this]() { RefreshUIStatus({}, true, true); }); + }); + }); + } + #if defined(RELEASE) ANALYTIC_ADDAVG(Performance.LoadTime, double(loadTimer.nsecsElapsed() * 1.0e-9)); #endif @@ -1274,6 +1288,9 @@ void CaptureContext::CloseCapture() if(!m_CaptureLoaded) return; + delete m_Watcher; + m_Watcher = NULL; + delete m_RGP; m_RGP = NULL; diff --git a/qrenderdoc/Code/CaptureContext.h b/qrenderdoc/Code/CaptureContext.h index 996836ac8..bef4c6167 100644 --- a/qrenderdoc/Code/CaptureContext.h +++ b/qrenderdoc/Code/CaptureContext.h @@ -55,6 +55,8 @@ class ResourceInspector; class ShaderViewer; class MiniQtHelper; +class QFileSystemWatcher; + class CaptureContext : public ICaptureContext, IExtensionManager { Q_DECLARE_TR_FUNCTIONS(CaptureContext); @@ -405,6 +407,8 @@ private: MiniQtHelper *m_QtHelper = NULL; + QFileSystemWatcher *m_Watcher = NULL; + // Windows MainWindow *m_MainWindow = NULL; EventBrowser *m_EventBrowser = NULL;