mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 17:13:51 +00:00
fix(editor): unload ghost preview model when path changes
setGhostPreview reused modelId 59999 for every preview, but loadModel returns true without doing anything when the ID is already cached. So selecting a new NPC kept the old ghost model in GPU memory and createInstance used the stale model. Added M2Renderer::unloadModel public API and call it from clearGhostPreview.
This commit is contained in:
parent
ca630c4e87
commit
1c3307a0b6
3 changed files with 14 additions and 1 deletions
|
|
@ -623,7 +623,9 @@ void EditorViewport::clearGhostPreview() {
|
|||
ghostInstanceId_ = 0;
|
||||
}
|
||||
if (ghostModelId_ != 0 && m2Renderer_) {
|
||||
// Don't unload the model — it might be used by placed objects too
|
||||
// Ghost ID is reserved for previews only — safe to unload so a path
|
||||
// change can re-load with the new model under the same ID.
|
||||
m2Renderer_->unloadModel(ghostModelId_);
|
||||
ghostModelId_ = 0;
|
||||
ghostModelPath_.clear();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue