mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 03:48:38 +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
|
/// Adds a new entity item to the tree
|
||||||
void EntityTree::addEntityInternal(EntityItem* entity) {
|
void EntityTree::postAddEntity(EntityItem* entity) {
|
||||||
// You should not call this on existing entities that are already part of the tree! Call updateEntity()
|
assert(entity);
|
||||||
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);
|
|
||||||
|
|
||||||
// check to see if we need to simulate this entity..
|
// check to see if we need to simulate this entity..
|
||||||
if (_simulation) {
|
if (_simulation) {
|
||||||
_simulation->addEntity(entityItem);
|
_simulation->addEntity(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
_isDirty = true;
|
_isDirty = true;
|
||||||
|
|
||||||
// finally emit the signal
|
|
||||||
emit addingEntity(entity->getEntityItemID());
|
emit addingEntity(entity->getEntityItemID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,8 +161,11 @@ EntityItem* EntityTree::addEntity(const EntityItemID& entityID, const EntityItem
|
||||||
result = EntityTypes::constructEntityItem(type, entityID, properties);
|
result = EntityTypes::constructEntityItem(type, entityID, properties);
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
// this does the actual adding of the entity
|
// Recurse the tree and store the entity in the correct tree element
|
||||||
addEntityInternal(result);
|
AddEntityOperator theOperator(this, result);
|
||||||
|
recurseTreeWithOperator(&theOperator);
|
||||||
|
|
||||||
|
postAddEntity(result);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ public:
|
||||||
|
|
||||||
// The newer API...
|
// The newer API...
|
||||||
EntityItem* getOrCreateEntityItem(const EntityItemID& entityID, const EntityItemProperties& properties);
|
EntityItem* getOrCreateEntityItem(const EntityItemID& entityID, const EntityItemProperties& properties);
|
||||||
void addEntityInternal(EntityItem* entityItem);
|
void postAddEntity(EntityItem* entityItem);
|
||||||
|
|
||||||
EntityItem* addEntity(const EntityItemID& entityID, const EntityItemProperties& properties);
|
EntityItem* addEntity(const EntityItemID& entityID, const EntityItemProperties& properties);
|
||||||
bool updateEntity(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
|
addEntityItem(entityItem); // add this new entity to this elements entities
|
||||||
entityItemID = entityItem->getEntityItemID();
|
entityItemID = entityItem->getEntityItemID();
|
||||||
_myTree->setContainingElement(entityItemID, this);
|
_myTree->setContainingElement(entityItemID, this);
|
||||||
_myTree->emitAddingEntity(entityItemID); // we just added an entity
|
_myTree->postAddEntity(entityItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Move the buffer forward to read more entities
|
// Move the buffer forward to read more entities
|
||||||
|
|
Loading…
Reference in a new issue