Merge pull request #16512 from AndrewMeadows/time-moves-forward

DEV-2585: fix for whiteboard poly lines getting their parentID incorrectly reverted
This commit is contained in:
Maia Hansen 2019-11-19 12:34:53 -08:00 committed by GitHub
commit 6169936c2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 6 deletions

View file

@ -2707,10 +2707,12 @@ quint64 EntityItem::getLastEdited() const {
} }
void EntityItem::setLastEdited(quint64 lastEdited) { void EntityItem::setLastEdited(quint64 lastEdited) {
withWriteLock([&] { if (lastEdited == 0 || lastEdited > _lastEdited) {
_lastEdited = _lastUpdated = lastEdited; withWriteLock([&] {
_changedOnServer = glm::max(lastEdited, _changedOnServer); _lastEdited = _lastUpdated = lastEdited;
}); _changedOnServer = glm::max(lastEdited, _changedOnServer);
});
}
} }
void EntityItem::markAsChangedOnServer() { void EntityItem::markAsChangedOnServer() {

View file

@ -5071,8 +5071,9 @@ void EntityItemProperties::convertToCloneProperties(const EntityItemID& entityID
setEntityHostType(entity::HostType::LOCAL); setEntityHostType(entity::HostType::LOCAL);
setCollisionless(true); setCollisionless(true);
} }
setCreated(usecTimestampNow()); uint64_t now = usecTimestampNow();
setLastEdited(usecTimestampNow()); setCreated(now);
setLastEdited(now);
setCloneable(ENTITY_ITEM_DEFAULT_CLONEABLE); setCloneable(ENTITY_ITEM_DEFAULT_CLONEABLE);
setCloneLifetime(ENTITY_ITEM_DEFAULT_CLONE_LIFETIME); setCloneLifetime(ENTITY_ITEM_DEFAULT_CLONE_LIFETIME);
setCloneLimit(ENTITY_ITEM_DEFAULT_CLONE_LIMIT); setCloneLimit(ENTITY_ITEM_DEFAULT_CLONE_LIMIT);

View file

@ -1942,6 +1942,8 @@ int EntityTree::processEditPacketData(ReceivedMessage& message, const unsigned c
FilterType filterType = isPhysics ? FilterType::Physics : (isAdd ? FilterType::Add : FilterType::Edit); FilterType filterType = isPhysics ? FilterType::Physics : (isAdd ? FilterType::Add : FilterType::Edit);
bool allowed = (!isPhysics && senderNode->isAllowedEditor()) || filterProperties(existingEntity, properties, properties, wasChanged, filterType); bool allowed = (!isPhysics && senderNode->isAllowedEditor()) || filterProperties(existingEntity, properties, properties, wasChanged, filterType);
if (!allowed) { if (!allowed) {
// the update failed and we need to convey that fact to the sender
// our method is to re-assert the current properties and bump the lastEdited timestamp
auto timestamp = properties.getLastEdited(); auto timestamp = properties.getLastEdited();
properties = EntityItemProperties(); properties = EntityItemProperties();
properties.setLastEdited(timestamp); properties.setLastEdited(timestamp);