mirror of
https://github.com/lubosz/overte.git
synced 2025-04-25 08:43:56 +02:00
disable positionand velocity script edits on grabbed entities
This commit is contained in:
parent
bf46960dc3
commit
3ccbd0bc7b
5 changed files with 26 additions and 0 deletions
|
@ -3595,6 +3595,18 @@ bool EntityItemProperties::hasTransformOrVelocityChanges() const {
|
||||||
|| _accelerationChanged;
|
|| _accelerationChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EntityItemProperties::clearTransformOrVelocityChanges() {
|
||||||
|
_positionChanged = false;
|
||||||
|
_localPositionChanged = false;
|
||||||
|
_rotationChanged = false;
|
||||||
|
_localRotationChanged = false;
|
||||||
|
_velocityChanged = false;
|
||||||
|
_localVelocityChanged = false;
|
||||||
|
_angularVelocityChanged = false;
|
||||||
|
_localAngularVelocityChanged = false;
|
||||||
|
_accelerationChanged = false;
|
||||||
|
}
|
||||||
|
|
||||||
bool EntityItemProperties::hasMiscPhysicsChanges() const {
|
bool EntityItemProperties::hasMiscPhysicsChanges() const {
|
||||||
return _gravityChanged || _dimensionsChanged || _densityChanged || _frictionChanged
|
return _gravityChanged || _dimensionsChanged || _densityChanged || _frictionChanged
|
||||||
|| _restitutionChanged || _dampingChanged || _angularDampingChanged || _registrationPointChanged ||
|
|| _restitutionChanged || _dampingChanged || _angularDampingChanged || _registrationPointChanged ||
|
||||||
|
|
|
@ -390,6 +390,7 @@ public:
|
||||||
void setCreated(QDateTime& v);
|
void setCreated(QDateTime& v);
|
||||||
|
|
||||||
bool hasTransformOrVelocityChanges() const;
|
bool hasTransformOrVelocityChanges() const;
|
||||||
|
void clearTransformOrVelocityChanges();
|
||||||
bool hasMiscPhysicsChanges() const;
|
bool hasMiscPhysicsChanges() const;
|
||||||
|
|
||||||
bool hasSimulationRestrictedChanges() const;
|
bool hasSimulationRestrictedChanges() const;
|
||||||
|
|
|
@ -816,6 +816,10 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties&
|
||||||
|
|
||||||
QString previousUserdata;
|
QString previousUserdata;
|
||||||
if (entity) {
|
if (entity) {
|
||||||
|
if (properties.hasTransformOrVelocityChanges() && entity->hasGrabs()) {
|
||||||
|
// if an entity is grabbed, the grab will override any position changes
|
||||||
|
properties.clearTransformOrVelocityChanges();
|
||||||
|
}
|
||||||
if (properties.hasSimulationRestrictedChanges()) {
|
if (properties.hasSimulationRestrictedChanges()) {
|
||||||
if (_bidOnSimulationOwnership) {
|
if (_bidOnSimulationOwnership) {
|
||||||
// flag for simulation ownership, or upgrade existing ownership priority
|
// flag for simulation ownership, or upgrade existing ownership priority
|
||||||
|
|
|
@ -1386,6 +1386,14 @@ void SpatiallyNestable::removeGrab(GrabPointer grab) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SpatiallyNestable::hasGrabs() {
|
||||||
|
bool result { false };
|
||||||
|
_grabsLock.withReadLock([&] {
|
||||||
|
result = !_grabs.isEmpty();
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
QUuid SpatiallyNestable::getEditSenderID() {
|
QUuid SpatiallyNestable::getEditSenderID() {
|
||||||
// if more than one avatar is grabbing something, decide which one should tell the enity-server about it
|
// if more than one avatar is grabbing something, decide which one should tell the enity-server about it
|
||||||
QUuid editSenderID;
|
QUuid editSenderID;
|
||||||
|
|
|
@ -216,6 +216,7 @@ public:
|
||||||
|
|
||||||
virtual void addGrab(GrabPointer grab);
|
virtual void addGrab(GrabPointer grab);
|
||||||
virtual void removeGrab(GrabPointer grab);
|
virtual void removeGrab(GrabPointer grab);
|
||||||
|
bool hasGrabs();
|
||||||
virtual QUuid getEditSenderID();
|
virtual QUuid getEditSenderID();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in a new issue