Checkpoint for freakin edit.js again.

This commit is contained in:
howard-stearns 2016-03-28 14:25:51 -07:00
parent d07967d6d8
commit 7a066afa26
3 changed files with 11 additions and 8 deletions

View file

@ -90,7 +90,7 @@ void EntityTree::postAddEntity(EntityItemPointer entity) {
_simulation->addEntity(entity);
}
if (!entity->isParentIDValid()) {
if (!entity->isParentIDValid(this)) {
_missingParent.append(entity);
}
@ -260,7 +260,7 @@ bool EntityTree::updateEntityWithElement(EntityItemPointer entity, const EntityI
_missingParent.append(childEntity);
continue;
}
if (!childEntity->isParentIDValid()) {
if (!childEntity->isParentIDValid(this)) {
_missingParent.append(childEntity);
}
@ -1027,7 +1027,7 @@ void EntityTree::fixupMissingParents() {
}
bool doMove = false;
if (entity->isParentIDValid()) {
if (entity->isParentIDValid(this)) {
qCDebug(entities) << "HRS fixme valid parent" << entity->getEntityItemID() << queryAACubeSuccess;
// this entity's parent was previously not known, and now is. Update its location in the EntityTree...
doMove = true;
@ -1367,7 +1367,7 @@ bool EntityTree::writeToMap(QVariantMap& entityDescription, OctreeElementPointer
entityDescription["Entities"] = QVariantList();
}
QScriptEngine scriptEngine;
RecurseOctreeToMapOperator theOperator(entityDescription, element, &scriptEngine, skipDefaultValues, skipThoseWithBadParents);
RecurseOctreeToMapOperator theOperator(entityDescription, element, &scriptEngine, skipDefaultValues, skipThoseWithBadParents, this);
recurseTreeWithOperator(&theOperator);
return true;
}

View file

@ -17,13 +17,15 @@ RecurseOctreeToMapOperator::RecurseOctreeToMapOperator(QVariantMap& map,
OctreeElementPointer top,
QScriptEngine* engine,
bool skipDefaultValues,
bool skipThoseWithBadParents) :
bool skipThoseWithBadParents,
EntityTree* tree) :
RecurseOctreeOperator(),
_map(map),
_top(top),
_engine(engine),
_skipDefaultValues(skipDefaultValues),
_skipThoseWithBadParents(skipThoseWithBadParents)
_skipThoseWithBadParents(skipThoseWithBadParents),
_entityTree(tree)
{
// if some element "top" was given, only save information for that element and its children.
if (_top) {
@ -49,7 +51,7 @@ bool RecurseOctreeToMapOperator::postRecursion(OctreeElementPointer element) {
QVariantList entitiesQList = qvariant_cast<QVariantList>(_map["Entities"]);
entityTreeElement->forEachEntity([&](EntityItemPointer entityItem) {
if (_skipThoseWithBadParents && !entityItem->isParentIDValid()) {
if (_skipThoseWithBadParents && !entityItem->isParentIDValid(_entityTree)) {
return; // we weren't able to resolve a parent from _parentID, so don't save this entity.
}

View file

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