Add children list to the component

This commit is contained in:
Insality
2020-09-23 01:28:54 +03:00
parent 54a1eda738
commit 71b393b2c2
2 changed files with 42 additions and 8 deletions

View File

@@ -190,16 +190,18 @@ function Druid.remove(self, component)
return
end
local all_components = self.components[const.ALL]
-- Recursive remove all children of component
for i = #all_components, 1, -1 do
local inst = all_components[i]
if inst:is_child_of(component) then
self:remove(inst)
local children = component._meta.children
for i = 1, #children do
self:remove(children[i])
local parent = children[i]:get_parent_component()
if parent then
parent:remove_children(children[i])
end
end
component._meta.children = {}
local all_components = self.components[const.ALL]
for i = #all_components, 1, -1 do
if all_components[i] == component then
if component.on_remove then