diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2025-02-03 09:26:37 +1100 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2025-02-03 09:26:37 +1100 |
commit | b53b8ecca0e7690d8ddffbcad21d229851d5205d (patch) | |
tree | 5f1a8fd6d65b77870aaea78dd8fb5995611f72b3 /source/base | |
parent | 56f384a2acef619f287db700f48e8f1a3ec71e61 (diff) |
add /hotreload
Diffstat (limited to 'source/base')
-rw-r--r-- | source/base/StarAssets.cpp | 12 | ||||
-rw-r--r-- | source/base/StarAssets.hpp | 2 |
2 files changed, 14 insertions, 0 deletions
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<LuaEngine>(m_luaEngine.get())->collectGarbage(); + } + MutexLocker assetsLocker(m_assetsMutex); AssetId assetId; diff --git a/source/base/StarAssets.hpp b/source/base/StarAssets.hpp index e7b8611..6ffcb05 100644 --- a/source/base/StarAssets.hpp +++ b/source/base/StarAssets.hpp @@ -161,6 +161,8 @@ public: Assets(Settings settings, StringList assetSources); ~Assets(); + void hotReload() const; + // Returns a list of all the asset source paths used by Assets in load order. StringList assetSources() const; |