mirror of
https://github.com/lubosz/overte.git
synced 2025-08-06 03:29:41 +02:00
Merge pull request #10270 from Atlante45/fix/unload
Fix entity script unloads
This commit is contained in:
commit
ac6d4969d6
4 changed files with 9 additions and 9 deletions
|
@ -481,14 +481,14 @@ void EntityScriptServer::deletingEntity(const EntityItemID& entityID) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityScriptServer::entityServerScriptChanging(const EntityItemID& entityID, const bool reload) {
|
void EntityScriptServer::entityServerScriptChanging(const EntityItemID& entityID, bool reload) {
|
||||||
if (_entityViewer.getTree() && !_shuttingDown) {
|
if (_entityViewer.getTree() && !_shuttingDown) {
|
||||||
_entitiesScriptEngine->unloadEntityScript(entityID, true);
|
_entitiesScriptEngine->unloadEntityScript(entityID, true);
|
||||||
checkAndCallPreload(entityID, reload);
|
checkAndCallPreload(entityID, reload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityScriptServer::checkAndCallPreload(const EntityItemID& entityID, const bool reload) {
|
void EntityScriptServer::checkAndCallPreload(const EntityItemID& entityID, bool reload) {
|
||||||
if (_entityViewer.getTree() && !_shuttingDown && _entitiesScriptEngine) {
|
if (_entityViewer.getTree() && !_shuttingDown && _entitiesScriptEngine) {
|
||||||
|
|
||||||
EntityItemPointer entity = _entityViewer.getTree()->findEntityByEntityItemID(entityID);
|
EntityItemPointer entity = _entityViewer.getTree()->findEntityByEntityItemID(entityID);
|
||||||
|
|
|
@ -67,8 +67,8 @@ private:
|
||||||
|
|
||||||
void addingEntity(const EntityItemID& entityID);
|
void addingEntity(const EntityItemID& entityID);
|
||||||
void deletingEntity(const EntityItemID& entityID);
|
void deletingEntity(const EntityItemID& entityID);
|
||||||
void entityServerScriptChanging(const EntityItemID& entityID, const bool reload);
|
void entityServerScriptChanging(const EntityItemID& entityID, bool reload);
|
||||||
void checkAndCallPreload(const EntityItemID& entityID, const bool reload = false);
|
void checkAndCallPreload(const EntityItemID& entityID, bool reload = false);
|
||||||
|
|
||||||
void cleanupOldKilledListeners();
|
void cleanupOldKilledListeners();
|
||||||
|
|
||||||
|
|
|
@ -1015,11 +1015,11 @@ void EntityTreeRenderer::addEntityToScene(EntityItemPointer entity) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EntityTreeRenderer::entityScriptChanging(const EntityItemID& entityID, const bool reload) {
|
void EntityTreeRenderer::entityScriptChanging(const EntityItemID& entityID, bool reload) {
|
||||||
checkAndCallPreload(entityID, reload, true);
|
checkAndCallPreload(entityID, reload, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTreeRenderer::checkAndCallPreload(const EntityItemID& entityID, const bool reload, const bool unloadFirst) {
|
void EntityTreeRenderer::checkAndCallPreload(const EntityItemID& entityID, bool reload, bool unloadFirst) {
|
||||||
if (_tree && !_shuttingDown) {
|
if (_tree && !_shuttingDown) {
|
||||||
EntityItemPointer entity = getTree()->findEntityByEntityItemID(entityID);
|
EntityItemPointer entity = getTree()->findEntityByEntityItemID(entityID);
|
||||||
if (!entity) {
|
if (!entity) {
|
||||||
|
@ -1027,11 +1027,11 @@ void EntityTreeRenderer::checkAndCallPreload(const EntityItemID& entityID, const
|
||||||
}
|
}
|
||||||
bool shouldLoad = entity->shouldPreloadScript() && _entitiesScriptEngine;
|
bool shouldLoad = entity->shouldPreloadScript() && _entitiesScriptEngine;
|
||||||
QString scriptUrl = entity->getScript();
|
QString scriptUrl = entity->getScript();
|
||||||
if (shouldLoad && (unloadFirst || scriptUrl.isEmpty())) {
|
if ((shouldLoad && unloadFirst) || scriptUrl.isEmpty()) {
|
||||||
_entitiesScriptEngine->unloadEntityScript(entityID);
|
_entitiesScriptEngine->unloadEntityScript(entityID);
|
||||||
entity->scriptHasUnloaded();
|
entity->scriptHasUnloaded();
|
||||||
}
|
}
|
||||||
if (shouldLoad && !scriptUrl.isEmpty()) {
|
if (shouldLoad) {
|
||||||
scriptUrl = ResourceManager::normalizeURL(scriptUrl);
|
scriptUrl = ResourceManager::normalizeURL(scriptUrl);
|
||||||
_entitiesScriptEngine->loadEntityScript(entityID, scriptUrl, reload);
|
_entitiesScriptEngine->loadEntityScript(entityID, scriptUrl, reload);
|
||||||
entity->scriptHasPreloaded();
|
entity->scriptHasPreloaded();
|
||||||
|
|
|
@ -152,7 +152,7 @@ private:
|
||||||
bool applySkyboxAndHasAmbient();
|
bool applySkyboxAndHasAmbient();
|
||||||
bool applyLayeredZones();
|
bool applyLayeredZones();
|
||||||
|
|
||||||
void checkAndCallPreload(const EntityItemID& entityID, const bool reload = false, const bool unloadFirst = false);
|
void checkAndCallPreload(const EntityItemID& entityID, bool reload = false, bool unloadFirst = false);
|
||||||
|
|
||||||
QList<ModelPointer> _releasedModels;
|
QList<ModelPointer> _releasedModels;
|
||||||
RayToEntityIntersectionResult findRayIntersectionWorker(const PickRay& ray, Octree::lockType lockType,
|
RayToEntityIntersectionResult findRayIntersectionWorker(const PickRay& ray, Octree::lockType lockType,
|
||||||
|
|
Loading…
Reference in a new issue