1
Fork 0
mirror of https://github.com/redstrate/Novus.git synced 2025-04-26 05:37:46 +00:00

Fix model switching in armoury

This commit is contained in:
Joshua Goins 2023-12-09 15:55:33 -05:00
parent 82abee1d74
commit b50a058d86
2 changed files with 18 additions and 8 deletions

View file

@ -348,14 +348,23 @@ void GearView::updatePart()
}
for (auto &queuedRemoval : queuedGearRemovals) {
mdlPart->removeModel(queuedRemoval.mdl);
loadedGears.erase(std::remove_if(loadedGears.begin(),
loadedGears.end(),
[queuedRemoval](const LoadedGear &other) {
return queuedRemoval.info == other.info;
}),
loadedGears.end());
auto it = std::find_if(loadedGears.cbegin(), loadedGears.cend(), [queuedRemoval](const LoadedGear &other) {
return queuedRemoval.info == other.info;
});
if (it != loadedGears.cend()) {
mdlPart->removeModel((*it).mdl);
loadedGears.erase(std::remove_if(loadedGears.begin(),
loadedGears.end(),
[queuedRemoval](const LoadedGear &other) {
return queuedRemoval.info == other.info;
}),
loadedGears.end());
}
}
queuedGearAdditions.clear();
queuedGearRemovals.clear();
}
if (face) {

View file

@ -278,9 +278,10 @@ void MDLPart::removeModel(const physis_MDL &mdl)
models.erase(std::remove_if(models.begin(),
models.end(),
[mdl](const RenderModel &other) {
return mdl.lods == other.model.lods;
return mdl.p_ptr == other.model.p_ptr;
}),
models.end());
Q_EMIT modelChanged();
}
#include "moc_mdlpart.cpp"