mirror of
https://github.com/lubosz/overte.git
synced 2025-04-13 13:13:19 +02:00
Merge pull request #4285 from ZappoMan/editLogging
added logging of edit commands in the server
This commit is contained in:
commit
76b10a60ba
7 changed files with 84 additions and 6 deletions
|
@ -147,3 +147,14 @@ void EntityServer::pruneDeletedEntities() {
|
|||
}
|
||||
}
|
||||
|
||||
void EntityServer::readAdditionalConfiguration(const QJsonObject& settingsSectionObject) {
|
||||
bool wantEditLogging = false;
|
||||
readOptionBool(QString("wantEditLogging"), settingsSectionObject, wantEditLogging);
|
||||
qDebug("wantEditLogging=%s", debug::valueOf(wantEditLogging));
|
||||
|
||||
|
||||
EntityTree* tree = static_cast<EntityTree*>(_tree);
|
||||
tree->setWantEditLogging(wantEditLogging);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ public:
|
|||
virtual int sendSpecialPacket(const SharedNodePointer& node, OctreeQueryNode* queryNode, int& packetsSent);
|
||||
|
||||
virtual void entityCreated(const EntityItem& newEntity, const SharedNodePointer& senderNode);
|
||||
virtual void readAdditionalConfiguration(const QJsonObject& settingsSectionObject);
|
||||
|
||||
public slots:
|
||||
void pruneDeletedEntities();
|
||||
|
|
|
@ -409,6 +409,13 @@
|
|||
"default": "",
|
||||
"advanced": true
|
||||
},
|
||||
{
|
||||
"name": "wantEditLogging",
|
||||
"type": "checkbox",
|
||||
"help": "Logging of all edits to entities",
|
||||
"default": true,
|
||||
"advanced": true
|
||||
},
|
||||
{
|
||||
"name": "verboseDebug",
|
||||
"type": "checkbox",
|
||||
|
|
|
@ -194,6 +194,7 @@ public:
|
|||
bool containsBoundsProperties() const { return (_positionChanged || _dimensionsChanged); }
|
||||
bool containsPositionChange() const { return _positionChanged; }
|
||||
bool containsDimensionsChange() const { return _dimensionsChanged; }
|
||||
bool containsAnimationSettingsChange() const { return _animationSettingsChanged; }
|
||||
|
||||
float getGlowLevel() const { return _glowLevel; }
|
||||
float getLocalRenderAlpha() const { return _localRenderAlpha; }
|
||||
|
@ -256,12 +257,57 @@ inline void EntityItemProperties::setPosition(const glm::vec3& value)
|
|||
|
||||
|
||||
inline QDebug operator<<(QDebug debug, const EntityItemProperties& properties) {
|
||||
debug << "EntityItemProperties[" << "\n"
|
||||
<< " position:" << properties.getPosition() << "in meters" << "\n"
|
||||
<< " velocity:" << properties.getVelocity() << "in meters" << "\n"
|
||||
<< " last edited:" << properties.getLastEdited() << "\n"
|
||||
<< " edited ago:" << properties.getEditedAgo() << "\n"
|
||||
<< "]";
|
||||
debug << "EntityItemProperties[" << "\n";
|
||||
|
||||
// TODO: figure out why position and animationSettings don't seem to like the macro approach
|
||||
if (properties.containsPositionChange()) {
|
||||
debug << " position:" << properties.getPosition() << "in meters" << "\n";
|
||||
}
|
||||
if (properties.containsAnimationSettingsChange()) {
|
||||
debug << " animationSettings:" << properties.getAnimationSettings() << "\n";
|
||||
}
|
||||
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Dimensions, dimensions, "in meters");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Velocity, velocity, "in meters");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Visible, visible, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Rotation, rotation, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Density, density, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Gravity, gravity, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Damping, damping, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Lifetime, lifetime, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Script, script, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Color, color, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, ModelURL, modelURL, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, AnimationURL, animationURL, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, AnimationFPS, animationFPS, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, AnimationFrameIndex, animationFrameIndex, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, AnimationIsPlaying, animationIsPlaying, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, RegistrationPoint, registrationPoint, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, AngularVelocity, angularVelocity, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, AngularDamping, angularDamping, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, IgnoreForCollisions, ignoreForCollisions, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, CollisionsWillMove, collisionsWillMove, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, IsSpotlight, isSpotlight, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, DiffuseColor, diffuseColor, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, AmbientColor, ambientColor, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, SpecularColor, specularColor, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, ConstantAttenuation, constantAttenuation, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, LinearAttenuation, linearAttenuation, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, QuadraticAttenuation, quadraticAttenuation, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Exponent, exponent, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Cutoff, cutoff, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Locked, locked, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Textures, textures, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, UserData, userData, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Text, text, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, LineHeight, lineHeight, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, TextColor, textColor, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, BackgroundColor, backgroundColor, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, ShapeType, shapeType, "");
|
||||
|
||||
debug << " last edited:" << properties.getLastEdited() << "\n";
|
||||
debug << " edited ago:" << properties.getEditedAgo() << "\n";
|
||||
debug << "]";
|
||||
|
||||
return debug;
|
||||
}
|
||||
|
|
|
@ -321,6 +321,10 @@
|
|||
T _##n; \
|
||||
bool _##n##Changed;
|
||||
|
||||
#define DEBUG_PROPERTY_IF_CHANGED(D, P, N, n, x) \
|
||||
if (P.n##Changed()) { \
|
||||
D << " " << #n << ":" << P.get##N() << x << "\n"; \
|
||||
}
|
||||
|
||||
|
||||
#endif // hifi_EntityItemPropertiesMacros_h
|
||||
|
|
|
@ -592,6 +592,10 @@ int EntityTree::processEditPacketData(PacketType packetType, const unsigned char
|
|||
|
||||
// if the EntityItem exists, then update it
|
||||
if (existingEntity) {
|
||||
if (wantEditLogging()) {
|
||||
qDebug() << "User [" << senderNode->getUUID() << "] editing entity. ID:" << entityItemID;
|
||||
qDebug() << " properties:" << properties;
|
||||
}
|
||||
updateEntity(entityItemID, properties, senderNode->getCanAdjustLocks());
|
||||
existingEntity->markAsChangedOnServer();
|
||||
} else {
|
||||
|
|
|
@ -151,6 +151,9 @@ public:
|
|||
void emitEntityScriptChanging(const EntityItemID& entityItemID);
|
||||
|
||||
void setSimulation(EntitySimulation* simulation);
|
||||
|
||||
bool wantEditLogging() const { return _wantEditLogging; }
|
||||
void setWantEditLogging(bool value) { _wantEditLogging = value; }
|
||||
|
||||
signals:
|
||||
void deletingEntity(const EntityItemID& entityID);
|
||||
|
@ -180,6 +183,8 @@ private:
|
|||
QHash<EntityItemID, EntityTreeElement*> _entityToElementMap;
|
||||
|
||||
EntitySimulation* _simulation;
|
||||
|
||||
bool _wantEditLogging = false;
|
||||
};
|
||||
|
||||
#endif // hifi_EntityTree_h
|
||||
|
|
Loading…
Reference in a new issue