terse logging for sim ownership

This commit is contained in:
Seth Alves 2015-11-11 08:51:10 -08:00
parent c2b0ccd6b3
commit 31ebe5dba1
3 changed files with 30 additions and 11 deletions

View file

@ -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;

View file

@ -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; }

View file

@ -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<QString> 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();