only send queryAABox if something about the location changed

This commit is contained in:
Seth Alves 2015-12-15 16:17:49 -08:00
parent 0ac06bad5c
commit 951db42146
3 changed files with 12 additions and 2 deletions

View file

@ -1784,3 +1784,7 @@ QList<QString> EntityItemProperties::listChangedProperties() {
bool EntityItemProperties::parentDependentPropertyChanged() const {
return localPositionChanged() || positionChanged() || localRotationChanged() || rotationChanged();
}
bool EntityItemProperties::parentRelatedPropertyChanged() const {
return parentDependentPropertyChanged() || parentIDChanged() || parentJointIndexChanged();
}

View file

@ -84,6 +84,7 @@ public:
EntityPropertyFlags getChangedProperties() const;
bool parentDependentPropertyChanged() const; // was there a changed in a property that requires parent info to interpret?
bool parentRelatedPropertyChanged() const; // parentDependentPropertyChanged or parentID or parentJointIndex
AABox getAABox() const;

View file

@ -134,7 +134,10 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties
auto nodeList = DependencyManager::get<NodeList>();
const QUuid myNodeID = nodeList->getSessionUUID();
propertiesWithSimID.setSimulationOwner(myNodeID, SCRIPT_EDIT_SIMULATION_PRIORITY);
propertiesWithSimID.setQueryAACube(entity->getQueryAACube());
if (propertiesWithSimID.parentRelatedPropertyChanged()) {
// due to parenting, the server may not know where something is in world-space, so include the bounding cube.
propertiesWithSimID.setQueryAACube(entity->getQueryAACube());
}
// and make note of it now, so we can act on it right away.
entity->setSimulationOwner(myNodeID, SCRIPT_EDIT_SIMULATION_PRIORITY);
@ -272,7 +275,9 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties&
entity->flagForOwnership();
}
}
properties.setQueryAACube(entity->getQueryAACube());
if (properties.parentRelatedPropertyChanged()) {
properties.setQueryAACube(entity->getQueryAACube());
}
entity->setLastBroadcast(usecTimestampNow());
}
});