mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 19:41:20 +02:00
Merge pull request #4227 from huffman/internal-delete-fix
Add force delete to internal EntityTree deletes
This commit is contained in:
commit
97f888b340
2 changed files with 7 additions and 7 deletions
|
@ -228,7 +228,7 @@ void EntityTree::setSimulation(EntitySimulation* simulation) {
|
||||||
_simulation = simulation;
|
_simulation = simulation;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTree::deleteEntity(const EntityItemID& entityID) {
|
void EntityTree::deleteEntity(const EntityItemID& entityID, bool force) {
|
||||||
EntityTreeElement* containingElement = getContainingElement(entityID);
|
EntityTreeElement* containingElement = getContainingElement(entityID);
|
||||||
if (!containingElement) {
|
if (!containingElement) {
|
||||||
qDebug() << "UNEXPECTED!!!! EntityTree::deleteEntity() entityID doesn't exist!!! entityID=" << entityID;
|
qDebug() << "UNEXPECTED!!!! EntityTree::deleteEntity() entityID doesn't exist!!! entityID=" << entityID;
|
||||||
|
@ -241,7 +241,7 @@ void EntityTree::deleteEntity(const EntityItemID& entityID) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (existingEntity->getLocked()) {
|
if (existingEntity->getLocked() && !force) {
|
||||||
qDebug() << "ERROR! EntityTree::deleteEntity() trying to delete locked entity. entityID=" << entityID;
|
qDebug() << "ERROR! EntityTree::deleteEntity() trying to delete locked entity. entityID=" << entityID;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ void EntityTree::deleteEntity(const EntityItemID& entityID) {
|
||||||
_isDirty = true;
|
_isDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTree::deleteEntities(QSet<EntityItemID> entityIDs) {
|
void EntityTree::deleteEntities(QSet<EntityItemID> entityIDs, bool force) {
|
||||||
// NOTE: callers must lock the tree before using this method
|
// NOTE: callers must lock the tree before using this method
|
||||||
DeleteEntityOperator theOperator(this);
|
DeleteEntityOperator theOperator(this);
|
||||||
foreach(const EntityItemID& entityID, entityIDs) {
|
foreach(const EntityItemID& entityID, entityIDs) {
|
||||||
|
@ -271,7 +271,7 @@ void EntityTree::deleteEntities(QSet<EntityItemID> entityIDs) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (existingEntity->getLocked()) {
|
if (existingEntity->getLocked() && !force) {
|
||||||
qDebug() << "ERROR! EntityTree::deleteEntities() trying to delete locked entity. entityID=" << entityID;
|
qDebug() << "ERROR! EntityTree::deleteEntities() trying to delete locked entity. entityID=" << entityID;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -667,7 +667,7 @@ void EntityTree::update() {
|
||||||
foreach (EntityItem* entity, entitiesToDelete) {
|
foreach (EntityItem* entity, entitiesToDelete) {
|
||||||
idsToDelete.insert(entity->getEntityItemID());
|
idsToDelete.insert(entity->getEntityItemID());
|
||||||
}
|
}
|
||||||
deleteEntities(idsToDelete);
|
deleteEntities(idsToDelete, true);
|
||||||
}
|
}
|
||||||
unlock();
|
unlock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,8 +91,8 @@ public:
|
||||||
// use this method if you have a pointer to the entity (avoid an extra entity lookup)
|
// use this method if you have a pointer to the entity (avoid an extra entity lookup)
|
||||||
bool updateEntity(EntityItem* entity, const EntityItemProperties& properties);
|
bool updateEntity(EntityItem* entity, const EntityItemProperties& properties);
|
||||||
|
|
||||||
void deleteEntity(const EntityItemID& entityID);
|
void deleteEntity(const EntityItemID& entityID, bool force = false);
|
||||||
void deleteEntities(QSet<EntityItemID> entityIDs);
|
void deleteEntities(QSet<EntityItemID> entityIDs, bool force = false);
|
||||||
void removeEntityFromSimulation(EntityItem* entity);
|
void removeEntityFromSimulation(EntityItem* entity);
|
||||||
|
|
||||||
const EntityItem* findClosestEntity(glm::vec3 position, float targetRadius);
|
const EntityItem* findClosestEntity(glm::vec3 position, float targetRadius);
|
||||||
|
|
Loading…
Reference in a new issue