mirror of
https://github.com/lubosz/overte.git
synced 2025-08-17 06:09:12 +02:00
Add add/delete/rename/clear events to EntitiesScriptingInterface
This commit is contained in:
parent
36c14de250
commit
5c9ec6bdcc
4 changed files with 28 additions and 1 deletions
|
@ -35,6 +35,25 @@ bool EntityScriptingInterface::canAdjustLocks() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EntityScriptingInterface::setEntityTree(EntityTree* modelTree) {
|
||||||
|
if (_entityTree) {
|
||||||
|
disconnect(_entityTree, &EntityTree::addingEntity, this, &EntityScriptingInterface::addingEntity);
|
||||||
|
disconnect(_entityTree, &EntityTree::deletingEntity, this, &EntityScriptingInterface::deletingEntity);
|
||||||
|
disconnect(_entityTree, &EntityTree::changingEntityID, this, &EntityScriptingInterface::changingEntityID);
|
||||||
|
disconnect(_entityTree, &EntityTree::clearingEntities, this, &EntityScriptingInterface::clearingEntities);
|
||||||
|
}
|
||||||
|
|
||||||
|
_entityTree = modelTree;
|
||||||
|
|
||||||
|
if (_entityTree) {
|
||||||
|
connect(_entityTree, &EntityTree::addingEntity, this, &EntityScriptingInterface::addingEntity);
|
||||||
|
connect(_entityTree, &EntityTree::deletingEntity, this, &EntityScriptingInterface::deletingEntity);
|
||||||
|
connect(_entityTree, &EntityTree::changingEntityID, this, &EntityScriptingInterface::changingEntityID);
|
||||||
|
connect(_entityTree, &EntityTree::clearingEntities, this, &EntityScriptingInterface::clearingEntities);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
EntityItemID EntityScriptingInterface::addEntity(const EntityItemProperties& properties) {
|
EntityItemID EntityScriptingInterface::addEntity(const EntityItemProperties& properties) {
|
||||||
|
|
||||||
// The application will keep track of creatorTokenID
|
// The application will keep track of creatorTokenID
|
||||||
|
|
|
@ -58,7 +58,7 @@ public:
|
||||||
virtual NodeType_t getServerNodeType() const { return NodeType::EntityServer; }
|
virtual NodeType_t getServerNodeType() const { return NodeType::EntityServer; }
|
||||||
virtual OctreeEditPacketSender* createPacketSender() { return new EntityEditPacketSender(); }
|
virtual OctreeEditPacketSender* createPacketSender() { return new EntityEditPacketSender(); }
|
||||||
|
|
||||||
void setEntityTree(EntityTree* modelTree) { _entityTree = modelTree; }
|
void setEntityTree(EntityTree* modelTree);
|
||||||
EntityTree* getEntityTree(EntityTree*) { return _entityTree; }
|
EntityTree* getEntityTree(EntityTree*) { return _entityTree; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -129,6 +129,11 @@ signals:
|
||||||
void enterEntity(const EntityItemID& entityItemID);
|
void enterEntity(const EntityItemID& entityItemID);
|
||||||
void leaveEntity(const EntityItemID& entityItemID);
|
void leaveEntity(const EntityItemID& entityItemID);
|
||||||
|
|
||||||
|
void deletingEntity(const EntityItemID& entityID);
|
||||||
|
void addingEntity(const EntityItemID& entityID);
|
||||||
|
void changingEntityID(const EntityItemID& oldEntityID, const EntityItemID& newEntityID);
|
||||||
|
void clearingEntities();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void queueEntityMessage(PacketType packetType, EntityItemID entityID, const EntityItemProperties& properties);
|
void queueEntityMessage(PacketType packetType, EntityItemID entityID, const EntityItemProperties& properties);
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,8 @@ EntityTreeElement* EntityTree::createNewElement(unsigned char * octalCode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTree::eraseAllOctreeElements(bool createNewRoot) {
|
void EntityTree::eraseAllOctreeElements(bool createNewRoot) {
|
||||||
|
emit clearingEntities();
|
||||||
|
|
||||||
// this would be a good place to clean up our entities...
|
// this would be a good place to clean up our entities...
|
||||||
if (_simulation) {
|
if (_simulation) {
|
||||||
_simulation->lock();
|
_simulation->lock();
|
||||||
|
|
|
@ -163,6 +163,7 @@ signals:
|
||||||
void addingEntity(const EntityItemID& entityID);
|
void addingEntity(const EntityItemID& entityID);
|
||||||
void entityScriptChanging(const EntityItemID& entityItemID);
|
void entityScriptChanging(const EntityItemID& entityItemID);
|
||||||
void changingEntityID(const EntityItemID& oldEntityID, const EntityItemID& newEntityID);
|
void changingEntityID(const EntityItemID& oldEntityID, const EntityItemID& newEntityID);
|
||||||
|
void clearingEntities();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue