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,7 +348,12 @@ void GearView::updatePart()
} }
for (auto &queuedRemoval : queuedGearRemovals) { for (auto &queuedRemoval : queuedGearRemovals) {
mdlPart->removeModel(queuedRemoval.mdl); 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.erase(std::remove_if(loadedGears.begin(),
loadedGears.end(), loadedGears.end(),
[queuedRemoval](const LoadedGear &other) { [queuedRemoval](const LoadedGear &other) {
@ -358,6 +363,10 @@ void GearView::updatePart()
} }
} }
queuedGearAdditions.clear();
queuedGearRemovals.clear();
}
if (face) { if (face) {
const auto mdlPath = QLatin1String(physis_build_character_path(CharacterCategory::Face, *face, currentRace, currentSubrace, currentGender)); const auto mdlPath = QLatin1String(physis_build_character_path(CharacterCategory::Face, *face, currentRace, currentSubrace, currentGender));
auto mdl_data = cache.lookupFile(mdlPath); auto mdl_data = cache.lookupFile(mdlPath);

View file

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