MapTextureBrowser::MapTextureBrowser(wxWindow* parent, int type, string texture) : BrowserWindow(parent) { // Init variables this->type = type; setSortType(1); // Set window title SetTitle("Browse Map Textures"); // Textures if (type == 0 || theGameConfiguration->mixTexFlats()) { // No texture '-' addItem(new MapTexBrowserItem("-", 0, 0), "Textures"); // Composite textures vector<TextureResource::tex_res_t> textures; theResourceManager->getAllTextures(textures, NULL); for (unsigned a = 0; a < textures.size(); a++) addItem(new MapTexBrowserItem(textures[a].tex->getName(), 0, textures[a].tex->getIndex()+1), "Textures/TEXTUREx"); // Texture namespace patches (TX_) if (theGameConfiguration->txTextures()) { vector<ArchiveEntry*> patches; theResourceManager->getAllPatchEntries(patches, NULL); for (unsigned a = 0; a < patches.size(); a++) { if (patches[a]->isInNamespace("textures")) { // Determine texture path if it's in a pk3 string path = patches[a]->getPath(); if (path.StartsWith("/textures/")) path.Remove(0, 9); else path = ""; addItem(new MapTexBrowserItem(patches[a]->getName(true), 0, a), "Textures/Textures (TX)" + path); } } } } // Flats if (type == 1 || theGameConfiguration->mixTexFlats()) { vector<ArchiveEntry*> flats; theResourceManager->getAllFlatEntries(flats, NULL); for (unsigned a = 0; a < flats.size(); a++) { ArchiveEntry* entry = flats[a]; // Determine flat path if it's in a pk3 string path = entry->getPath(); if (path.StartsWith("/flats/")) path.Remove(0, 6); else path = ""; addItem(new MapTexBrowserItem(entry->getName(true), 1, entry->getParentDir()->entryIndex(entry)), "Flats" + path); } } populateItemTree(); // Select initial texture (if any) if (!texture.IsEmpty()) selectItem(texture); }
/* MapTextureManager::buildTexInfoList * (Re)builds lists with information about all currently available * resource textures and flats *******************************************************************/ void MapTextureManager::buildTexInfoList() { // Clear tex_info.clear(); flat_info.clear(); // --- Textures --- // Composite textures vector<TextureResource::tex_res_t> textures; theResourceManager->getAllTextures(textures, NULL); for (unsigned a = 0; a < textures.size(); a++) { CTexture * tex = textures[a].tex; Archive* parent = textures[a].parent; if (tex->isExtended()) { if (S_CMPNOCASE(tex->getType(), "texture") || S_CMPNOCASE(tex->getType(), "walltexture")) tex_info.push_back(map_texinfo_t(tex->getName(), TC_TEXTURES, parent)); else if (S_CMPNOCASE(tex->getType(), "define")) tex_info.push_back(map_texinfo_t(tex->getName(), TC_HIRES, parent)); else if (S_CMPNOCASE(tex->getType(), "flat")) flat_info.push_back(map_texinfo_t(tex->getName(), TC_TEXTURES, parent)); // Ignore graphics, patches and sprites } else tex_info.push_back(map_texinfo_t(tex->getName(), TC_TEXTUREX, parent, "", tex->getIndex() + 1)); } // Texture namespace patches (TX_) if (theGameConfiguration->txTextures()) { vector<ArchiveEntry*> patches; theResourceManager->getAllPatchEntries(patches, NULL); for (unsigned a = 0; a < patches.size(); a++) { if (patches[a]->isInNamespace("textures") || patches[a]->isInNamespace("hires")) { // Determine texture path if it's in a pk3 string path = patches[a]->getPath(); if (path.StartsWith("/textures/")) path.Remove(0, 9); else if (path.StartsWith("/hires/")) path.Remove(0, 6); else path = ""; tex_info.push_back(map_texinfo_t(patches[a]->getName(true), TC_TX, patches[a]->getParent(), path)); } } } // Flats vector<ArchiveEntry*> flats; theResourceManager->getAllFlatEntries(flats, NULL); for (unsigned a = 0; a < flats.size(); a++) { ArchiveEntry* entry = flats[a]; // Determine flat path if it's in a pk3 string path = entry->getPath(); if (path.StartsWith("/flats/") || path.StartsWith("/hires/")) path.Remove(0, 6); else path = ""; flat_info.push_back(map_texinfo_t(entry->getName(true), TC_NONE, flats[a]->getParent(), path)); } }