mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 14:29:03 +02:00
more correct reload AvatarEntityData from settings
This commit is contained in:
parent
0ed936520d
commit
ec384d7dbb
3 changed files with 28 additions and 23 deletions
|
@ -6783,7 +6783,8 @@ void Application::clearDomainOctreeDetails() {
|
||||||
DependencyManager::get<TextureCache>()->clearUnusedResources();
|
DependencyManager::get<TextureCache>()->clearUnusedResources();
|
||||||
DependencyManager::get<recording::ClipCache>()->clearUnusedResources();
|
DependencyManager::get<recording::ClipCache>()->clearUnusedResources();
|
||||||
|
|
||||||
getMyAvatar()->setAvatarEntityDataChanged(true);
|
// we just deleted all of MyAvatar's AvatarEntities so we flag it to reload from settings
|
||||||
|
getMyAvatar()->rememberToReloadOfAvatarEntityDataFromSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::domainURLChanged(QUrl domainURL) {
|
void Application::domainURLChanged(QUrl domainURL) {
|
||||||
|
|
|
@ -1443,8 +1443,10 @@ void MyAvatar::updateAvatarEntity(const QUuid& entityID, const EntityItemPropert
|
||||||
// TODO? handle this case?
|
// TODO? handle this case?
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// TODO: remember this entity and its properties, so we can save to settings
|
||||||
} else {
|
} else {
|
||||||
// TODO: propagate changes to entity
|
// TODO: propagate changes to entity
|
||||||
|
// TODO: and remember these changes so we can save to settings
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1474,7 +1476,7 @@ void MyAvatar::updateAvatarEntities() {
|
||||||
// - ClientTraitsHandler::sendChangedTraitsToMixer sends the entity bytes to the mixer which relays them to other interfaces
|
// - ClientTraitsHandler::sendChangedTraitsToMixer sends the entity bytes to the mixer which relays them to other interfaces
|
||||||
// - AvatarHashMap::processBulkAvatarTraits on other interfaces calls avatar->processTraitInstace
|
// - AvatarHashMap::processBulkAvatarTraits on other interfaces calls avatar->processTraitInstace
|
||||||
// - AvatarData::processTraitInstance calls updateAvatarEntity, which sets _avatarEntityDataChanged = true
|
// - AvatarData::processTraitInstance calls updateAvatarEntity, which sets _avatarEntityDataChanged = true
|
||||||
// - (My)Avatar::simulate notices _avatarEntityDataChanged and here we are...
|
// - (My)Avatar::simulate calls updateAvatarEntities every frame and here we are...
|
||||||
|
|
||||||
// AVATAR ENTITY DELETE FLOW
|
// AVATAR ENTITY DELETE FLOW
|
||||||
// - EntityScriptingInterface::deleteEntity calls _myAvatar->clearAvatarEntity() for deleted avatar entities
|
// - EntityScriptingInterface::deleteEntity calls _myAvatar->clearAvatarEntity() for deleted avatar entities
|
||||||
|
@ -1483,28 +1485,26 @@ void MyAvatar::updateAvatarEntities() {
|
||||||
// - AvatarHashMap::processBulkAvatarTraits on other interfaces calls avatar->processDeletedTraitInstace
|
// - AvatarHashMap::processBulkAvatarTraits on other interfaces calls avatar->processDeletedTraitInstace
|
||||||
// - AvatarData::processDeletedTraitInstance calls clearAvatarEntity
|
// - AvatarData::processDeletedTraitInstance calls clearAvatarEntity
|
||||||
// - AvatarData::clearAvatarEntity sets _avatarEntityDataChanged = true and adds the ID to the detached list
|
// - AvatarData::clearAvatarEntity sets _avatarEntityDataChanged = true and adds the ID to the detached list
|
||||||
// - Avatar::simulate notices _avatarEntityDataChanged and here we are...
|
// - Avatar::simulate calls updateAvatarEntities every frame and here we are...
|
||||||
|
|
||||||
if (!_avatarEntityDataChanged) {
|
if (_reloadAvatarEntityDataFromSettings) {
|
||||||
return;
|
|
||||||
|
if (getID().isNull() ||
|
||||||
|
getID() == AVATAR_SELF_ID ||
|
||||||
|
DependencyManager::get<NodeList>()->getSessionUUID() == QUuid()) {
|
||||||
|
// wait until MyAvatar and this Node gets an ID before doing this. Otherwise, various things go wrong --
|
||||||
|
// things get their parent fixed up from AVATAR_SELF_ID to a null uuid which means "no parent".
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto treeRenderer = DependencyManager::get<EntityTreeRenderer>();
|
||||||
|
EntityTreePointer entityTree = treeRenderer ? treeRenderer->getTree() : nullptr;
|
||||||
|
if (!entityTree) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
loadAvatarEntityDataFromSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getID().isNull() ||
|
|
||||||
getID() == AVATAR_SELF_ID ||
|
|
||||||
DependencyManager::get<NodeList>()->getSessionUUID() == QUuid()) {
|
|
||||||
// wait until MyAvatar and this Node gets an ID before doing this. Otherwise, various things go wrong --
|
|
||||||
// things get their parent fixed up from AVATAR_SELF_ID to a null uuid which means "no parent".
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto treeRenderer = DependencyManager::get<EntityTreeRenderer>();
|
|
||||||
EntityTreePointer entityTree = treeRenderer ? treeRenderer->getTree() : nullptr;
|
|
||||||
if (!entityTree) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
loadAvatarEntityDataFromSettings();
|
|
||||||
setAvatarEntityDataChanged(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1547,6 +1547,7 @@ void MyAvatar::loadAvatarEntityDataFromSettings() {
|
||||||
_avatarEntityData.clear();
|
_avatarEntityData.clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
_reloadAvatarEntityDataFromSettings = false;
|
||||||
int numEntities = _avatarEntityCountSetting.get(0);
|
int numEntities = _avatarEntityCountSetting.get(0);
|
||||||
if (numEntities == 0) {
|
if (numEntities == 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -1588,7 +1589,7 @@ void MyAvatar::loadAvatarEntityDataFromSettings() {
|
||||||
// use the entity to build the data payload
|
// use the entity to build the data payload
|
||||||
OctreeElement::AppendState appendState = entity->appendEntityData(&packetData, params, extra);
|
OctreeElement::AppendState appendState = entity->appendEntityData(&packetData, params, extra);
|
||||||
if (appendState == OctreeElement::COMPLETED) {
|
if (appendState == OctreeElement::COMPLETED) {
|
||||||
// only remember an AvatarEntity that successfully loads
|
// only remember an AvatarEntity that successfully loads and can be packed
|
||||||
QByteArray tempArray = QByteArray::fromRawData((const char*)packetData.getUncompressedData(), packetData.getUncompressedSize());
|
QByteArray tempArray = QByteArray::fromRawData((const char*)packetData.getUncompressedData(), packetData.getUncompressedSize());
|
||||||
storeAvatarEntityDataPayload(entityID, tempArray);
|
storeAvatarEntityDataPayload(entityID, tempArray);
|
||||||
_avatarEntitiesAsPropertiesStrings[entityID] = _avatarEntityDataSettings[i].get();
|
_avatarEntitiesAsPropertiesStrings[entityID] = _avatarEntityDataSettings[i].get();
|
||||||
|
@ -2089,6 +2090,7 @@ void MyAvatar::removeWearableAvatarEntities() {
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantList MyAvatar::getAvatarEntitiesVariant() {
|
QVariantList MyAvatar::getAvatarEntitiesVariant() {
|
||||||
|
// NOTE: this method is NOT efficient
|
||||||
QVariantList avatarEntitiesData;
|
QVariantList avatarEntitiesData;
|
||||||
QScriptEngine scriptEngine;
|
QScriptEngine scriptEngine;
|
||||||
auto treeRenderer = DependencyManager::get<EntityTreeRenderer>();
|
auto treeRenderer = DependencyManager::get<EntityTreeRenderer>();
|
||||||
|
|
|
@ -1188,6 +1188,7 @@ public:
|
||||||
|
|
||||||
glm::vec3 getNextPosition() { return _goToPending ? _goToPosition : getWorldPosition(); }
|
glm::vec3 getNextPosition() { return _goToPending ? _goToPosition : getWorldPosition(); }
|
||||||
void updateAvatarEntities() override;
|
void updateAvatarEntities() override;
|
||||||
|
void rememberToReloadOfAvatarEntityDataFromSettings() { _reloadAvatarEntityDataFromSettings = true; }
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Create a new grab.
|
* Create a new grab.
|
||||||
|
@ -1927,6 +1928,7 @@ private:
|
||||||
bool _haveReceivedHeightLimitsFromDomain { false };
|
bool _haveReceivedHeightLimitsFromDomain { false };
|
||||||
int _disableHandTouchCount { 0 };
|
int _disableHandTouchCount { 0 };
|
||||||
bool _skeletonModelLoaded { false };
|
bool _skeletonModelLoaded { false };
|
||||||
|
bool _reloadAvatarEntityDataFromSettings { true };
|
||||||
|
|
||||||
Setting::Handle<QString> _dominantHandSetting;
|
Setting::Handle<QString> _dominantHandSetting;
|
||||||
Setting::Handle<float> _headPitchSetting;
|
Setting::Handle<float> _headPitchSetting;
|
||||||
|
|
Loading…
Reference in a new issue