mirror of
https://github.com/lubosz/overte.git
synced 2025-04-18 14:58:30 +02:00
merge andrew/thermonuclear into andrew/inertia
Conflicts: libraries/entities/src/EntityTree.cpp libraries/entities/src/EntityTree.h
This commit is contained in:
commit
051b04402f
3 changed files with 10 additions and 22 deletions
|
@ -74,28 +74,13 @@ EntityItem* EntityTree::getOrCreateEntityItem(const EntityItemID& entityID, cons
|
|||
}
|
||||
|
||||
/// Adds a new entity item to the tree
|
||||
void EntityTree::addEntityInternal(EntityItem* entity) {
|
||||
// You should not call this on existing entities that are already part of the tree! Call updateEntity()
|
||||
EntityItemID entityID = entity->getEntityItemID();
|
||||
EntityTreeElement* containingElement = getContainingElement(entityID);
|
||||
if (containingElement) {
|
||||
// should probably assert here
|
||||
qDebug() << "UNEXPECTED!!!! don't call addEntityInternal() on existing EntityItems. entityID=" << entityID;
|
||||
return;
|
||||
}
|
||||
|
||||
// Recurse the tree and store the entity in the correct tree element
|
||||
AddEntityOperator theOperator(this, entity);
|
||||
recurseTreeWithOperator(&theOperator);
|
||||
|
||||
void EntityTree::postAddEntity(EntityItem* entity) {
|
||||
assert(entity);
|
||||
// check to see if we need to simulate this entity..
|
||||
if (_simulation) {
|
||||
_simulation->addEntity(entityItem);
|
||||
_simulation->addEntity(entity);
|
||||
}
|
||||
|
||||
_isDirty = true;
|
||||
|
||||
// finally emit the signal
|
||||
emit addingEntity(entity->getEntityItemID());
|
||||
}
|
||||
|
||||
|
@ -176,8 +161,11 @@ EntityItem* EntityTree::addEntity(const EntityItemID& entityID, const EntityItem
|
|||
result = EntityTypes::constructEntityItem(type, entityID, properties);
|
||||
|
||||
if (result) {
|
||||
// this does the actual adding of the entity
|
||||
addEntityInternal(result);
|
||||
// Recurse the tree and store the entity in the correct tree element
|
||||
AddEntityOperator theOperator(this, result);
|
||||
recurseTreeWithOperator(&theOperator);
|
||||
|
||||
postAddEntity(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public:
|
|||
|
||||
// The newer API...
|
||||
EntityItem* getOrCreateEntityItem(const EntityItemID& entityID, const EntityItemProperties& properties);
|
||||
void addEntityInternal(EntityItem* entityItem);
|
||||
void postAddEntity(EntityItem* entityItem);
|
||||
|
||||
EntityItem* addEntity(const EntityItemID& entityID, const EntityItemProperties& properties);
|
||||
bool updateEntity(const EntityItemID& entityID, const EntityItemProperties& properties);
|
||||
|
|
|
@ -771,7 +771,7 @@ int EntityTreeElement::readElementDataFromBuffer(const unsigned char* data, int
|
|||
addEntityItem(entityItem); // add this new entity to this elements entities
|
||||
entityItemID = entityItem->getEntityItemID();
|
||||
_myTree->setContainingElement(entityItemID, this);
|
||||
_myTree->emitAddingEntity(entityItemID); // we just added an entity
|
||||
_myTree->postAddEntity(entityItem);
|
||||
}
|
||||
}
|
||||
// Move the buffer forward to read more entities
|
||||
|
|
Loading…
Reference in a new issue