mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 09:33:45 +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;
|
||||
}
|
||||
|
||||
void EntityTree::deleteEntity(const EntityItemID& entityID) {
|
||||
void EntityTree::deleteEntity(const EntityItemID& entityID, bool force) {
|
||||
EntityTreeElement* containingElement = getContainingElement(entityID);
|
||||
if (!containingElement) {
|
||||
qDebug() << "UNEXPECTED!!!! EntityTree::deleteEntity() entityID doesn't exist!!! entityID=" << entityID;
|
||||
|
@ -241,7 +241,7 @@ void EntityTree::deleteEntity(const EntityItemID& entityID) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (existingEntity->getLocked()) {
|
||||
if (existingEntity->getLocked() && !force) {
|
||||
qDebug() << "ERROR! EntityTree::deleteEntity() trying to delete locked entity. entityID=" << entityID;
|
||||
return;
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ void EntityTree::deleteEntity(const EntityItemID& entityID) {
|
|||
_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
|
||||
DeleteEntityOperator theOperator(this);
|
||||
foreach(const EntityItemID& entityID, entityIDs) {
|
||||
|
@ -271,7 +271,7 @@ void EntityTree::deleteEntities(QSet<EntityItemID> entityIDs) {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (existingEntity->getLocked()) {
|
||||
if (existingEntity->getLocked() && !force) {
|
||||
qDebug() << "ERROR! EntityTree::deleteEntities() trying to delete locked entity. entityID=" << entityID;
|
||||
continue;
|
||||
}
|
||||
|
@ -667,7 +667,7 @@ void EntityTree::update() {
|
|||
foreach (EntityItem* entity, entitiesToDelete) {
|
||||
idsToDelete.insert(entity->getEntityItemID());
|
||||
}
|
||||
deleteEntities(idsToDelete);
|
||||
deleteEntities(idsToDelete, true);
|
||||
}
|
||||
unlock();
|
||||
}
|
||||
|
|
|
@ -91,8 +91,8 @@ public:
|
|||
// use this method if you have a pointer to the entity (avoid an extra entity lookup)
|
||||
bool updateEntity(EntityItem* entity, const EntityItemProperties& properties);
|
||||
|
||||
void deleteEntity(const EntityItemID& entityID);
|
||||
void deleteEntities(QSet<EntityItemID> entityIDs);
|
||||
void deleteEntity(const EntityItemID& entityID, bool force = false);
|
||||
void deleteEntities(QSet<EntityItemID> entityIDs, bool force = false);
|
||||
void removeEntityFromSimulation(EntityItem* entity);
|
||||
|
||||
const EntityItem* findClosestEntity(glm::vec3 position, float targetRadius);
|
||||
|
|
Loading…
Reference in a new issue