| 110 | } |
| 111 | |
| 112 | void refreshSelectedModels(bool blockScreenUpdates) |
| 113 | { |
| 114 | std::unique_ptr<radiant::ScopedLongRunningOperation> blocker; |
| 115 | |
| 116 | if (blockScreenUpdates) |
| 117 | { |
| 118 | // Disable screen updates for the scope of this function |
| 119 | blocker.reset(new radiant::ScopedLongRunningOperation(_("Reloading Models"))); |
| 120 | } |
| 121 | |
| 122 | // Find all models in the current selection |
| 123 | ModelFinder walker; |
| 124 | GlobalSelectionSystem().foreachSelected(walker); |
| 125 | |
| 126 | // Remove the selected models from the cache |
| 127 | ModelFinder::ModelPaths models = walker.getModelPaths(); |
| 128 | |
| 129 | for (const std::string& modelPath : models) |
| 130 | { |
| 131 | GlobalModelCache().removeModel(modelPath); |
| 132 | } |
| 133 | |
| 134 | // Traverse the entities and submit a refresh call |
| 135 | ModelFinder::Entities entities = walker.getEntities(); |
| 136 | |
| 137 | for (const IEntityNodePtr& entityNode : entities) |
| 138 | { |
| 139 | entityNode->refreshModel(); |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | // Reloads all entities with their model spawnarg referencing the given model path. |
| 144 | // The given model path denotes a VFS path, i.e. it is mod/game-relative |
no test coverage detected