From b53b8ecca0e7690d8ddffbcad21d229851d5205d Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Mon, 3 Feb 2025 09:26:37 +1100 Subject: add /hotreload --- source/base/StarAssets.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source/base/StarAssets.cpp') diff --git a/source/base/StarAssets.cpp b/source/base/StarAssets.cpp index ecd2068..7db8efe 100644 --- a/source/base/StarAssets.cpp +++ b/source/base/StarAssets.cpp @@ -348,6 +348,13 @@ Assets::~Assets() { m_workerThreads.clear(); } +void Assets::hotReload() const { + MutexLocker assetsLocker(m_assetsMutex); + m_assetsCache.clear(); + m_queue.clear(); + m_framesSpecifications.clear(); +} + StringList Assets::assetSources() const { MutexLocker assetsLocker(m_assetsMutex); return m_assetSources; @@ -779,6 +786,11 @@ void Assets::workerMain() { if (m_stopThreads) break; + { + RecursiveMutexLocker luaLocker(m_luaMutex); + as(m_luaEngine.get())->collectGarbage(); + } + MutexLocker assetsLocker(m_assetsMutex); AssetId assetId; -- cgit v1.2.3