mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 14:18:24 +02:00
more debugging prints
This commit is contained in:
parent
f07d5d9d3f
commit
07f3d8eca0
5 changed files with 52 additions and 31 deletions
|
@ -304,3 +304,24 @@ QDataStream& operator>>(QDataStream& stream, EntityActionType& entityActionType)
|
||||||
entityActionType = (EntityActionType)actionTypeAsInt;
|
entityActionType = (EntityActionType)actionTypeAsInt;
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString serializedActionsToDebugString(QByteArray data) {
|
||||||
|
if (data.size() == 0) {
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
QVector<QByteArray> serializedActions;
|
||||||
|
QDataStream serializedActionsStream(data);
|
||||||
|
serializedActionsStream >> serializedActions;
|
||||||
|
|
||||||
|
QString result;
|
||||||
|
foreach(QByteArray serializedAction, serializedActions) {
|
||||||
|
QDataStream serializedActionStream(serializedAction);
|
||||||
|
EntityActionType actionType;
|
||||||
|
QUuid actionID;
|
||||||
|
serializedActionStream >> actionType;
|
||||||
|
serializedActionStream >> actionID;
|
||||||
|
result += EntityActionInterface::actionTypeToString(actionType) + "-" + actionID.toString() + " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
|
@ -89,4 +89,6 @@ typedef std::shared_ptr<EntityActionInterface> EntityActionPointer;
|
||||||
QDataStream& operator<<(QDataStream& stream, const EntityActionType& entityActionType);
|
QDataStream& operator<<(QDataStream& stream, const EntityActionType& entityActionType);
|
||||||
QDataStream& operator>>(QDataStream& stream, EntityActionType& entityActionType);
|
QDataStream& operator>>(QDataStream& stream, EntityActionType& entityActionType);
|
||||||
|
|
||||||
|
QString serializedActionsToDebugString(QByteArray data);
|
||||||
|
|
||||||
#endif // hifi_EntityActionInterface_h
|
#endif // hifi_EntityActionInterface_h
|
||||||
|
|
|
@ -630,11 +630,11 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
||||||
dataAt += bytes;
|
dataAt += bytes;
|
||||||
bytesRead += bytes;
|
bytesRead += bytes;
|
||||||
|
|
||||||
|
if (wantTerseEditLogging() && _simulationOwner != newSimOwner) {
|
||||||
|
qCDebug(entities) << "sim ownership for" << getDebugName() << "is now" << newSimOwner;
|
||||||
|
}
|
||||||
if (_simulationOwner.set(newSimOwner)) {
|
if (_simulationOwner.set(newSimOwner)) {
|
||||||
_dirtyFlags |= Simulation::DIRTY_SIMULATOR_ID;
|
_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
|
{ // When we own the simulation we don't accept updates to the entity's transform/velocities
|
||||||
|
@ -740,7 +740,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
||||||
// this "new" data is actually slightly out of date. We calculate the time we need to skip forward and
|
// this "new" data is actually slightly out of date. We calculate the time we need to skip forward and
|
||||||
// use our simulation helper routine to get a best estimate of where the entity should be.
|
// use our simulation helper routine to get a best estimate of where the entity should be.
|
||||||
float skipTimeForward = (float)(now - lastSimulatedFromBufferAdjusted) / (float)(USECS_PER_SECOND);
|
float skipTimeForward = (float)(now - lastSimulatedFromBufferAdjusted) / (float)(USECS_PER_SECOND);
|
||||||
|
|
||||||
// we want to extrapolate the motion forward to compensate for packet travel time, but
|
// we want to extrapolate the motion forward to compensate for packet travel time, but
|
||||||
// we don't want the side effect of flag setting.
|
// we don't want the side effect of flag setting.
|
||||||
simulateKinematicMotion(skipTimeForward, false);
|
simulateKinematicMotion(skipTimeForward, false);
|
||||||
|
@ -748,7 +748,6 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
||||||
|
|
||||||
if (overwriteLocalData) {
|
if (overwriteLocalData) {
|
||||||
if (!_simulationOwner.matchesValidID(myNodeID)) {
|
if (!_simulationOwner.matchesValidID(myNodeID)) {
|
||||||
|
|
||||||
_lastSimulated = now;
|
_lastSimulated = now;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1500,33 +1499,36 @@ void EntityItem::updateCreated(uint64_t value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityItem::setSimulationOwner(const QUuid& id, quint8 priority) {
|
void EntityItem::setSimulationOwner(const QUuid& id, quint8 priority) {
|
||||||
if (_simulationOwner.set(id, priority)) {
|
if (wantTerseEditLogging() && (id != _simulationOwner.getID() || priority != _simulationOwner.getPriority())) {
|
||||||
if (wantTerseEditLogging()) {
|
qCDebug(entities) << "sim ownership for" << getDebugName() << "is now" << id << priority;
|
||||||
qCDebug(entities) << "sim ownership for" << getDebugName() << "is now" << id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
_simulationOwner.set(id, priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityItem::setSimulationOwner(const SimulationOwner& owner) {
|
void EntityItem::setSimulationOwner(const SimulationOwner& owner) {
|
||||||
if (_simulationOwner.set(owner)) {
|
if (wantTerseEditLogging() && _simulationOwner != owner) {
|
||||||
if (wantTerseEditLogging()) {
|
qCDebug(entities) << "sim ownership for" << getDebugName() << "is now" << owner;
|
||||||
qCDebug(entities) << "sim ownership for" << getDebugName() << "is now" << owner;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_simulationOwner.set(owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityItem::updateSimulatorID(const QUuid& value) {
|
void EntityItem::updateSimulatorID(const QUuid& value) {
|
||||||
|
if (wantTerseEditLogging() && _simulationOwner.getID() != value) {
|
||||||
|
qCDebug(entities) << "sim ownership for" << getDebugName() << "is now" << value;
|
||||||
|
}
|
||||||
|
|
||||||
if (_simulationOwner.setID(value)) {
|
if (_simulationOwner.setID(value)) {
|
||||||
_dirtyFlags |= Simulation::DIRTY_SIMULATOR_ID;
|
_dirtyFlags |= Simulation::DIRTY_SIMULATOR_ID;
|
||||||
if (wantTerseEditLogging()) {
|
|
||||||
qCDebug(entities) << "sim ownership for" << getDebugName() << "is now" << value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityItem::clearSimulationOwnership() {
|
void EntityItem::clearSimulationOwnership() {
|
||||||
|
if (wantTerseEditLogging() && !_simulationOwner.isNull()) {
|
||||||
|
qCDebug(entities) << "sim ownership for" << getDebugName() << "is now null";
|
||||||
|
}
|
||||||
|
|
||||||
_simulationOwner.clear();
|
_simulationOwner.clear();
|
||||||
qCDebug(entities) << "sim ownership for" << getDebugName() << "is now null";
|
|
||||||
// don't bother setting the DIRTY_SIMULATOR_ID flag because clearSimulationOwnership()
|
// 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
|
// is only ever called entity-server-side and the flags are only used client-side
|
||||||
//_dirtyFlags |= Simulation::DIRTY_SIMULATOR_ID;
|
//_dirtyFlags |= Simulation::DIRTY_SIMULATOR_ID;
|
||||||
|
@ -1669,7 +1671,7 @@ void EntityItem::deserializeActionsInternal() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityTreePointer entityTree = _element ? _element->getTree() : nullptr;
|
EntityTreePointer entityTree = getTree();
|
||||||
assert(entityTree);
|
assert(entityTree);
|
||||||
EntitySimulation* simulation = entityTree ? entityTree->getSimulation() : nullptr;
|
EntitySimulation* simulation = entityTree ? entityTree->getSimulation() : nullptr;
|
||||||
assert(simulation);
|
assert(simulation);
|
||||||
|
|
|
@ -197,13 +197,11 @@ bool EntityTree::updateEntityWithElement(EntityItemPointer entity, const EntityI
|
||||||
properties.setVelocityChanged(false);
|
properties.setVelocityChanged(false);
|
||||||
properties.setAngularVelocityChanged(false);
|
properties.setAngularVelocityChanged(false);
|
||||||
properties.setAccelerationChanged(false);
|
properties.setAccelerationChanged(false);
|
||||||
}
|
|
||||||
|
|
||||||
// if (wantTerseEditLogging()) {
|
if (wantTerseEditLogging()) {
|
||||||
// if (properties.simulationOwnerChanged()) {
|
qCDebug(entities) << senderNode->getUUID() << "physical edits suppressed";
|
||||||
// qCDebug(entities) << "sim ownership for" << entity->getDebugName() << "is now" << senderID;
|
}
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
// else client accepts what the server says
|
// else client accepts what the server says
|
||||||
|
|
||||||
|
@ -666,10 +664,7 @@ void EntityTree::fixupTerseEditLogging(EntityItemProperties& properties, QList<Q
|
||||||
int index = changedProperties.indexOf("actionData");
|
int index = changedProperties.indexOf("actionData");
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
QByteArray value = properties.getActionData();
|
QByteArray value = properties.getActionData();
|
||||||
QString changeHint = "0";
|
QString changeHint = serializedActionsToDebugString(value);
|
||||||
if (value.size() > 0) {
|
|
||||||
changeHint = "+";
|
|
||||||
}
|
|
||||||
changedProperties[index] = QString("actionData:") + changeHint;
|
changedProperties[index] = QString("actionData:") + changeHint;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -763,7 +758,8 @@ int EntityTree::processEditPacketData(NLPacket& packet, const unsigned char* edi
|
||||||
if (wantTerseEditLogging()) {
|
if (wantTerseEditLogging()) {
|
||||||
QList<QString> changedProperties = properties.listChangedProperties();
|
QList<QString> changedProperties = properties.listChangedProperties();
|
||||||
fixupTerseEditLogging(properties, changedProperties);
|
fixupTerseEditLogging(properties, changedProperties);
|
||||||
qCDebug(entities) << "edit" << existingEntity->getDebugName() << changedProperties;
|
qCDebug(entities) << senderNode->getUUID() << "edit" <<
|
||||||
|
existingEntity->getDebugName() << changedProperties;
|
||||||
}
|
}
|
||||||
endLogging = usecTimestampNow();
|
endLogging = usecTimestampNow();
|
||||||
|
|
||||||
|
@ -793,7 +789,7 @@ int EntityTree::processEditPacketData(NLPacket& packet, const unsigned char* edi
|
||||||
if (wantTerseEditLogging()) {
|
if (wantTerseEditLogging()) {
|
||||||
QList<QString> changedProperties = properties.listChangedProperties();
|
QList<QString> changedProperties = properties.listChangedProperties();
|
||||||
fixupTerseEditLogging(properties, changedProperties);
|
fixupTerseEditLogging(properties, changedProperties);
|
||||||
qCDebug(entities) << "add" << entityItemID << changedProperties;
|
qCDebug(entities) << senderNode->getUUID() << "add" << entityItemID << changedProperties;
|
||||||
}
|
}
|
||||||
endLogging = usecTimestampNow();
|
endLogging = usecTimestampNow();
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ void SimulationOwner::test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SimulationOwner::operator!=(const SimulationOwner& other) {
|
bool SimulationOwner::operator!=(const SimulationOwner& other) {
|
||||||
return (_id != other._id && _priority != other._priority);
|
return (_id != other._id || _priority != other._priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
SimulationOwner& SimulationOwner::operator=(const SimulationOwner& other) {
|
SimulationOwner& SimulationOwner::operator=(const SimulationOwner& other) {
|
||||||
|
|
Loading…
Reference in a new issue