mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 22:23:50 +02:00
send attachment clears through setAvatarEntityData
This commit is contained in:
parent
eda84d2816
commit
25876bca63
3 changed files with 6 additions and 30 deletions
|
@ -151,13 +151,7 @@ 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();
|
||||||
auto treeRenderer = DependencyManager::get<EntityTreeRenderer>();
|
myAvatar->clearAvatarEntities();
|
||||||
EntityTreePointer entityTree = treeRenderer ? treeRenderer->getTree() : nullptr;
|
|
||||||
myAvatar->removeAvatarEntities([&](const QUuid& entityID) {
|
|
||||||
auto entity = entityTree->findEntityByID(entityID);
|
|
||||||
return entity && isWearableEntity(entity);
|
|
||||||
});
|
|
||||||
|
|
||||||
addAvatarEntities(avatarEntities);
|
addAvatarEntities(avatarEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,12 +174,7 @@ void AvatarBookmarks::loadBookmark(const QString& bookmarkName) {
|
||||||
|
|
||||||
if (!bookmark.empty()) {
|
if (!bookmark.empty()) {
|
||||||
auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
auto treeRenderer = DependencyManager::get<EntityTreeRenderer>();
|
myAvatar->clearAvatarEntities();
|
||||||
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,21 +1703,6 @@ 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;
|
||||||
|
@ -2114,7 +2099,9 @@ 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 removeAvatarEntities(const std::function<bool(const QUuid& entityID)>& condition = {});
|
void clearAvatarEntities() { setAvatarEntityData(AvatarEntityMap()); }
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* @function MyAvatar.isFlying
|
* @function MyAvatar.isFlying
|
||||||
|
|
Loading…
Reference in a new issue