mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 22:36:39 +02:00
add content timestamp for EntityTreeElement
This commit is contained in:
parent
ca470d67b4
commit
2b31a746e3
4 changed files with 12 additions and 0 deletions
|
@ -893,6 +893,7 @@ void EntityTreeElement::cleanupEntities() {
|
||||||
}
|
}
|
||||||
_entityItems.clear();
|
_entityItems.clear();
|
||||||
});
|
});
|
||||||
|
_lastChangedContent = usecTimestampNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EntityTreeElement::removeEntityWithEntityItemID(const EntityItemID& id) {
|
bool EntityTreeElement::removeEntityWithEntityItemID(const EntityItemID& id) {
|
||||||
|
@ -906,6 +907,7 @@ bool EntityTreeElement::removeEntityWithEntityItemID(const EntityItemID& id) {
|
||||||
// NOTE: only EntityTreeElement should ever be changing the value of entity->_element
|
// NOTE: only EntityTreeElement should ever be changing the value of entity->_element
|
||||||
entity->_element = NULL;
|
entity->_element = NULL;
|
||||||
_entityItems.removeAt(i);
|
_entityItems.removeAt(i);
|
||||||
|
_lastChangedContent = usecTimestampNow();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -922,6 +924,7 @@ bool EntityTreeElement::removeEntityItem(EntityItemPointer entity) {
|
||||||
// NOTE: only EntityTreeElement should ever be changing the value of entity->_element
|
// NOTE: only EntityTreeElement should ever be changing the value of entity->_element
|
||||||
assert(entity->_element.get() == this);
|
assert(entity->_element.get() == this);
|
||||||
entity->_element = NULL;
|
entity->_element = NULL;
|
||||||
|
_lastChangedContent = usecTimestampNow();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -939,6 +942,7 @@ void EntityTreeElement::addEntityItem(EntityItemPointer entity) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
_entityItems.push_back(entity);
|
_entityItems.push_back(entity);
|
||||||
});
|
});
|
||||||
|
_lastChangedContent = usecTimestampNow();
|
||||||
entity->_element = getThisPointer();
|
entity->_element = getThisPointer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -238,10 +238,14 @@ public:
|
||||||
return std::static_pointer_cast<const OctreeElement>(shared_from_this());
|
return std::static_pointer_cast<const OctreeElement>(shared_from_this());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bumpChangedContent() { _lastChangedContent = usecTimestampNow(); }
|
||||||
|
uint64_t getLastChangedContent() const { return _lastChangedContent; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void init(unsigned char * octalCode) override;
|
virtual void init(unsigned char * octalCode) override;
|
||||||
EntityTreePointer _myTree;
|
EntityTreePointer _myTree;
|
||||||
EntityItems _entityItems;
|
EntityItems _entityItems;
|
||||||
|
uint64_t _lastChangedContent { 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_EntityTreeElement_h
|
#endif // hifi_EntityTreeElement_h
|
||||||
|
|
|
@ -192,6 +192,8 @@ bool MovingEntitiesOperator::preRecursion(const OctreeElementPointer& element) {
|
||||||
oldElement->removeEntityItem(details.entity);
|
oldElement->removeEntityItem(details.entity);
|
||||||
}
|
}
|
||||||
entityTreeElement->addEntityItem(details.entity);
|
entityTreeElement->addEntityItem(details.entity);
|
||||||
|
} else {
|
||||||
|
entityTreeElement->bumpChangedContent();
|
||||||
}
|
}
|
||||||
_foundNewCount++;
|
_foundNewCount++;
|
||||||
//details.newFound = true; // TODO: would be nice to add this optimization
|
//details.newFound = true; // TODO: would be nice to add this optimization
|
||||||
|
|
|
@ -173,6 +173,8 @@ bool UpdateEntityOperator::preRecursion(const OctreeElementPointer& element) {
|
||||||
if (oldElement != _containingElement) {
|
if (oldElement != _containingElement) {
|
||||||
qCDebug(entities) << "WARNING entity moved during UpdateEntityOperator recursion";
|
qCDebug(entities) << "WARNING entity moved during UpdateEntityOperator recursion";
|
||||||
_containingElement->removeEntityItem(_existingEntity);
|
_containingElement->removeEntityItem(_existingEntity);
|
||||||
|
} else {
|
||||||
|
_containingElement->bumpChangedContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_wantDebug) {
|
if (_wantDebug) {
|
||||||
|
|
Loading…
Reference in a new issue