| 42 | {} |
| 43 | |
| 44 | void addFile(const vfs::FileInfo& fileInfo) |
| 45 | { |
| 46 | const std::string ddsPrefix = "dds/"; |
| 47 | std::string fullPath = fileInfo.fullPath(); |
| 48 | |
| 49 | // Sort into the tree and set the values |
| 50 | addPath(fullPath, [&](wxutil::TreeModel::Row& row, const std::string& path, |
| 51 | const std::string& leafName, bool isFolder) |
| 52 | { |
| 53 | // The map expressions don't need any file extensions |
| 54 | auto imageFilePath = os::removeExtension(path); |
| 55 | |
| 56 | // Cut off the dds prefix, it won't be valid when set in a material |
| 57 | if (string::istarts_with(path, ddsPrefix)) |
| 58 | { |
| 59 | imageFilePath = imageFilePath.substr(ddsPrefix.length()); |
| 60 | } |
| 61 | |
| 62 | bool isCubeMapTexture = false; |
| 63 | |
| 64 | // For cubemaps, cut off the suffixes |
| 65 | if (string::istarts_with(imageFilePath, "env/")) |
| 66 | { |
| 67 | auto underscorePos = imageFilePath.find_last_of('_'); |
| 68 | |
| 69 | if (underscorePos != std::string::npos) |
| 70 | { |
| 71 | auto suffix = imageFilePath.substr(underscorePos); |
| 72 | string::to_lower(suffix); |
| 73 | |
| 74 | if (_cubemapSuffixes.count(suffix) != 0) |
| 75 | { |
| 76 | imageFilePath = imageFilePath.substr(0, imageFilePath.length() - suffix.length()); |
| 77 | isCubeMapTexture = true; |
| 78 | } |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | row[_columns.iconAndName] = wxVariant(wxDataViewIconText(leafName, isFolder ? _folderIcon : _fileIcon)); |
| 83 | row[_columns.leafName] = leafName; |
| 84 | row[_columns.fullName] = imageFilePath; |
| 85 | row[_columns.isFolder] = isFolder; |
| 86 | row[_columns.isFavourite] = false; |
| 87 | row[_columns.isCubeMapTexture] = isCubeMapTexture; |
| 88 | |
| 89 | row.SendItemAdded(); |
| 90 | }); |
| 91 | } |
| 92 | }; |
| 93 | |
| 94 | ImageFilePopulator::ImageFilePopulator(const ImageFileSelector::Columns& columns) : |
no test coverage detected