So… noticed something odd.
delete objects
deleteAllChangeHandlers id:#del
tPot = teapot()
when tPot deleted id:#del obj do
(
format "obj: %
" obj
format "children: %
" obj.children
)
obj.children returns empty.
Since the when construct is still able to recognize the node that it is working with, I’m guessing there is an intermediate step prior to actual deletion in which the node is removed from any hierarchies it’s part of?
I’m trying to clean up a script I’ve been working on, and was hoping there was a way to use a when construct for this sort of thing, since using the #selectedNodesPreDelete callback feels like killing a mosquito with a bazooka. But I guess not?
EDIT:
As an interesting corollary, when I tried it with scene objects added as a node tab, it worked fine.
when o deleted id:#del obj do
(
nodes = obj.nodes
for i = nodes.count to 1 by -1 where nodes[i] != undefined do
delete nodes[i]
)