| 1284 | } |
| 1285 | |
| 1286 | void TextureViewer::UI_OnTextureSelectionChanged(bool newAction) |
| 1287 | { |
| 1288 | TextureDescription *texptr = GetCurrentTexture(); |
| 1289 | |
| 1290 | // reset high-water mark |
| 1291 | m_HighWaterStatusLength = 0; |
| 1292 | |
| 1293 | if(texptr == NULL) |
| 1294 | return; |
| 1295 | |
| 1296 | TextureDescription &tex = *texptr; |
| 1297 | |
| 1298 | bool newtex = (m_TexDisplay.resourceId != tex.resourceId); |
| 1299 | |
| 1300 | // save settings for this current texture |
| 1301 | if(m_Ctx.Config().TextureViewer_PerTexSettings) |
| 1302 | { |
| 1303 | m_TextureSettings[m_TexDisplay.resourceId].r = ui->channelRed->isChecked(); |
| 1304 | m_TextureSettings[m_TexDisplay.resourceId].g = ui->channelGreen->isChecked(); |
| 1305 | m_TextureSettings[m_TexDisplay.resourceId].b = ui->channelBlue->isChecked(); |
| 1306 | m_TextureSettings[m_TexDisplay.resourceId].a = ui->channelAlpha->isChecked(); |
| 1307 | |
| 1308 | // save state regardless, we just don't apply it without the setting |
| 1309 | m_TextureSettings[m_TexDisplay.resourceId].flip_y = ui->flip_y->isChecked(); |
| 1310 | |
| 1311 | m_TextureSettings[m_TexDisplay.resourceId].displayType = qMax(0, ui->channels->currentIndex()); |
| 1312 | m_TextureSettings[m_TexDisplay.resourceId].customShader = ui->customShader->currentText(); |
| 1313 | |
| 1314 | m_TextureSettings[m_TexDisplay.resourceId].depth = ui->depthDisplay->isChecked(); |
| 1315 | m_TextureSettings[m_TexDisplay.resourceId].stencil = ui->stencilDisplay->isChecked(); |
| 1316 | |
| 1317 | m_TextureSettings[m_TexDisplay.resourceId].mip = qMax(0, ui->mipLevel->currentIndex()); |
| 1318 | m_TextureSettings[m_TexDisplay.resourceId].slice = qMax(0, ui->sliceFace->currentIndex()); |
| 1319 | |
| 1320 | m_TextureSettings[m_TexDisplay.resourceId].minrange = ui->rangeHistogram->blackPoint(); |
| 1321 | m_TextureSettings[m_TexDisplay.resourceId].maxrange = ui->rangeHistogram->whitePoint(); |
| 1322 | |
| 1323 | if(m_TexDisplay.typeCast != CompType::Typeless) |
| 1324 | m_TextureSettings[m_TexDisplay.resourceId].typeCast = m_TexDisplay.typeCast; |
| 1325 | } |
| 1326 | |
| 1327 | m_TexDisplay.resourceId = tex.resourceId; |
| 1328 | |
| 1329 | // interpret the texture according to the currently following type. |
| 1330 | if(!currentTextureIsLocked()) |
| 1331 | m_TexDisplay.typeCast = m_Following.GetTypeHint(m_Ctx); |
| 1332 | else |
| 1333 | m_TexDisplay.typeCast = CompType::Typeless; |
| 1334 | |
| 1335 | // if there is no such type or it isn't being followed, use the last seen interpretation |
| 1336 | if(m_TexDisplay.typeCast == CompType::Typeless && |
| 1337 | m_TextureSettings.contains(m_TexDisplay.resourceId)) |
| 1338 | m_TexDisplay.typeCast = m_TextureSettings[m_TexDisplay.resourceId].typeCast; |
| 1339 | |
| 1340 | // try to maintain the pan in the new texture. If the new texture |
| 1341 | // is approx an integer multiple of the old texture, just changing |
| 1342 | // the scale will keep everything the same. This is useful for |
| 1343 | // downsample chains and things where you're flipping back and forth |
nothing calls this directly
no test coverage detected