mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-04 10:32:26 +02:00
Remove obsolete remapIDs.
This commit is contained in:
parent
4ebf816166
commit
eef9de4d4f
4 changed files with 0 additions and 70 deletions
|
@ -1372,11 +1372,6 @@ bool EntityTree::sendEntitiesOperation(OctreeElementPointer element, void* extra
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTree::remapIDs() {
|
|
||||||
RemapIDOperator theOperator;
|
|
||||||
recurseTreeWithOperator(&theOperator);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EntityTree::writeToMap(QVariantMap& entityDescription, OctreeElementPointer element, bool skipDefaultValues,
|
bool EntityTree::writeToMap(QVariantMap& entityDescription, OctreeElementPointer element, bool skipDefaultValues,
|
||||||
bool skipThoseWithBadParents) {
|
bool skipThoseWithBadParents) {
|
||||||
if (! entityDescription.contains("Entities")) {
|
if (! entityDescription.contains("Entities")) {
|
||||||
|
|
|
@ -203,8 +203,6 @@ public:
|
||||||
bool wantTerseEditLogging() const { return _wantTerseEditLogging; }
|
bool wantTerseEditLogging() const { return _wantTerseEditLogging; }
|
||||||
void setWantTerseEditLogging(bool value) { _wantTerseEditLogging = value; }
|
void setWantTerseEditLogging(bool value) { _wantTerseEditLogging = value; }
|
||||||
|
|
||||||
void remapIDs();
|
|
||||||
|
|
||||||
virtual bool writeToMap(QVariantMap& entityDescription, OctreeElementPointer element, bool skipDefaultValues,
|
virtual bool writeToMap(QVariantMap& entityDescription, OctreeElementPointer element, bool skipDefaultValues,
|
||||||
bool skipThoseWithBadParents) override;
|
bool skipThoseWithBadParents) override;
|
||||||
virtual bool readFromMap(QVariantMap& entityDescription) override;
|
virtual bool readFromMap(QVariantMap& entityDescription) override;
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
//
|
|
||||||
// RemapIDOperator.cpp
|
|
||||||
// libraries/entities/src
|
|
||||||
//
|
|
||||||
// Created by Seth Alves on 2015-12-6.
|
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
|
||||||
//
|
|
||||||
// Distributed under the Apache License, Version 2.0.
|
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#include "EntityTree.h"
|
|
||||||
#include "RemapIDOperator.h"
|
|
||||||
|
|
||||||
QUuid RemapIDOperator::remap(const QUuid& oldID) {
|
|
||||||
if (oldID.isNull()) {
|
|
||||||
return oldID;
|
|
||||||
}
|
|
||||||
if (!_oldToNew.contains(oldID)) {
|
|
||||||
_oldToNew[oldID] = QUuid::createUuid();
|
|
||||||
}
|
|
||||||
return _oldToNew[oldID];
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RemapIDOperator::postRecursion(OctreeElementPointer element) {
|
|
||||||
EntityTreeElementPointer entityTreeElement = std::static_pointer_cast<EntityTreeElement>(element);
|
|
||||||
entityTreeElement->forEachEntity([&](EntityItemPointer entityItem) {
|
|
||||||
entityItem->setID(remap(entityItem->getID()));
|
|
||||||
entityItem->setParentID(remap(entityItem->getParentID()));
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
//
|
|
||||||
// RemapIDOperator.h
|
|
||||||
// libraries/entities/src
|
|
||||||
//
|
|
||||||
// Created by Seth Alves on 2015-12-6.
|
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
|
||||||
//
|
|
||||||
// Distributed under the Apache License, Version 2.0.
|
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef hifi_RemapIDOperator_h
|
|
||||||
#define hifi_RemapIDOperator_h
|
|
||||||
|
|
||||||
#include "Octree.h"
|
|
||||||
|
|
||||||
// this will change all the IDs in an EntityTree. Parent/Child relationships are maintained.
|
|
||||||
|
|
||||||
class RemapIDOperator : public RecurseOctreeOperator {
|
|
||||||
public:
|
|
||||||
RemapIDOperator() : RecurseOctreeOperator() {}
|
|
||||||
~RemapIDOperator() {}
|
|
||||||
virtual bool preRecursion(OctreeElementPointer element) { return true; }
|
|
||||||
virtual bool postRecursion(OctreeElementPointer element);
|
|
||||||
private:
|
|
||||||
QUuid remap(const QUuid& oldID);
|
|
||||||
QHash<QUuid, QUuid> _oldToNew;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // hifi_RemapIDOperator_h
|
|
Loading…
Reference in a new issue