diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index dbea43d514..8aa2bdb5d3 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -632,6 +632,9 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef if (_simulationOwner.set(newSimOwner)) { _dirtyFlags |= Simulation::DIRTY_SIMULATOR_ID; + if (wantTerseEditLogging()) { + qCDebug(entities) << "sim ownership for" << getDebugName() << "is now" << newSimOwner; + } } } { // When we own the simulation we don't accept updates to the entity's transform/velocities @@ -996,6 +999,11 @@ EntityTreePointer EntityItem::getTree() const { return tree; } +bool EntityItem::wantTerseEditLogging() { + EntityTreePointer tree = getTree(); + return tree ? tree->wantTerseEditLogging() : false; +} + glm::mat4 EntityItem::getEntityToWorldMatrix() const { glm::mat4 translation = glm::translate(getPosition()); glm::mat4 rotation = glm::mat4_cast(getRotation()); @@ -1492,21 +1500,33 @@ void EntityItem::updateCreated(uint64_t value) { } void EntityItem::setSimulationOwner(const QUuid& id, quint8 priority) { - _simulationOwner.set(id, priority); + if (_simulationOwner.set(id, priority)) { + if (wantTerseEditLogging()) { + qCDebug(entities) << "sim ownership for" << getDebugName() << "is now" << id; + } + } } void EntityItem::setSimulationOwner(const SimulationOwner& owner) { - _simulationOwner.set(owner); + if (_simulationOwner.set(owner)) { + if (wantTerseEditLogging()) { + qCDebug(entities) << "sim ownership for" << getDebugName() << "is now" << owner; + } + } } void EntityItem::updateSimulatorID(const QUuid& value) { if (_simulationOwner.setID(value)) { _dirtyFlags |= Simulation::DIRTY_SIMULATOR_ID; + if (wantTerseEditLogging()) { + qCDebug(entities) << "sim ownership for" << getDebugName() << "is now" << value; + } } } void EntityItem::clearSimulationOwnership() { _simulationOwner.clear(); + qCDebug(entities) << "sim ownership for" << getDebugName() << "is now null"; // don't bother setting the DIRTY_SIMULATOR_ID flag because clearSimulationOwnership() // is only ever called entity-server-side and the flags are only used client-side //_dirtyFlags |= Simulation::DIRTY_SIMULATOR_ID; diff --git a/libraries/entities/src/EntityItem.h b/libraries/entities/src/EntityItem.h index 858dc7e326..b3c976c1ca 100644 --- a/libraries/entities/src/EntityItem.h +++ b/libraries/entities/src/EntityItem.h @@ -307,6 +307,7 @@ public: QString getName() const { return _name; } void setName(const QString& value) { _name = value; } + QString getDebugName() { return _name != "" ? _name : getID().toString(); } bool getVisible() const { return _visible; } void setVisible(bool value) { _visible = value; } @@ -381,6 +382,7 @@ public: void setPhysicsInfo(void* data) { _physicsInfo = data; } EntityTreeElementPointer getElement() const { return _element; } EntityTreePointer getTree() const; + bool wantTerseEditLogging(); static void setSendPhysicsUpdates(bool value) { _sendPhysicsUpdates = value; } static bool getSendPhysicsUpdates() { return _sendPhysicsUpdates; } diff --git a/libraries/entities/src/EntityTree.cpp b/libraries/entities/src/EntityTree.cpp index 40fbca26bd..179e68ea29 100644 --- a/libraries/entities/src/EntityTree.cpp +++ b/libraries/entities/src/EntityTree.cpp @@ -199,12 +199,11 @@ bool EntityTree::updateEntityWithElement(EntityItemPointer entity, const EntityI properties.setAccelerationChanged(false); } - if (wantTerseEditLogging()) { - if (properties.simulationOwnerChanged()) { - QString itemName = entity->getName() != "" ? entity->getName() : entity->getID().toString(); - qCDebug(entities) << "sim ownership for" << itemName << "is now" << senderID; - } - } + // if (wantTerseEditLogging()) { + // if (properties.simulationOwnerChanged()) { + // qCDebug(entities) << "sim ownership for" << entity->getDebugName() << "is now" << senderID; + // } + // } } // else client accepts what the server says @@ -764,9 +763,7 @@ int EntityTree::processEditPacketData(NLPacket& packet, const unsigned char* edi if (wantTerseEditLogging()) { QList changedProperties = properties.listChangedProperties(); fixupTerseEditLogging(properties, changedProperties); - QString itemName = - existingEntity->getName() != "" ? existingEntity->getName() : entityItemID.toString(); - qCDebug(entities) << "edit" << itemName << changedProperties; + qCDebug(entities) << "edit" << existingEntity->getDebugName() << changedProperties; } endLogging = usecTimestampNow();