kill offsets

This commit is contained in:
Howard Stearns 2016-03-29 09:18:29 -07:00
parent 1b3d9d7ab6
commit 5db1c33e4d
4 changed files with 12 additions and 13 deletions

View file

@ -2849,13 +2849,14 @@ bool Application::exportEntities(const QString& filename, const QVector<EntityIt
}
// The so-called root offset (which isn't) is confusing and not what content developers want. And why would queryAACube not then be offset?
// But leaving it in for bug-compatibility right now. -HRS
properties.setPosition(properties.getPosition() - root);
// FIXME properties.setPosition(properties.getPosition() - root);
datum.mappedID = originalID; //EntityItemID(QUuid::createUuid());
auto newEntity = exportTree->addEntity(datum.mappedID, properties);
qCDebug(interfaceapp) << "mapped" << properties.getName();
qCDebug(interfaceapp) << " " << originalID << "p:" << datum.originalParentID;
qCDebug(interfaceapp) << " =>" << datum.mappedID << "p:" << parentID;
qCDebug(interfaceapp) << " @" << properties.getPosition() << "/" << properties.getLocalPosition();
return datum.mappedID;
};

View file

@ -1335,12 +1335,13 @@ bool EntityTree::sendEntitiesOperation(OctreeElementPointer element, void* extra
SendEntitiesOperationArgs* args = static_cast<SendEntitiesOperationArgs*>(extraData);
EntityTreeElementPointer entityTreeElement = std::static_pointer_cast<EntityTreeElement>(element);
entityTreeElement->forEachEntity([&](EntityItemPointer entityItem) {
EntityItemID newID = entityItem->getEntityItemID(); // FIXME (QUuid::createUuid());
EntityItemID newID = /*entityItem->getEntityItemID(); // FIXME*/ (QUuid::createUuid());
// FIXME: add map to SendEntitiesOperationArgs, and recurse through parent using the map
args->newEntityIDs->append(newID);
EntityItemProperties properties = entityItem->getProperties();
properties.setPosition(properties.getPosition() + args->root);
//FIXME properties.setPosition(properties.getPosition() + args->root);
properties.markAllChanged(); // so the entire property set is considered new, since we're making a new entity
qCDebug(entities) << "sending" << newID << properties.getName() << "parent:" << properties.getParentID();
qCDebug(entities) << "sending" << newID << properties.getName() << "parent:" << properties.getParentID() << "pos:" << properties.getPosition();
// queue the packet to send to the server
args->packetSender->queueEditEntityMessage(PacketType::EntityAdd, newID, properties);
@ -1367,7 +1368,7 @@ bool EntityTree::writeToMap(QVariantMap& entityDescription, OctreeElementPointer
entityDescription["Entities"] = QVariantList();
}
QScriptEngine scriptEngine;
RecurseOctreeToMapOperator theOperator(entityDescription, element, &scriptEngine, skipDefaultValues, skipThoseWithBadParents, this);
RecurseOctreeToMapOperator theOperator(entityDescription, element, &scriptEngine, skipDefaultValues, skipThoseWithBadParents);
recurseTreeWithOperator(&theOperator);
return true;
}
@ -1395,7 +1396,7 @@ bool EntityTree::readFromMap(QVariantMap& map) {
}
EntityItemPointer entity = addEntity(entityItemID, properties);
qCDebug(entities) << "HRS FIXME added" << entityItemID << properties.getName();
qCDebug(entities) << "HRS FIXME added" << entityItemID << properties.getName() << "@" << properties.getPosition();
if (!entity) {
qCDebug(entities) << "adding Entity failed:" << entityItemID << properties.getType();
}

View file

@ -17,15 +17,13 @@ RecurseOctreeToMapOperator::RecurseOctreeToMapOperator(QVariantMap& map,
OctreeElementPointer top,
QScriptEngine* engine,
bool skipDefaultValues,
bool skipThoseWithBadParents,
EntityTree* tree) :
bool skipThoseWithBadParents) :
RecurseOctreeOperator(),
_map(map),
_top(top),
_engine(engine),
_skipDefaultValues(skipDefaultValues),
_skipThoseWithBadParents(skipThoseWithBadParents),
_entityTree(tree)
_skipThoseWithBadParents(skipThoseWithBadParents)
{
// if some element "top" was given, only save information for that element and its children.
if (_top) {

View file

@ -14,7 +14,7 @@
class RecurseOctreeToMapOperator : public RecurseOctreeOperator {
public:
RecurseOctreeToMapOperator(QVariantMap& map, OctreeElementPointer top, QScriptEngine* engine, bool skipDefaultValues,
bool skipThoseWithBadParents, EntityTree* tree);
bool skipThoseWithBadParents);
bool preRecursion(OctreeElementPointer element);
bool postRecursion(OctreeElementPointer element);
private:
@ -24,5 +24,4 @@ public:
bool _withinTop;
bool _skipDefaultValues;
bool _skipThoseWithBadParents;
EntityTree* _entityTree;
};