Merge pull request #9553 from huffman/fix/polyvox-import

Fix importing of PolyVox entities
This commit is contained in:
Brad Hefta-Gaub 2017-01-31 08:42:28 -08:00 committed by GitHub
commit 619bcdeed8

View file

@ -1560,6 +1560,8 @@ bool EntityTree::sendEntitiesOperation(OctreeElementPointer element, void* extra
return args->map->value(oldID);
}
EntityItemID newID = QUuid::createUuid();
args->map->insert(oldID, newID);
EntityItemProperties properties = item->getProperties();
EntityItemID oldParentID = properties.getParentID();
if (oldParentID.isInvalidID()) { // no parent
@ -1575,6 +1577,43 @@ bool EntityTree::sendEntitiesOperation(OctreeElementPointer element, void* extra
}
}
if (!properties.getXNNeighborID().isInvalidID()) {
auto neighborEntity = args->ourTree->findEntityByEntityItemID(properties.getXNNeighborID());
if (neighborEntity) {
properties.setXNNeighborID(getMapped(neighborEntity));
}
}
if (!properties.getXPNeighborID().isInvalidID()) {
auto neighborEntity = args->ourTree->findEntityByEntityItemID(properties.getXPNeighborID());
if (neighborEntity) {
properties.setXPNeighborID(getMapped(neighborEntity));
}
}
if (!properties.getYNNeighborID().isInvalidID()) {
auto neighborEntity = args->ourTree->findEntityByEntityItemID(properties.getYNNeighborID());
if (neighborEntity) {
properties.setYNNeighborID(getMapped(neighborEntity));
}
}
if (!properties.getYPNeighborID().isInvalidID()) {
auto neighborEntity = args->ourTree->findEntityByEntityItemID(properties.getYPNeighborID());
if (neighborEntity) {
properties.setYPNeighborID(getMapped(neighborEntity));
}
}
if (!properties.getZNNeighborID().isInvalidID()) {
auto neighborEntity = args->ourTree->findEntityByEntityItemID(properties.getZNNeighborID());
if (neighborEntity) {
properties.setZNNeighborID(getMapped(neighborEntity));
}
}
if (!properties.getZPNeighborID().isInvalidID()) {
auto neighborEntity = args->ourTree->findEntityByEntityItemID(properties.getZPNeighborID());
if (neighborEntity) {
properties.setZPNeighborID(getMapped(neighborEntity));
}
}
// set creation time to "now" for imported entities
properties.setCreated(usecTimestampNow());
@ -1592,7 +1631,6 @@ bool EntityTree::sendEntitiesOperation(OctreeElementPointer element, void* extra
args->otherTree->addEntity(newID, properties);
});
}
args->map->insert(oldID, newID);
return newID;
};