mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-22 14:36:35 +00:00
Add a python extension function to access picked location. Refs #2065
This commit is contained in:
@@ -667,6 +667,15 @@ bounds parameters will be clamped to the available subresources.
|
||||
)");
|
||||
virtual void GotoLocation(uint32_t x, uint32_t y) = 0;
|
||||
|
||||
DOCUMENT(R"(Returns the currently selected texel location in the current texture.
|
||||
|
||||
If no location is currently selected or there is no current texture, this will return ``(-1, -1)``.
|
||||
|
||||
:return: The currently picked pixel location.
|
||||
:rtype: Tuple[int,int]
|
||||
)");
|
||||
virtual rdcpair<int32_t, int32_t> GetPickedLocation() = 0;
|
||||
|
||||
DOCUMENT(R"(Return the currently selected texture overlay.
|
||||
|
||||
:return: The currently selected texture overlay.
|
||||
|
||||
@@ -1815,6 +1815,7 @@ void TextureViewer::UI_UpdateChannels()
|
||||
|
||||
INVOKE_MEMFN(RT_UpdateAndDisplay);
|
||||
INVOKE_MEMFN(RT_UpdateVisualRange);
|
||||
UI_UpdateStatusText();
|
||||
}
|
||||
|
||||
void TextureViewer::SetupTextureTabs()
|
||||
@@ -3791,6 +3792,30 @@ void TextureViewer::on_locationGoto_clicked()
|
||||
ShowGotoPopup();
|
||||
}
|
||||
|
||||
rdcpair<int32_t, int32_t> TextureViewer::GetPickedLocation()
|
||||
{
|
||||
TextureDescription *texptr = GetCurrentTexture();
|
||||
|
||||
if(texptr)
|
||||
{
|
||||
QPoint p = m_PickedPoint;
|
||||
|
||||
p.setX(p.x() >> (int)m_TexDisplay.subresource.mip);
|
||||
p.setY(p.y() >> (int)m_TexDisplay.subresource.mip);
|
||||
|
||||
uint32_t mipHeight = qMax(1U, texptr->height >> (int)m_TexDisplay.subresource.mip);
|
||||
|
||||
if(ShouldFlipForGL())
|
||||
p.setY((int)(mipHeight - 1) - p.y());
|
||||
if(m_TexDisplay.flipY)
|
||||
p.setY((int)(mipHeight - 1) - p.y());
|
||||
|
||||
return {p.x(), p.y()};
|
||||
}
|
||||
|
||||
return {-1, -1};
|
||||
}
|
||||
|
||||
void TextureViewer::ShowGotoPopup()
|
||||
{
|
||||
TextureDescription *texptr = GetCurrentTexture();
|
||||
|
||||
@@ -143,6 +143,7 @@ public:
|
||||
|
||||
Subresource GetSelectedSubresource() override;
|
||||
void SetSelectedSubresource(Subresource sub) override;
|
||||
rdcpair<int32_t, int32_t> GetPickedLocation() override;
|
||||
void GotoLocation(uint32_t x, uint32_t y) override;
|
||||
DebugOverlay GetTextureOverlay() override;
|
||||
void SetTextureOverlay(DebugOverlay overlay) override;
|
||||
|
||||
Reference in New Issue
Block a user