MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / refreshSelectedModels

Function refreshSelectedModels

radiantcore/map/algorithm/Models.cpp:112–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112void 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

Callers 2

refreshSelectedModelsMethod · 0.85

Calls 5

_Function · 0.50
resetMethod · 0.45
foreachSelectedMethod · 0.45
removeModelMethod · 0.45
refreshModelMethod · 0.45

Tested by

no test coverage detected