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:
Kelsi 2026-05-06 00:51:22 -07:00
parent ca630c4e87
commit 1c3307a0b6
3 changed files with 14 additions and 1 deletions

View file

@ -287,6 +287,8 @@ public:
bool hasModel(uint32_t modelId) const;
bool loadModel(const pipeline::M2Model& model, uint32_t modelId);
/** Force-remove a model and all its GPU resources. Caller must ensure no instances reference it. */
void unloadModel(uint32_t modelId);
/** Mark a loaded model as a spell effect (full-brightness particles, no collision). */
void markModelAsSpellEffect(uint32_t modelId);