Notifications
Clear all
[Closed] LayerManager, remove layers within a loop
Jul 26, 2017 4:24 pm
Hi,
So I get a weird error when executing this:
for L=1 to LayerManager.count-1 do (
if NOT ((LayerManager.getLayer L).name == "fbx") do (
n = (LayerManager.getLayer L).name
--print n
LayerManager.deleteLayerByName n
)
)
-- Unknown property: "name" in undefined
And I need to remove all layers that fbx created on import
2 Replies
Jul 26, 2017 4:24 pm
When itterating over an array which shrinks it’s better to do it in reverse.
for L= (LayerManager.count-1) to 0 by - 1 do (
if NOT ((LayerManager.getLayer L).name == "fbx") do (
n = (LayerManager.getLayer L).name
--print n
LayerManager.deleteLayerByName n
)
)