mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-10 10:34:56 +02:00
Merge pull request #6329 from sethalves/fix-grab-release
send to server upon grab release
This commit is contained in:
commit
8eea7ff67c
5 changed files with 27 additions and 7 deletions
|
@ -30,7 +30,7 @@ public:
|
|||
QByteArray serialize() const;
|
||||
virtual void deserialize(QByteArray serializedArguments);
|
||||
|
||||
virtual bool shouldSuppressLocationEdits() { return true; }
|
||||
virtual bool shouldSuppressLocationEdits() { return _active && !_ownerEntity.expired(); }
|
||||
|
||||
private:
|
||||
static const uint16_t holdVersion;
|
||||
|
|
|
@ -611,6 +611,16 @@ EntityItemPointer EntityTree::findEntityByEntityItemID(const EntityItemID& entit
|
|||
return foundEntity;
|
||||
}
|
||||
|
||||
void EntityTree::fixupTerseEditLogging(EntityItemProperties& properties, QList<QString>& changedProperties) {
|
||||
if (properties.simulationOwnerChanged()) {
|
||||
int simIndex = changedProperties.indexOf("simulationOwner");
|
||||
if (simIndex >= 0) {
|
||||
SimulationOwner simOwner = properties.getSimulationOwner();
|
||||
changedProperties[simIndex] = QString("simulationOwner:") + QString::number((int)simOwner.getPriority());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int EntityTree::processEditPacketData(NLPacket& packet, const unsigned char* editData, int maxLength,
|
||||
const SharedNodePointer& senderNode) {
|
||||
|
||||
|
@ -661,7 +671,9 @@ int EntityTree::processEditPacketData(NLPacket& packet, const unsigned char* edi
|
|||
qCDebug(entities) << " properties:" << properties;
|
||||
}
|
||||
if (wantTerseEditLogging()) {
|
||||
qCDebug(entities) << "edit" << entityItemID.toString() << properties.listChangedProperties();
|
||||
QList<QString> changedProperties = properties.listChangedProperties();
|
||||
fixupTerseEditLogging(properties, changedProperties);
|
||||
qCDebug(entities) << "edit" << entityItemID.toString() << changedProperties;
|
||||
}
|
||||
endLogging = usecTimestampNow();
|
||||
|
||||
|
@ -689,7 +701,9 @@ int EntityTree::processEditPacketData(NLPacket& packet, const unsigned char* edi
|
|||
qCDebug(entities) << " properties:" << properties;
|
||||
}
|
||||
if (wantTerseEditLogging()) {
|
||||
qCDebug(entities) << "add" << entityItemID.toString() << properties.listChangedProperties();
|
||||
QList<QString> changedProperties = properties.listChangedProperties();
|
||||
fixupTerseEditLogging(properties, changedProperties);
|
||||
qCDebug(entities) << "add" << entityItemID.toString() << changedProperties;
|
||||
}
|
||||
endLogging = usecTimestampNow();
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ public:
|
|||
virtual bool canProcessVersion(PacketVersion thisVersion) const
|
||||
{ return thisVersion >= VERSION_ENTITIES_USE_METERS_AND_RADIANS; }
|
||||
virtual bool handlesEditPacketType(PacketType packetType) const;
|
||||
void fixupTerseEditLogging(EntityItemProperties& properties, QList<QString>& changedProperties);
|
||||
virtual int processEditPacketData(NLPacket& packet, const unsigned char* editData, int maxLength,
|
||||
const SharedNodePointer& senderNode);
|
||||
|
||||
|
|
|
@ -79,8 +79,13 @@ EntityMotionState::~EntityMotionState() {
|
|||
assert(!_entity);
|
||||
}
|
||||
|
||||
void EntityMotionState::updateServerPhysicsVariables() {
|
||||
void EntityMotionState::updateServerPhysicsVariables(const QUuid& sessionID) {
|
||||
assert(entityTreeIsLocked());
|
||||
if (_entity->getSimulatorID() == sessionID) {
|
||||
// don't slam these values if we are the simulation owner
|
||||
return;
|
||||
}
|
||||
|
||||
_serverPosition = _entity->getPosition();
|
||||
_serverRotation = _entity->getRotation();
|
||||
_serverVelocity = _entity->getVelocity();
|
||||
|
@ -92,7 +97,7 @@ void EntityMotionState::updateServerPhysicsVariables() {
|
|||
// virtual
|
||||
bool EntityMotionState::handleEasyChanges(uint32_t flags, PhysicsEngine* engine) {
|
||||
assert(entityTreeIsLocked());
|
||||
updateServerPhysicsVariables();
|
||||
updateServerPhysicsVariables(engine->getSessionID());
|
||||
ObjectMotionState::handleEasyChanges(flags, engine);
|
||||
|
||||
if (flags & Simulation::DIRTY_SIMULATOR_ID) {
|
||||
|
@ -129,7 +134,7 @@ bool EntityMotionState::handleEasyChanges(uint32_t flags, PhysicsEngine* engine)
|
|||
|
||||
// virtual
|
||||
bool EntityMotionState::handleHardAndEasyChanges(uint32_t flags, PhysicsEngine* engine) {
|
||||
updateServerPhysicsVariables();
|
||||
updateServerPhysicsVariables(engine->getSessionID());
|
||||
return ObjectMotionState::handleHardAndEasyChanges(flags, engine);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
EntityMotionState(btCollisionShape* shape, EntityItemPointer item);
|
||||
virtual ~EntityMotionState();
|
||||
|
||||
void updateServerPhysicsVariables();
|
||||
void updateServerPhysicsVariables(const QUuid& sessionID);
|
||||
virtual bool handleEasyChanges(uint32_t flags, PhysicsEngine* engine);
|
||||
virtual bool handleHardAndEasyChanges(uint32_t flags, PhysicsEngine* engine);
|
||||
|
||||
|
|
Loading…
Reference in a new issue