mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 15:53:28 +02:00
more correct AvatarEntityData settings when switching domains
This commit is contained in:
parent
9d6acf007a
commit
e2d6e6f3dc
3 changed files with 22 additions and 16 deletions
|
@ -6756,8 +6756,10 @@ void Application::updateWindowTitle() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::clearDomainOctreeDetails() {
|
void Application::clearDomainOctreeDetails() {
|
||||||
|
// before we delete all entities get MyAvatar's AvatarEntityData ready
|
||||||
|
getMyAvatar()->prepareAvatarEntityDataForReload();
|
||||||
|
|
||||||
// if we're about to quit, we really don't need to do any of these things...
|
// if we're about to quit, we really don't need to do the rest of these things...
|
||||||
if (_aboutToQuit) {
|
if (_aboutToQuit) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -6785,9 +6787,6 @@ void Application::clearDomainOctreeDetails() {
|
||||||
ShaderCache::instance().clearUnusedResources();
|
ShaderCache::instance().clearUnusedResources();
|
||||||
DependencyManager::get<TextureCache>()->clearUnusedResources();
|
DependencyManager::get<TextureCache>()->clearUnusedResources();
|
||||||
DependencyManager::get<recording::ClipCache>()->clearUnusedResources();
|
DependencyManager::get<recording::ClipCache>()->clearUnusedResources();
|
||||||
|
|
||||||
// we just deleted all of MyAvatar's AvatarEntities so we flag it to reload from settings
|
|
||||||
getMyAvatar()->rememberToReloadAvatarEntityDataFromSettings();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::domainURLChanged(QUrl domainURL) {
|
void Application::domainURLChanged(QUrl domainURL) {
|
||||||
|
|
|
@ -1501,8 +1501,8 @@ void MyAvatar::updateAvatarEntities() {
|
||||||
|
|
||||||
// We collect changes to AvatarEntities and then handle them all in one spot per frame: updateAvatarEntities().
|
// We collect changes to AvatarEntities and then handle them all in one spot per frame: updateAvatarEntities().
|
||||||
// Basically this is a "transaction pattern" with an extra complication: these changes can come from two
|
// Basically this is a "transaction pattern" with an extra complication: these changes can come from two
|
||||||
// "directions" and the "authoritative source" of each direction is different, so maintain two distinct sets of
|
// "directions" and the "authoritative source" of each direction is different, so we maintain two distinct sets
|
||||||
// transaction lists;
|
// of transaction lists:
|
||||||
//
|
//
|
||||||
// The _entitiesToDelete/Add/Update lists are for changes whose "authoritative sources" are already
|
// The _entitiesToDelete/Add/Update lists are for changes whose "authoritative sources" are already
|
||||||
// correctly stored in _cachedAvatarEntityBlobs. These come from loadAvatarEntityDataFromSettings() and
|
// correctly stored in _cachedAvatarEntityBlobs. These come from loadAvatarEntityDataFromSettings() and
|
||||||
|
@ -1690,10 +1690,7 @@ bool MyAvatar::updateStaleAvatarEntityBlobs() const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<QUuid> staleBlobs;
|
std::set<QUuid> staleBlobs = std::move(_staleCachedAvatarEntityBlobs);
|
||||||
_avatarEntitiesLock.withWriteLock([&] {
|
|
||||||
staleBlobs = std::move(_staleCachedAvatarEntityBlobs);
|
|
||||||
});
|
|
||||||
int32_t numFound = 0;
|
int32_t numFound = 0;
|
||||||
for (const auto& id : staleBlobs) {
|
for (const auto& id : staleBlobs) {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
@ -1717,9 +1714,20 @@ bool MyAvatar::updateStaleAvatarEntityBlobs() const {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyAvatar::rememberToReloadAvatarEntityDataFromSettings() {
|
void MyAvatar::prepareAvatarEntityDataForReload() {
|
||||||
AvatarEntityMap emptyMap;
|
saveAvatarEntityDataToSettings();
|
||||||
setAvatarEntityData(emptyMap);
|
|
||||||
|
_avatarEntitiesLock.withWriteLock([&] {
|
||||||
|
_packedAvatarEntityData.clear();
|
||||||
|
_entitiesToDelete.clear();
|
||||||
|
_entitiesToAdd.clear();
|
||||||
|
_entitiesToUpdate.clear();
|
||||||
|
_cachedAvatarEntityBlobs.clear();
|
||||||
|
_cachedAvatarEntityBlobsToDelete.clear();
|
||||||
|
_cachedAvatarEntityBlobsToAddOrUpdate.clear();
|
||||||
|
_cachedAvatarEntityBlobUpdatesToSkip.clear();
|
||||||
|
});
|
||||||
|
|
||||||
_reloadAvatarEntityDataFromSettings = true;
|
_reloadAvatarEntityDataFromSettings = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1187,7 +1187,7 @@ public:
|
||||||
|
|
||||||
glm::vec3 getNextPosition() { return _goToPending ? _goToPosition : getWorldPosition(); }
|
glm::vec3 getNextPosition() { return _goToPending ? _goToPosition : getWorldPosition(); }
|
||||||
void updateAvatarEntities() override;
|
void updateAvatarEntities() override;
|
||||||
void rememberToReloadAvatarEntityDataFromSettings();
|
void prepareAvatarEntityDataForReload();
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Create a new grab.
|
* Create a new grab.
|
||||||
|
@ -1614,7 +1614,6 @@ signals:
|
||||||
*/
|
*/
|
||||||
void disableHandTouchForIDChanged(const QUuid& entityID, bool disable);
|
void disableHandTouchForIDChanged(const QUuid& entityID, bool disable);
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void leaveDomain();
|
void leaveDomain();
|
||||||
void updateCollisionCapsuleCache();
|
void updateCollisionCapsuleCache();
|
||||||
|
@ -1980,7 +1979,7 @@ private:
|
||||||
std::vector<QUuid> _cachedAvatarEntityBlobUpdatesToSkip;
|
std::vector<QUuid> _cachedAvatarEntityBlobUpdatesToSkip;
|
||||||
//
|
//
|
||||||
// Also these lists for tracking delayed changes to blobs and Settings
|
// Also these lists for tracking delayed changes to blobs and Settings
|
||||||
std::set<QUuid> _staleCachedAvatarEntityBlobs;
|
mutable std::set<QUuid> _staleCachedAvatarEntityBlobs;
|
||||||
//
|
//
|
||||||
// keep a ScriptEngine around so we don't have to instantiate on the fly (these are very slow to create/delete)
|
// keep a ScriptEngine around so we don't have to instantiate on the fly (these are very slow to create/delete)
|
||||||
QScriptEngine* _myScriptEngine { nullptr };
|
QScriptEngine* _myScriptEngine { nullptr };
|
||||||
|
|
Loading…
Reference in a new issue