mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 22:39:18 +02:00
don't export avatar-parent sessions IDs into json
This commit is contained in:
parent
13da20e1f0
commit
d1d2b8a4da
1 changed files with 18 additions and 7 deletions
|
@ -4030,6 +4030,9 @@ void Application::calibrateEyeTracker5Points() {
|
||||||
bool Application::exportEntities(const QString& filename, const QVector<EntityItemID>& entityIDs, const glm::vec3* givenOffset) {
|
bool Application::exportEntities(const QString& filename, const QVector<EntityItemID>& entityIDs, const glm::vec3* givenOffset) {
|
||||||
QHash<EntityItemID, EntityItemPointer> entities;
|
QHash<EntityItemID, EntityItemPointer> entities;
|
||||||
|
|
||||||
|
auto accountManager = DependencyManager::get<AccountManager>();
|
||||||
|
auto mySessionID = accountManager->getSessionID();
|
||||||
|
|
||||||
auto entityTree = getEntities()->getTree();
|
auto entityTree = getEntities()->getTree();
|
||||||
auto exportTree = std::make_shared<EntityTree>();
|
auto exportTree = std::make_shared<EntityTree>();
|
||||||
exportTree->createRootElement();
|
exportTree->createRootElement();
|
||||||
|
@ -4045,8 +4048,12 @@ bool Application::exportEntities(const QString& filename, const QVector<EntityIt
|
||||||
|
|
||||||
if (!givenOffset) {
|
if (!givenOffset) {
|
||||||
EntityItemID parentID = entityItem->getParentID();
|
EntityItemID parentID = entityItem->getParentID();
|
||||||
if (parentID.isInvalidID() || !entityIDs.contains(parentID) || !entityTree->findEntityByEntityItemID(parentID)) {
|
bool parentIsAvatar = (parentID == AVATAR_SELF_ID || parentID == mySessionID);
|
||||||
auto position = entityItem->getPosition(); // If parent wasn't selected, we want absolute position, which isn't in properties.
|
if (!parentIsAvatar && (parentID.isInvalidID() ||
|
||||||
|
!entityIDs.contains(parentID) ||
|
||||||
|
!entityTree->findEntityByEntityItemID(parentID))) {
|
||||||
|
// If parent wasn't selected, we want absolute position, which isn't in properties.
|
||||||
|
auto position = entityItem->getPosition();
|
||||||
root.x = glm::min(root.x, position.x);
|
root.x = glm::min(root.x, position.x);
|
||||||
root.y = glm::min(root.y, position.y);
|
root.y = glm::min(root.y, position.y);
|
||||||
root.z = glm::min(root.z, position.z);
|
root.z = glm::min(root.z, position.z);
|
||||||
|
@ -4066,12 +4073,16 @@ bool Application::exportEntities(const QString& filename, const QVector<EntityIt
|
||||||
for (EntityItemPointer& entityDatum : entities) {
|
for (EntityItemPointer& entityDatum : entities) {
|
||||||
auto properties = entityDatum->getProperties();
|
auto properties = entityDatum->getProperties();
|
||||||
EntityItemID parentID = properties.getParentID();
|
EntityItemID parentID = properties.getParentID();
|
||||||
if (parentID.isInvalidID()) {
|
bool parentIsAvatar = (parentID == AVATAR_SELF_ID || parentID == mySessionID);
|
||||||
properties.setPosition(properties.getPosition() - root);
|
if (parentIsAvatar) {
|
||||||
|
properties.setParentID(AVATAR_SELF_ID);
|
||||||
|
} else {
|
||||||
|
if (parentID.isInvalidID()) {
|
||||||
|
properties.setPosition(properties.getPosition() - root);
|
||||||
|
} else if (!entities.contains(parentID)) {
|
||||||
|
entityDatum->globalizeProperties(properties, "Parent %3 of %2 %1 is not selected for export.", -root);
|
||||||
|
} // else valid parent -- don't offset
|
||||||
}
|
}
|
||||||
else if (!entities.contains(parentID)) {
|
|
||||||
entityDatum->globalizeProperties(properties, "Parent %3 of %2 %1 is not selected for export.", -root);
|
|
||||||
} // else valid parent -- don't offset
|
|
||||||
exportTree->addEntity(entityDatum->getEntityItemID(), properties);
|
exportTree->addEntity(entityDatum->getEntityItemID(), properties);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue