Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions engine/includes/components/component.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class ENGINE_EXPORT Component : public Object {

bool hasTag(const TString &tag);
bool hasTagByHash(uint32_t hash);
const std::vector<uint32_t> &tags() const;

virtual void composeComponent();

Expand Down
16 changes: 14 additions & 2 deletions engine/src/components/actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,20 @@ Actor::Actor() :
}

Actor::~Actor() {
if(m_scene && m_scene->world()) {
m_scene->world()->graphUpdated();
if(m_scene) {
World *world = m_scene->world();
if(world) {
world->graphUpdated();
}

for(auto it : getChildren()) {
Component *component = dynamic_cast<Component *>(it);
if(component) {
for(uint32_t it : component->tags()) {
m_scene->removeFromGroupByHash(component, it);
}
}
}
}
}
/*!
Expand Down
6 changes: 6 additions & 0 deletions engine/src/components/component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ bool Component::hasTag(const TString &tag) {
bool Component::hasTagByHash(uint32_t hash) {
return std::find(m_tags.begin(), m_tags.end(), hash) != m_tags.end();
}
/*!
Returns list of component tags.
*/
const std::vector<uint32_t> &Component::tags() const {
return m_tags;
}
/*!
\internal
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,16 @@ void DeleteObjects::redo() {
}
}

m_controller->clear();
m_controller->selectActors(list);

for(auto it : m_objects) {
Object *object = Engine::findObject(it);
if(object) {
delete object;
}
}

m_controller->clear();
m_controller->selectActors(list);

for(auto it : scenes) {
emit m_controller->sceneUpdated(it);
}
Expand Down
Loading