mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 19:16:56 +02:00
Revert "send attachment clears through setAvatarEntityData"
This reverts commit 25876bca63
.
This commit is contained in:
parent
8226ffb916
commit
a177e49877
3 changed files with 30 additions and 6 deletions
|
@ -151,7 +151,13 @@ bool isWearableEntity(const EntityItemPointer& entity) {
|
||||||
|
|
||||||
void AvatarBookmarks::updateAvatarEntities(const QVariantList &avatarEntities) {
|
void AvatarBookmarks::updateAvatarEntities(const QVariantList &avatarEntities) {
|
||||||
auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
myAvatar->clearAvatarEntities();
|
auto treeRenderer = DependencyManager::get<EntityTreeRenderer>();
|
||||||
|
EntityTreePointer entityTree = treeRenderer ? treeRenderer->getTree() : nullptr;
|
||||||
|
myAvatar->removeAvatarEntities([&](const QUuid& entityID) {
|
||||||
|
auto entity = entityTree->findEntityByID(entityID);
|
||||||
|
return entity && isWearableEntity(entity);
|
||||||
|
});
|
||||||
|
|
||||||
addAvatarEntities(avatarEntities);
|
addAvatarEntities(avatarEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +180,12 @@ void AvatarBookmarks::loadBookmark(const QString& bookmarkName) {
|
||||||
|
|
||||||
if (!bookmark.empty()) {
|
if (!bookmark.empty()) {
|
||||||
auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
myAvatar->clearAvatarEntities();
|
auto treeRenderer = DependencyManager::get<EntityTreeRenderer>();
|
||||||
|
EntityTreePointer entityTree = treeRenderer ? treeRenderer->getTree() : nullptr;
|
||||||
|
myAvatar->removeAvatarEntities([&](const QUuid& entityID) {
|
||||||
|
auto entity = entityTree->findEntityByID(entityID);
|
||||||
|
return entity && isWearableEntity(entity);
|
||||||
|
});
|
||||||
const QString& avatarUrl = bookmark.value(ENTRY_AVATAR_URL, "").toString();
|
const QString& avatarUrl = bookmark.value(ENTRY_AVATAR_URL, "").toString();
|
||||||
myAvatar->useFullAvatarURL(avatarUrl);
|
myAvatar->useFullAvatarURL(avatarUrl);
|
||||||
qCDebug(interfaceapp) << "Avatar On " << avatarUrl;
|
qCDebug(interfaceapp) << "Avatar On " << avatarUrl;
|
||||||
|
|
|
@ -1703,6 +1703,21 @@ void MyAvatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
|
||||||
emit skeletonChanged();
|
emit skeletonChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyAvatar::removeAvatarEntities(const std::function<bool(const QUuid& entityID)>& condition) {
|
||||||
|
auto treeRenderer = DependencyManager::get<EntityTreeRenderer>();
|
||||||
|
EntityTreePointer entityTree = treeRenderer ? treeRenderer->getTree() : nullptr;
|
||||||
|
if (entityTree) {
|
||||||
|
entityTree->withWriteLock([&] {
|
||||||
|
AvatarEntityMap avatarEntities = getAvatarEntityData();
|
||||||
|
for (auto entityID : avatarEntities.keys()) {
|
||||||
|
if (!condition || condition(entityID)) {
|
||||||
|
entityTree->deleteEntity(entityID, true, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QVariantList MyAvatar::getAvatarEntitiesVariant() {
|
QVariantList MyAvatar::getAvatarEntitiesVariant() {
|
||||||
QVariantList avatarEntitiesData;
|
QVariantList avatarEntitiesData;
|
||||||
QScriptEngine scriptEngine;
|
QScriptEngine scriptEngine;
|
||||||
|
@ -2099,9 +2114,7 @@ void MyAvatar::setAttachmentData(const QVector<AttachmentData>& attachmentData)
|
||||||
attachmentDataToEntityProperties(data, properties);
|
attachmentDataToEntityProperties(data, properties);
|
||||||
newEntitiesProperties.push_back(properties);
|
newEntitiesProperties.push_back(properties);
|
||||||
}
|
}
|
||||||
|
removeAvatarEntities();
|
||||||
clearAvatarEntities();
|
|
||||||
|
|
||||||
for (auto& properties : newEntitiesProperties) {
|
for (auto& properties : newEntitiesProperties) {
|
||||||
DependencyManager::get<EntityScriptingInterface>()->addEntity(properties, true);
|
DependencyManager::get<EntityScriptingInterface>()->addEntity(properties, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -931,7 +931,7 @@ public:
|
||||||
* @returns {object[]}
|
* @returns {object[]}
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE QVariantList getAvatarEntitiesVariant();
|
Q_INVOKABLE QVariantList getAvatarEntitiesVariant();
|
||||||
void clearAvatarEntities() { setAvatarEntityData(AvatarEntityMap()); }
|
void removeAvatarEntities(const std::function<bool(const QUuid& entityID)>& condition = {});
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* @function MyAvatar.isFlying
|
* @function MyAvatar.isFlying
|
||||||
|
|
Loading…
Reference in a new issue