mirror of
https://github.com/overte-org/overte.git
synced 2025-08-12 10:14:17 +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>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
class EntityItem;
|
class EntityItem;
|
||||||
|
class EntityItemID;
|
||||||
class EntitySimulation;
|
class EntitySimulation;
|
||||||
using EntityItemPointer = std::shared_ptr<EntityItem>;
|
using EntityItemPointer = std::shared_ptr<EntityItem>;
|
||||||
using EntityItemWeakPointer = std::weak_ptr<EntityItem>;
|
using EntityItemWeakPointer = std::weak_ptr<EntityItem>;
|
||||||
|
@ -45,6 +46,9 @@ public:
|
||||||
virtual ~EntityDynamicInterface() { }
|
virtual ~EntityDynamicInterface() { }
|
||||||
const QUuid& getID() const { return _id; }
|
const QUuid& getID() const { return _id; }
|
||||||
EntityDynamicType getType() const { return _type; }
|
EntityDynamicType getType() const { return _type; }
|
||||||
|
|
||||||
|
virtual void remapIDs(QHash<EntityItemID, EntityItemID>* map) = 0;
|
||||||
|
|
||||||
virtual bool isAction() const { return false; }
|
virtual bool isAction() const { return false; }
|
||||||
virtual bool isConstraint() const { return false; }
|
virtual bool isConstraint() const { return false; }
|
||||||
virtual bool isReadyForAdd() const { return true; }
|
virtual bool isReadyForAdd() const { return true; }
|
||||||
|
|
|
@ -24,6 +24,17 @@ ObjectDynamic::ObjectDynamic(EntityDynamicType type, const QUuid& id, EntityItem
|
||||||
ObjectDynamic::~ObjectDynamic() {
|
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 {
|
qint64 ObjectDynamic::getEntityServerClockSkew() const {
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@ public:
|
||||||
ObjectDynamic(EntityDynamicType type, const QUuid& id, EntityItemPointer ownerEntity);
|
ObjectDynamic(EntityDynamicType type, const QUuid& id, EntityItemPointer ownerEntity);
|
||||||
virtual ~ObjectDynamic();
|
virtual ~ObjectDynamic();
|
||||||
|
|
||||||
|
virtual void remapIDs(QHash<EntityItemID, EntityItemID>* map) override;
|
||||||
|
|
||||||
virtual void removeFromSimulation(EntitySimulationPointer simulation) const override;
|
virtual void removeFromSimulation(EntitySimulationPointer simulation) const override;
|
||||||
virtual EntityItemWeakPointer getOwnerEntity() const override { return _ownerEntity; }
|
virtual EntityItemWeakPointer getOwnerEntity() const override { return _ownerEntity; }
|
||||||
virtual void setOwnerEntity(const EntityItemPointer ownerEntity) override { _ownerEntity = ownerEntity; }
|
virtual void setOwnerEntity(const EntityItemPointer ownerEntity) override { _ownerEntity = ownerEntity; }
|
||||||
|
|
Loading…
Reference in a new issue