MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / updateCachedInfo

Method updateCachedInfo

apps/tools/Studio/StudioApp.cpp:1803–2024  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1801}
1802
1803void StudioApp::updateCachedInfo(const FileEntry& entry)
1804{
1805 if (cachedInfoFile == entry.name)
1806 return;
1807
1808 cachedInfoFile = entry.name;
1809 cachedInfoText.clear();
1810
1811 std::string resolvedPath = resolveFilePath(entry);
1812 if (resolvedPath.empty() && entry.isVirtual())
1813 {
1814 cachedInfoText = "Failed to extract file from PBO";
1815 return;
1816 }
1817
1818 std::string ext = entry.extension;
1819 std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
1820 std::ostringstream ss;
1821
1822 if (entry.isVirtual())
1823 ss << "Source: " << entry.pboPath << "\nPath in PBO: " << entry.pboFilename << "\n";
1824
1825 if (ext == ".paa" || ext == ".pac")
1826 {
1827 auto info = InspectTexture(resolvedPath);
1828 if (info.valid)
1829 {
1830 textureMipCount = info.mipmapCount;
1831 textureOrigW = info.width;
1832 textureOrigH = info.height;
1833 ss << "Type: " << info.typeName << "\n";
1834 ss << "Format: " << info.formatName << " (0x" << std::hex << info.magic << std::dec << ")\n";
1835 ss << "Size: " << info.width << "x" << info.height << "\n";
1836 ss << "Mipmaps: " << info.mipmapCount << "\n";
1837 if (info.paletteColors > 0)
1838 ss << "Palette: " << info.paletteColors << " colors\n";
1839 if (info.magic == 0xFF01)
1840 ss << "Transparency: " << (info.hasTransparentBlocks ? "yes" : "no") << "\n";
1841 }
1842 else
1843 {
1844 ss << "ERROR: Failed to inspect texture\n";
1845 }
1846 }
1847 else if (ext == ".p3d")
1848 {
1849 auto info = InspectModel(resolvedPath);
1850 if (info.valid)
1851 {
1852 modelLodCount = info.lodCount;
1853 modelLodNames.clear();
1854 for (const auto& lod : info.lods)
1855 modelLodNames.push_back(std::to_string(lod.index) + ": " + lod.name);
1856 ss << "Format: " << info.format << " v" << info.version << "\n";
1857 ss << "LODs: " << info.lodCount << "\n";
1858 for (const auto& lod : info.lods)
1859 ss << " LOD " << lod.index << ": " << lod.name << " (" << lod.points << " pts, " << lod.faces
1860 << " faces, " << lod.textures << " tex)\n";

Callers

nothing calls this directly

Calls 15

InspectTextureFunction · 0.85
InspectModelFunction · 0.85
resolveVfsDisplayPathFunction · 0.85
InspectSoundFunction · 0.85
FormatSizeFunction · 0.85
InspectTerrainFunction · 0.85
InspectPboFunction · 0.85
ParseFXYFunction · 0.85
InspectFontFunction · 0.85
InspectFileFunction · 0.85
clearMethod · 0.80
isVirtualMethod · 0.80

Tested by

no test coverage detected