mirror of
https://github.com/overte-org/overte.git
synced 2025-04-24 21:55:53 +02:00
Fix entity payloads not being removed on delete
This commit is contained in:
parent
ba5eab7460
commit
37d9394140
2 changed files with 4 additions and 5 deletions
|
@ -1000,13 +1000,12 @@ void EntityTreeRenderer::deletingEntity(const EntityItemID& entityID) {
|
|||
_entityScripts.remove(entityID);
|
||||
|
||||
// here's where we remove the entity payload from the scene
|
||||
auto entity = static_cast<EntityTree*>(_tree)->findEntityByID(entityID);
|
||||
if (entity && _entitiesInScene.contains(entity)) {
|
||||
if (_entitiesInScene.contains(entityID)) {
|
||||
auto entity = _entitiesInScene.take(entityID);
|
||||
render::PendingChanges pendingChanges;
|
||||
auto scene = _viewState->getMain3DScene();
|
||||
entity->removeFromScene(entity, scene, pendingChanges);
|
||||
scene->enqueuePendingChanges(pendingChanges);
|
||||
_entitiesInScene.remove(entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1021,7 +1020,7 @@ void EntityTreeRenderer::addEntityToScene(EntityItemPointer entity) {
|
|||
render::PendingChanges pendingChanges;
|
||||
auto scene = _viewState->getMain3DScene();
|
||||
if (entity->addToScene(entity, scene, pendingChanges)) {
|
||||
_entitiesInScene.insert(entity);
|
||||
_entitiesInScene.insert(entity->getEntityItemID(), entity);
|
||||
}
|
||||
scene->enqueuePendingChanges(pendingChanges);
|
||||
}
|
||||
|
|
|
@ -188,7 +188,7 @@ private:
|
|||
float _previousStageHour;
|
||||
int _previousStageDay;
|
||||
|
||||
QSet<EntityItemPointer> _entitiesInScene;
|
||||
QHash<EntityItemID, EntityItemPointer> _entitiesInScene;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue