From b3cec5a4cf191ca08ce418872f7465c0d12035ac Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 8 Sep 2025 17:29:08 +0100 Subject: [PATCH] Add a helper to clear the set of debug messages from python --- qrenderdoc/Code/CaptureContext.cpp | 11 +++++++++++ qrenderdoc/Code/CaptureContext.h | 1 + qrenderdoc/Code/Interface/QRDInterface.h | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/qrenderdoc/Code/CaptureContext.cpp b/qrenderdoc/Code/CaptureContext.cpp index 89421c768..f16dbd6b0 100644 --- a/qrenderdoc/Code/CaptureContext.cpp +++ b/qrenderdoc/Code/CaptureContext.cpp @@ -1743,6 +1743,17 @@ void CaptureContext::AddMessages(const rdcarray &msgs) } } +void CaptureContext::ClearMessages() +{ + m_UnreadMessageCount = 0; + m_DebugMessages.clear(); + + if(m_DebugMessageView) + { + GUIInvoke::call(m_DebugMessageView, [this]() { m_DebugMessageView->RefreshMessageList(); }); + } +} + void CaptureContext::SetNotes(const rdcstr &key, const rdcstr &contents) { // ignore no-op changes diff --git a/qrenderdoc/Code/CaptureContext.h b/qrenderdoc/Code/CaptureContext.h index 1cc4ca4e1..a1e2445bb 100644 --- a/qrenderdoc/Code/CaptureContext.h +++ b/qrenderdoc/Code/CaptureContext.h @@ -195,6 +195,7 @@ public: int32_t UnreadMessageCount() override { return m_UnreadMessageCount; } void MarkMessagesRead() override { m_UnreadMessageCount = 0; } void AddMessages(const rdcarray &msgs) override; + void ClearMessages() override; void ConnectToRemoteServer(RemoteHost host) override; diff --git a/qrenderdoc/Code/Interface/QRDInterface.h b/qrenderdoc/Code/Interface/QRDInterface.h index 8f73a8fb6..df7b73809 100644 --- a/qrenderdoc/Code/Interface/QRDInterface.h +++ b/qrenderdoc/Code/Interface/QRDInterface.h @@ -2335,6 +2335,11 @@ as well as messages generated during replay and analysis. )"); virtual void AddMessages(const rdcarray &msgs) = 0; + DOCUMENT(R"(Clear the currently stored messages, and mark all as unread. This can be used in +combination with :meth:`DebugMessages` and :meth:`AddMessages` to filter the current set of messages. +)"); + virtual void ClearMessages() = 0; + DOCUMENT(R"(Retrieve the contents for a given notes field. Examples of fields are: