Skip to content

Commit e375df1

Browse files
committed
resolve conflict between focus and fake root nodes
this will protect promoted fake root nodes from being depopulated when focusing on another part
1 parent 087f875 commit e375df1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lua/pac3/editor/client/panels/tree.lua

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ do
310310
v.dormant_node = false
311311
v.focused = false
312312
if not children[v] then
313+
if v.fake_root_parent then continue end
313314
parts[v] = v
314315
end
315316
end
@@ -337,6 +338,9 @@ do
337338
part.fake_root = false
338339
part.no_populate_because_of_fakenode = nil
339340
if IsValid(node) then node:Remove() end
341+
for i,v in pairs(part:GetChildrenList()) do
342+
v.fake_root_parent = false
343+
end
340344
pace.RefreshTree(true)
341345
return
342346
end
@@ -350,6 +354,9 @@ do
350354
if IsValid(node) then
351355
node:Remove()
352356
end
357+
for i,v in pairs(part:GetChildrenList()) do
358+
v.fake_root_parent = true
359+
end
353360

354361
pace.RefreshTree(true)
355362
end
@@ -677,9 +684,9 @@ end
677684

678685
function PANEL:PopulateParts(node, parts, children, dormant)
679686
self.populated = true
680-
if node.part and node.part.no_populate and not node.part.no_populate_because_of_fakenode then node:Remove() return end
687+
if node.part and node.part.no_populate and not node.part.no_populate_because_of_fakenode and not node.part.fake_root_parent then node:Remove() return end
681688
if pace.fake_root_nodes then
682-
if pace.fake_root_nodes[node.part] and node ~= node.part.fake_root_node then return end
689+
if pace.fake_root_nodes[node.part] and node ~= node.part.fake_root_node and not node.part.fake_root_parent then return end
683690
end
684691
fix_folder_funcs(node)
685692

0 commit comments

Comments
 (0)