From 7d2477026ac3efa5b15e8b105018c64eb59b3e30 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 9 Jun 2026 11:14:07 +0100 Subject: [PATCH] Add TextureViewer.GetChannelVisibility that returns a tuple * This is more natural to access and use from python. The old function could probably be removed but since we also changed the name we'll keep it. --- qrenderdoc/Code/Interface/QRDInterface.h | 7 +++++++ qrenderdoc/Code/pyrenderdoc/PythonInvokers.cpp | 4 ++++ qrenderdoc/Windows/TextureViewer.cpp | 5 +++++ qrenderdoc/Windows/TextureViewer.h | 1 + 4 files changed, 17 insertions(+) diff --git a/qrenderdoc/Code/Interface/QRDInterface.h b/qrenderdoc/Code/Interface/QRDInterface.h index 1cb850ed2..c604f621f 100644 --- a/qrenderdoc/Code/Interface/QRDInterface.h +++ b/qrenderdoc/Code/Interface/QRDInterface.h @@ -891,6 +891,13 @@ etc. )"); virtual uint32_t GetChannelVisibilityBits() = 0; + DOCUMENT(R"(Return which channels are currently displayed, as a four-component tuple. + +:return: The current channel visibility per component. +:rtype: Tuple[bool,bool,bool,bool] +)"); + virtual rdcfixedarray GetChannelVisibility() = 0; + DOCUMENT(R"(Set the visibility of each channel. :param bool red: Whether the red channel should be visible. diff --git a/qrenderdoc/Code/pyrenderdoc/PythonInvokers.cpp b/qrenderdoc/Code/pyrenderdoc/PythonInvokers.cpp index 493b208f6..9c6e80ee1 100644 --- a/qrenderdoc/Code/pyrenderdoc/PythonInvokers.cpp +++ b/qrenderdoc/Code/pyrenderdoc/PythonInvokers.cpp @@ -981,6 +981,10 @@ struct ITextureViewerInvoker : UIThreadInvoker { return InvokeRetFunction(&ITextureViewer::GetChannelVisibilityBits); } + rdcfixedarray GetChannelVisibility() + { + return InvokeRetFunction>(&ITextureViewer::GetChannelVisibility); + } void SetChannelVisibility(bool red, bool green, bool blue, bool alpha) { return InvokeVoidFunction(&ITextureViewer::SetChannelVisibility, red, green, blue, alpha); diff --git a/qrenderdoc/Windows/TextureViewer.cpp b/qrenderdoc/Windows/TextureViewer.cpp index f94da8a5f..95a7090b3 100644 --- a/qrenderdoc/Windows/TextureViewer.cpp +++ b/qrenderdoc/Windows/TextureViewer.cpp @@ -2294,6 +2294,11 @@ uint32_t TextureViewer::GetChannelVisibilityBits() return ret; } +rdcfixedarray TextureViewer::GetChannelVisibility() +{ + return {m_TexDisplay.red, m_TexDisplay.green, m_TexDisplay.blue, m_TexDisplay.alpha}; +} + void TextureViewer::SetChannelVisibility(bool red, bool green, bool blue, bool alpha) { ui->channelRed->setChecked(red); diff --git a/qrenderdoc/Windows/TextureViewer.h b/qrenderdoc/Windows/TextureViewer.h index 8326ad090..04969e982 100644 --- a/qrenderdoc/Windows/TextureViewer.h +++ b/qrenderdoc/Windows/TextureViewer.h @@ -155,6 +155,7 @@ public: void SetHistogramRange(float blackpoint, float whitepoint) override; uint32_t GetChannelVisibilityBits() override; + rdcfixedarray GetChannelVisibility() override; void SetChannelVisibility(bool red, bool green, bool blue, bool alpha) override; // ICaptureViewer