mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 11:45:36 +02:00
start on code to remap constraint IDs during import
This commit is contained in:
parent
5d539bcc17
commit
7a1a9d6496
3 changed files with 17 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
|||
#include <glm/glm.hpp>
|
||||
|
||||
class EntityItem;
|
||||
class EntityItemID;
|
||||
class EntitySimulation;
|
||||
using EntityItemPointer = std::shared_ptr<EntityItem>;
|
||||
using EntityItemWeakPointer = std::weak_ptr<EntityItem>;
|
||||
|
@ -45,6 +46,9 @@ public:
|
|||
virtual ~EntityDynamicInterface() { }
|
||||
const QUuid& getID() const { return _id; }
|
||||
EntityDynamicType getType() const { return _type; }
|
||||
|
||||
virtual void remapIDs(QHash<EntityItemID, EntityItemID>* map) = 0;
|
||||
|
||||
virtual bool isAction() const { return false; }
|
||||
virtual bool isConstraint() const { return false; }
|
||||
virtual bool isReadyForAdd() const { return true; }
|
||||
|
|
|
@ -24,6 +24,17 @@ ObjectDynamic::ObjectDynamic(EntityDynamicType type, const QUuid& id, EntityItem
|
|||
ObjectDynamic::~ObjectDynamic() {
|
||||
}
|
||||
|
||||
void ObjectDynamic::remapIDs(QHash<EntityItemID, EntityItemID>* map) {
|
||||
withWriteLock([&]{
|
||||
if (map->contains(_id)) {
|
||||
_id = (*map)[_id];
|
||||
}
|
||||
if (map->contains(_otherID)) {
|
||||
_otherID = (*map)[_otherID];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
qint64 ObjectDynamic::getEntityServerClockSkew() const {
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@ public:
|
|||
ObjectDynamic(EntityDynamicType type, const QUuid& id, EntityItemPointer ownerEntity);
|
||||
virtual ~ObjectDynamic();
|
||||
|
||||
virtual void remapIDs(QHash<EntityItemID, EntityItemID>* map) override;
|
||||
|
||||
virtual void removeFromSimulation(EntitySimulationPointer simulation) const override;
|
||||
virtual EntityItemWeakPointer getOwnerEntity() const override { return _ownerEntity; }
|
||||
virtual void setOwnerEntity(const EntityItemPointer ownerEntity) override { _ownerEntity = ownerEntity; }
|
||||
|
|
Loading…
Reference in a new issue