mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 16:55:07 +02:00
fix for not properly filtering entity adds
This commit is contained in:
parent
08d30608c7
commit
e6969321ca
2 changed files with 5 additions and 7 deletions
|
@ -48,7 +48,7 @@ bool EntityEditFilters::filter(glm::vec3& position, EntityItemProperties& proper
|
|||
// lies within
|
||||
auto zoneIDs = getZonesByPosition(position);
|
||||
for (auto id : zoneIDs) {
|
||||
if (id == itemID) {
|
||||
if (!itemID.isInvalidID() && id == itemID) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ bool EntityEditFilters::filter(glm::vec3& position, EntityItemProperties& proper
|
|||
|
||||
QScriptValue result = filterData.filterFn.call(_nullObjectForFilter, args);
|
||||
if (filterData.uncaughtExceptions()) {
|
||||
result = QScriptValue();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (result.isObject()){
|
||||
|
@ -87,8 +87,6 @@ bool EntityEditFilters::filter(glm::vec3& position, EntityItemProperties& proper
|
|||
auto out = QJsonValue::fromVariant(result.toVariant());
|
||||
wasChanged |= (in != out);
|
||||
} else {
|
||||
// an edit was rejected, so we stop here and return false
|
||||
qCDebug(entities) << "Edit rejected by filter " << id ;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -928,9 +928,9 @@ void EntityTree::fixupTerseEditLogging(EntityItemProperties& properties, QList<Q
|
|||
bool EntityTree::filterProperties(EntityItemPointer& existingEntity, EntityItemProperties& propertiesIn, EntityItemProperties& propertiesOut, bool& wasChanged, FilterType filterType) {
|
||||
bool accepted = true;
|
||||
auto entityEditFilters = DependencyManager::get<EntityEditFilters>();
|
||||
if (entityEditFilters && existingEntity) {
|
||||
auto position = existingEntity->getPosition();
|
||||
auto entityID = existingEntity->getEntityItemID();
|
||||
if (entityEditFilters) {
|
||||
auto position = existingEntity ? existingEntity->getPosition() : propertiesIn.getPosition();
|
||||
auto entityID = existingEntity ? existingEntity->getEntityItemID() : EntityItemID();
|
||||
accepted = entityEditFilters->filter(position, propertiesIn, propertiesOut, wasChanged, filterType, entityID);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue