mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 07:43:35 +02:00
Merge pull request #5063 from huffman/fix-entity-delete-payload
Team Teaching - Fix entity payloads not being removed on delete
This commit is contained in:
commit
4c52076e13
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