mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 09:17:29 +02:00
Merge pull request #4547 from ZappoMan/preloadOnImport
fix issue with preload not being called on import
This commit is contained in:
commit
e5637a1f28
4 changed files with 19 additions and 4 deletions
|
@ -101,7 +101,7 @@ void EntityTreeRenderer::init() {
|
||||||
_lastAvatarPosition = _viewState->getAvatarPosition() + glm::vec3((float)TREE_SCALE);
|
_lastAvatarPosition = _viewState->getAvatarPosition() + glm::vec3((float)TREE_SCALE);
|
||||||
|
|
||||||
connect(entityTree, &EntityTree::deletingEntity, this, &EntityTreeRenderer::deletingEntity);
|
connect(entityTree, &EntityTree::deletingEntity, this, &EntityTreeRenderer::deletingEntity);
|
||||||
connect(entityTree, &EntityTree::addingEntity, this, &EntityTreeRenderer::checkAndCallPreload);
|
connect(entityTree, &EntityTree::addingEntity, this, &EntityTreeRenderer::addingEntity);
|
||||||
connect(entityTree, &EntityTree::entityScriptChanging, this, &EntityTreeRenderer::entitySciptChanging);
|
connect(entityTree, &EntityTree::entityScriptChanging, this, &EntityTreeRenderer::entitySciptChanging);
|
||||||
connect(entityTree, &EntityTree::changingEntityID, this, &EntityTreeRenderer::changingEntityID);
|
connect(entityTree, &EntityTree::changingEntityID, this, &EntityTreeRenderer::changingEntityID);
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,6 @@ QScriptValue EntityTreeRenderer::loadEntityScript(EntityItem* entity, bool isPre
|
||||||
|
|
||||||
if (isPending && isPreload && isURL) {
|
if (isPending && isPreload && isURL) {
|
||||||
_waitingOnPreload.insert(url, entityID);
|
_waitingOnPreload.insert(url, entityID);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto scriptCache = DependencyManager::get<ScriptCache>();
|
auto scriptCache = DependencyManager::get<ScriptCache>();
|
||||||
|
@ -941,6 +940,10 @@ void EntityTreeRenderer::deletingEntity(const EntityItemID& entityID) {
|
||||||
_entityScripts.remove(entityID);
|
_entityScripts.remove(entityID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EntityTreeRenderer::addingEntity(const EntityItemID& entityID) {
|
||||||
|
checkAndCallPreload(entityID);
|
||||||
|
}
|
||||||
|
|
||||||
void EntityTreeRenderer::entitySciptChanging(const EntityItemID& entityID) {
|
void EntityTreeRenderer::entitySciptChanging(const EntityItemID& entityID) {
|
||||||
if (_tree && !_shuttingDown) {
|
if (_tree && !_shuttingDown) {
|
||||||
checkAndCallUnload(entityID);
|
checkAndCallUnload(entityID);
|
||||||
|
|
|
@ -105,6 +105,7 @@ signals:
|
||||||
void leaveEntity(const EntityItemID& entityItemID);
|
void leaveEntity(const EntityItemID& entityItemID);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void addingEntity(const EntityItemID& entityID);
|
||||||
void deletingEntity(const EntityItemID& entityID);
|
void deletingEntity(const EntityItemID& entityID);
|
||||||
void changingEntityID(const EntityItemID& oldEntityID, const EntityItemID& newEntityID);
|
void changingEntityID(const EntityItemID& oldEntityID, const EntityItemID& newEntityID);
|
||||||
void entitySciptChanging(const EntityItemID& entityID);
|
void entitySciptChanging(const EntityItemID& entityID);
|
||||||
|
|
|
@ -405,6 +405,7 @@ void EntityTree::handleAddEntityResponse(const QByteArray& packet) {
|
||||||
EntityItemID creatorTokenVersion = searchEntityID.convertToCreatorTokenVersion();
|
EntityItemID creatorTokenVersion = searchEntityID.convertToCreatorTokenVersion();
|
||||||
EntityItemID knownIDVersion = searchEntityID.convertToKnownIDVersion();
|
EntityItemID knownIDVersion = searchEntityID.convertToKnownIDVersion();
|
||||||
|
|
||||||
|
_changedEntityIDs[creatorTokenVersion] = knownIDVersion;
|
||||||
|
|
||||||
// First look for and find the "viewed version" of this entity... it's possible we got
|
// First look for and find the "viewed version" of this entity... it's possible we got
|
||||||
// the known ID version sent to us between us creating our local version, and getting this
|
// the known ID version sent to us between us creating our local version, and getting this
|
||||||
|
@ -592,6 +593,9 @@ EntityItem* EntityTree::findEntityByEntityItemID(const EntityItemID& entityID) /
|
||||||
EntityTreeElement* containingElement = getContainingElement(entityID);
|
EntityTreeElement* containingElement = getContainingElement(entityID);
|
||||||
if (containingElement) {
|
if (containingElement) {
|
||||||
foundEntity = containingElement->getEntityWithEntityItemID(entityID);
|
foundEntity = containingElement->getEntityWithEntityItemID(entityID);
|
||||||
|
if (!foundEntity && _changedEntityIDs.contains(entityID)) {
|
||||||
|
foundEntity = containingElement->getEntityWithEntityItemID(_changedEntityIDs[entityID]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return foundEntity;
|
return foundEntity;
|
||||||
}
|
}
|
||||||
|
@ -958,6 +962,12 @@ EntityTreeElement* EntityTree::getContainingElement(const EntityItemID& entityIt
|
||||||
creatorTokenOnly.isKnownID = false;
|
creatorTokenOnly.isKnownID = false;
|
||||||
element = _entityToElementMap.value(creatorTokenOnly);
|
element = _entityToElementMap.value(creatorTokenOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we still didn't find the entity, but the ID was in our changed entityIDs, search for the new ID version
|
||||||
|
if (!element && _changedEntityIDs.contains(entityItemID)) {
|
||||||
|
element = getContainingElement(_changedEntityIDs[entityItemID]);
|
||||||
|
}
|
||||||
|
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -195,6 +195,7 @@ private:
|
||||||
EntityItemFBXService* _fbxService;
|
EntityItemFBXService* _fbxService;
|
||||||
|
|
||||||
QHash<EntityItemID, EntityTreeElement*> _entityToElementMap;
|
QHash<EntityItemID, EntityTreeElement*> _entityToElementMap;
|
||||||
|
QHash<EntityItemID, EntityItemID> _changedEntityIDs;
|
||||||
|
|
||||||
EntitySimulation* _simulation;
|
EntitySimulation* _simulation;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue