mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 10:29:01 +02:00
Checkpoint for freakin edit.js again.
This commit is contained in:
parent
d07967d6d8
commit
7a066afa26
3 changed files with 11 additions and 8 deletions
|
@ -90,7 +90,7 @@ void EntityTree::postAddEntity(EntityItemPointer entity) {
|
||||||
_simulation->addEntity(entity);
|
_simulation->addEntity(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entity->isParentIDValid()) {
|
if (!entity->isParentIDValid(this)) {
|
||||||
_missingParent.append(entity);
|
_missingParent.append(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ bool EntityTree::updateEntityWithElement(EntityItemPointer entity, const EntityI
|
||||||
_missingParent.append(childEntity);
|
_missingParent.append(childEntity);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!childEntity->isParentIDValid()) {
|
if (!childEntity->isParentIDValid(this)) {
|
||||||
_missingParent.append(childEntity);
|
_missingParent.append(childEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1027,7 +1027,7 @@ void EntityTree::fixupMissingParents() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool doMove = false;
|
bool doMove = false;
|
||||||
if (entity->isParentIDValid()) {
|
if (entity->isParentIDValid(this)) {
|
||||||
qCDebug(entities) << "HRS fixme valid parent" << entity->getEntityItemID() << queryAACubeSuccess;
|
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...
|
// this entity's parent was previously not known, and now is. Update its location in the EntityTree...
|
||||||
doMove = true;
|
doMove = true;
|
||||||
|
@ -1367,7 +1367,7 @@ bool EntityTree::writeToMap(QVariantMap& entityDescription, OctreeElementPointer
|
||||||
entityDescription["Entities"] = QVariantList();
|
entityDescription["Entities"] = QVariantList();
|
||||||
}
|
}
|
||||||
QScriptEngine scriptEngine;
|
QScriptEngine scriptEngine;
|
||||||
RecurseOctreeToMapOperator theOperator(entityDescription, element, &scriptEngine, skipDefaultValues, skipThoseWithBadParents);
|
RecurseOctreeToMapOperator theOperator(entityDescription, element, &scriptEngine, skipDefaultValues, skipThoseWithBadParents, this);
|
||||||
recurseTreeWithOperator(&theOperator);
|
recurseTreeWithOperator(&theOperator);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,13 +17,15 @@ RecurseOctreeToMapOperator::RecurseOctreeToMapOperator(QVariantMap& map,
|
||||||
OctreeElementPointer top,
|
OctreeElementPointer top,
|
||||||
QScriptEngine* engine,
|
QScriptEngine* engine,
|
||||||
bool skipDefaultValues,
|
bool skipDefaultValues,
|
||||||
bool skipThoseWithBadParents) :
|
bool skipThoseWithBadParents,
|
||||||
|
EntityTree* tree) :
|
||||||
RecurseOctreeOperator(),
|
RecurseOctreeOperator(),
|
||||||
_map(map),
|
_map(map),
|
||||||
_top(top),
|
_top(top),
|
||||||
_engine(engine),
|
_engine(engine),
|
||||||
_skipDefaultValues(skipDefaultValues),
|
_skipDefaultValues(skipDefaultValues),
|
||||||
_skipThoseWithBadParents(skipThoseWithBadParents)
|
_skipThoseWithBadParents(skipThoseWithBadParents),
|
||||||
|
_entityTree(tree)
|
||||||
{
|
{
|
||||||
// if some element "top" was given, only save information for that element and its children.
|
// if some element "top" was given, only save information for that element and its children.
|
||||||
if (_top) {
|
if (_top) {
|
||||||
|
@ -49,7 +51,7 @@ bool RecurseOctreeToMapOperator::postRecursion(OctreeElementPointer element) {
|
||||||
QVariantList entitiesQList = qvariant_cast<QVariantList>(_map["Entities"]);
|
QVariantList entitiesQList = qvariant_cast<QVariantList>(_map["Entities"]);
|
||||||
|
|
||||||
entityTreeElement->forEachEntity([&](EntityItemPointer entityItem) {
|
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.
|
return; // we weren't able to resolve a parent from _parentID, so don't save this entity.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
class RecurseOctreeToMapOperator : public RecurseOctreeOperator {
|
class RecurseOctreeToMapOperator : public RecurseOctreeOperator {
|
||||||
public:
|
public:
|
||||||
RecurseOctreeToMapOperator(QVariantMap& map, OctreeElementPointer top, QScriptEngine* engine, bool skipDefaultValues,
|
RecurseOctreeToMapOperator(QVariantMap& map, OctreeElementPointer top, QScriptEngine* engine, bool skipDefaultValues,
|
||||||
bool skipThoseWithBadParents);
|
bool skipThoseWithBadParents, EntityTree* tree);
|
||||||
bool preRecursion(OctreeElementPointer element);
|
bool preRecursion(OctreeElementPointer element);
|
||||||
bool postRecursion(OctreeElementPointer element);
|
bool postRecursion(OctreeElementPointer element);
|
||||||
private:
|
private:
|
||||||
|
@ -24,4 +24,5 @@ public:
|
||||||
bool _withinTop;
|
bool _withinTop;
|
||||||
bool _skipDefaultValues;
|
bool _skipDefaultValues;
|
||||||
bool _skipThoseWithBadParents;
|
bool _skipThoseWithBadParents;
|
||||||
|
EntityTree* _entityTree;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue