Add ability to filter on zone-type with JSON filter

This commit is contained in:
Simon Walton 2019-02-27 16:42:36 -08:00
parent 59b9831c1d
commit 17c0e40347
2 changed files with 4 additions and 1 deletions

View file

@ -958,7 +958,7 @@ void AvatarMixer::parseDomainServerSettings(const QJsonObject& domainSettings) {
}
void AvatarMixer::setupEntityQuery() {
static char queryJsonString[] = R"({"avatarPriority": true, "serverScripts": "+"})";
static char queryJsonString[] = R"({"avatarPriority": true, "type": "Zone"})";
_entityViewer.init();
DependencyManager::registerInheritance<SpatialParentFinder, AssignmentParentFinder>();

View file

@ -2656,6 +2656,7 @@ bool EntityItem::matchesJSONFilters(const QJsonObject& jsonFilters) const {
// which means that we only handle a filtered query asking for entities where the serverScripts property is non-default
static const QString SERVER_SCRIPTS_PROPERTY = "serverScripts";
static const QString ENTITY_TYPE_PROPERTY = "type";
foreach(const auto& property, jsonFilters.keys()) {
if (property == SERVER_SCRIPTS_PROPERTY && jsonFilters[property] == EntityQueryFilterSymbol::NonDefault) {
@ -2665,6 +2666,8 @@ bool EntityItem::matchesJSONFilters(const QJsonObject& jsonFilters) const {
} else {
return false;
}
} else if (property == ENTITY_TYPE_PROPERTY) {
return (jsonFilters[property] == EntityTypes::getEntityTypeName(getType()) );
}
}