mirror of
https://github.com/lubosz/overte.git
synced 2025-04-16 09:29:16 +02:00
allow ESS to edit local version of properties even if the entity isn't in the ESS's local octree
This commit is contained in:
parent
74ca98dc81
commit
71d6dbf9bf
2 changed files with 27 additions and 0 deletions
|
@ -502,6 +502,12 @@ inline QDebug operator<<(QDebug debug, const EntityItemProperties& properties) {
|
|||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, CertificateID, certificateID, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, StaticCertificateVersion, staticCertificateVersion, "");
|
||||
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, LocalPosition, localPosition, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, LocalRotation, localRotation, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, LocalVelocity, localVelocity, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, LocalAngularVelocity, localAngularVelocity, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, LocalDimensions, localDimensions, "");
|
||||
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, HazeMode, hazeMode, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, KeyLightMode, keyLightMode, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, AmbientLightMode, ambientLightMode, "");
|
||||
|
|
|
@ -523,6 +523,27 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties&
|
|||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Sometimes ESS don't have the entity they are trying to edit in their local tree. In this case,
|
||||
// convertPropertiesFromScriptSemantics doesn't get called and local* edits will get dropped.
|
||||
// This is because, on the script side, "position" is in world frame, but in the network
|
||||
// protocol and in the internal data-structures, "position" is "relative to parent".
|
||||
// Compensate here. The local* versions will get ignored during the edit-packet encoding.
|
||||
if (properties.localPositionChanged()) {
|
||||
properties.setPosition(properties.getLocalPosition());
|
||||
}
|
||||
if (properties.localRotationChanged()) {
|
||||
properties.setRotation(properties.getLocalRotation());
|
||||
}
|
||||
if (properties.localVelocityChanged()) {
|
||||
properties.setVelocity(properties.getLocalVelocity());
|
||||
}
|
||||
if (properties.localAngularVelocityChanged()) {
|
||||
properties.setAngularVelocity(properties.getLocalAngularVelocity());
|
||||
}
|
||||
if (properties.localDimensionsChanged()) {
|
||||
properties.setDimensions(properties.getLocalDimensions());
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!entityFound) {
|
||||
|
|
Loading…
Reference in a new issue