Add a python extension function to access picked location. Refs #2065

This commit is contained in:
baldurk
2022-05-31 11:26:59 +01:00
parent 6d7d4829ee
commit f01dfbecc1
3 changed files with 35 additions and 0 deletions
+25
View File
@@ -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();