mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 04:23:33 +02:00
Separate API vs. internal versions of clearAvatarEntity()
This commit is contained in:
parent
b0fee2699c
commit
71b025f7f0
8 changed files with 25 additions and 9 deletions
|
@ -298,7 +298,7 @@ void AvatarMixerClientData::processSetTraitsMessage(ReceivedMessage& message,
|
||||||
|
|
||||||
void AvatarMixerClientData::emulateDeleteEntitiesTraitsMessage(const QList<QUuid>& avatarEntityIDs) {
|
void AvatarMixerClientData::emulateDeleteEntitiesTraitsMessage(const QList<QUuid>& avatarEntityIDs) {
|
||||||
// Emulates processSetTraitsMessage() actions on behalf of an avatar whose canRezAvatarEntities permission has been removed.
|
// Emulates processSetTraitsMessage() actions on behalf of an avatar whose canRezAvatarEntities permission has been removed.
|
||||||
// The source avatar should be removing its avatar entities. However, this provides a back-up.
|
// The source avatar should be removing its avatar entities. However, using this method provides a back-up.
|
||||||
|
|
||||||
auto traitType = AvatarTraits::AvatarEntity;
|
auto traitType = AvatarTraits::AvatarEntity;
|
||||||
for (const auto& entityID : avatarEntityIDs) {
|
for (const auto& entityID : avatarEntityIDs) {
|
||||||
|
@ -311,6 +311,8 @@ void AvatarMixerClientData::emulateDeleteEntitiesTraitsMessage(const QList<QUuid
|
||||||
// to track a deleted instance but keep version information
|
// to track a deleted instance but keep version information
|
||||||
// the avatar mixer uses the negative value of the sent version
|
// the avatar mixer uses the negative value of the sent version
|
||||||
// Because there is no originating message from an avatar we enlarge the magnitude by 1.
|
// Because there is no originating message from an avatar we enlarge the magnitude by 1.
|
||||||
|
// If a user subsequently has canRezAvatarEntities permission granted, they will have to relog in order for their
|
||||||
|
// avatar entities to be visible to others.
|
||||||
instanceVersionRef = -instanceVersionRef - 1;
|
instanceVersionRef = -instanceVersionRef - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -398,7 +398,7 @@ void ScriptableAvatar::setAvatarEntityData(const AvatarEntityMap& avatarEntityDa
|
||||||
|
|
||||||
// clear deleted traits
|
// clear deleted traits
|
||||||
for (const auto& id : idsToClear) {
|
for (const auto& id : idsToClear) {
|
||||||
clearAvatarEntity(id);
|
clearAvatarEntityInternal(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,7 +408,7 @@ void ScriptableAvatar::updateAvatarEntity(const QUuid& entityID, const QByteArra
|
||||||
std::map<QUuid, EntityItemPointer>::iterator itr = _entities.find(entityID);
|
std::map<QUuid, EntityItemPointer>::iterator itr = _entities.find(entityID);
|
||||||
if (itr != _entities.end()) {
|
if (itr != _entities.end()) {
|
||||||
_entities.erase(itr);
|
_entities.erase(itr);
|
||||||
clearAvatarEntity(entityID);
|
clearAvatarEntityInternal(entityID);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -544,7 +544,7 @@ void AvatarManager::removeDeadAvatarEntities(const SetOfEntities& deadEntities)
|
||||||
QUuid entityOwnerID = entity->getOwningAvatarID();
|
QUuid entityOwnerID = entity->getOwningAvatarID();
|
||||||
AvatarSharedPointer avatar = getAvatarBySessionID(entityOwnerID);
|
AvatarSharedPointer avatar = getAvatarBySessionID(entityOwnerID);
|
||||||
if (avatar) {
|
if (avatar) {
|
||||||
avatar->clearAvatarEntity(entity->getID());
|
avatar->clearAvatarEntityInternal(entity->getID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1542,7 +1542,11 @@ void MyAvatar::clearAvatarEntity(const QUuid& entityID, bool requiresRemovalFrom
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AvatarData::clearAvatarEntity(entityID);
|
clearAvatarEntityInternal(entityID);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyAvatar::clearAvatarEntityInternal(const QUuid& entityID) {
|
||||||
|
AvatarData::clearAvatarEntityInternal(entityID);
|
||||||
|
|
||||||
if (!DependencyManager::get<NodeList>()->getThisNodeCanRezAvatarEntities()) {
|
if (!DependencyManager::get<NodeList>()->getThisNodeCanRezAvatarEntities()) {
|
||||||
// Don't delete potentially non-rezzed avatar entities from cache, otherwise they're removed from settings.
|
// Don't delete potentially non-rezzed avatar entities from cache, otherwise they're removed from settings.
|
||||||
|
@ -2596,7 +2600,7 @@ void MyAvatar::removeWornAvatarEntity(const EntityItemID& entityID) {
|
||||||
auto entity = entityTree->findEntityByID(entityID);
|
auto entity = entityTree->findEntityByID(entityID);
|
||||||
if (entity && isWearableEntity(entity)) {
|
if (entity && isWearableEntity(entity)) {
|
||||||
treeRenderer->deleteEntity(entityID);
|
treeRenderer->deleteEntity(entityID);
|
||||||
clearAvatarEntity(entityID);
|
clearAvatarEntityInternal(entityID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2710,6 +2710,9 @@ private:
|
||||||
bool findAvatarEntity(const QString& modelURL, const QString& jointName, QUuid& entityID);
|
bool findAvatarEntity(const QString& modelURL, const QString& jointName, QUuid& entityID);
|
||||||
void addAvatarEntitiesToTree();
|
void addAvatarEntitiesToTree();
|
||||||
|
|
||||||
|
// FIXME: Rename to clearAvatarEntity() once the API call is removed.
|
||||||
|
void clearAvatarEntityInternal(const QUuid& entityID) override;
|
||||||
|
|
||||||
bool cameraInsideHead(const glm::vec3& cameraPosition) const;
|
bool cameraInsideHead(const glm::vec3& cameraPosition) const;
|
||||||
|
|
||||||
void updateEyeContactTarget(float deltaTime);
|
void updateEyeContactTarget(float deltaTime);
|
||||||
|
|
|
@ -2246,7 +2246,7 @@ void AvatarData::processTraitInstance(AvatarTraits::TraitType traitType,
|
||||||
|
|
||||||
void AvatarData::processDeletedTraitInstance(AvatarTraits::TraitType traitType, AvatarTraits::TraitInstanceID instanceID) {
|
void AvatarData::processDeletedTraitInstance(AvatarTraits::TraitType traitType, AvatarTraits::TraitInstanceID instanceID) {
|
||||||
if (traitType == AvatarTraits::AvatarEntity) {
|
if (traitType == AvatarTraits::AvatarEntity) {
|
||||||
clearAvatarEntity(instanceID);
|
clearAvatarEntityInternal(instanceID);
|
||||||
} else if (traitType == AvatarTraits::Grab) {
|
} else if (traitType == AvatarTraits::Grab) {
|
||||||
clearAvatarGrabData(instanceID);
|
clearAvatarGrabData(instanceID);
|
||||||
}
|
}
|
||||||
|
@ -3034,6 +3034,10 @@ void AvatarData::updateAvatarEntity(const QUuid& entityID, const QByteArray& ent
|
||||||
|
|
||||||
void AvatarData::clearAvatarEntity(const QUuid& entityID, bool requiresRemovalFromTree) {
|
void AvatarData::clearAvatarEntity(const QUuid& entityID, bool requiresRemovalFromTree) {
|
||||||
// NOTE: requiresRemovalFromTree is unused
|
// NOTE: requiresRemovalFromTree is unused
|
||||||
|
clearAvatarEntityInternal(entityID);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AvatarData::clearAvatarEntityInternal(const QUuid& entityID) {
|
||||||
bool removedEntity = false;
|
bool removedEntity = false;
|
||||||
_avatarEntitiesLock.withWriteLock([this, &removedEntity, &entityID] {
|
_avatarEntitiesLock.withWriteLock([this, &removedEntity, &entityID] {
|
||||||
removedEntity = _packedAvatarEntityData.remove(entityID);
|
removedEntity = _packedAvatarEntityData.remove(entityID);
|
||||||
|
@ -3052,7 +3056,7 @@ void AvatarData::clearAvatarEntities() {
|
||||||
avatarEntityIDs = _packedAvatarEntityData.keys();
|
avatarEntityIDs = _packedAvatarEntityData.keys();
|
||||||
});
|
});
|
||||||
for (const auto& entityID : avatarEntityIDs) {
|
for (const auto& entityID : avatarEntityIDs) {
|
||||||
clearAvatarEntity(entityID);
|
clearAvatarEntityInternal(entityID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1187,6 +1187,9 @@ public:
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE virtual void clearAvatarEntity(const QUuid& entityID, bool requiresRemovalFromTree = true);
|
Q_INVOKABLE virtual void clearAvatarEntity(const QUuid& entityID, bool requiresRemovalFromTree = true);
|
||||||
|
|
||||||
|
// FIXME: Rename to clearAvatarEntity() once the API call is removed.
|
||||||
|
virtual void clearAvatarEntityInternal(const QUuid& entityID);
|
||||||
|
|
||||||
void clearAvatarEntities();
|
void clearAvatarEntities();
|
||||||
|
|
||||||
QList<QUuid> getAvatarEntityIDs() const;
|
QList<QUuid> getAvatarEntityIDs() const;
|
||||||
|
|
|
@ -1016,7 +1016,7 @@ void EntityScriptingInterface::deleteEntity(const QUuid& id) {
|
||||||
|
|
||||||
for (auto entity : entitiesToDeleteImmediately) {
|
for (auto entity : entitiesToDeleteImmediately) {
|
||||||
if (entity->isMyAvatarEntity()) {
|
if (entity->isMyAvatarEntity()) {
|
||||||
getEntityPacketSender()->getMyAvatar()->clearAvatarEntity(entity->getID(), false);
|
getEntityPacketSender()->getMyAvatar()->clearAvatarEntityInternal(entity->getID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue