removeObject=function(h)local L=NodeLookup[h]if not L then return end local x=nodeIsVisible(L)Selection:Remove(h,true)local T=L.Parent remove(T,L.Index)NodeLookup[h]=nil connLookup[h]:disconnect()connLookup[h]=nil if x then updateList()elseif nodeIsVisible(T)then updateScroll()end end
-- Removes an object's tree node. Called when the object stops existing in the
-- game tree.
removeObject = function(object)
	local objectNode = NodeLookup[object]
	if not objectNode then
		return
	end

	local visible = nodeIsVisible(objectNode)

	Selection:Remove(object, true)

	local parent = objectNode.Parent
	remove(parent, objectNode.Index)
	NodeLookup[object] = nil
	connLookup[object]:disconnect()
	connLookup[object] = nil

	if visible then
		updateList()
	elseif nodeIsVisible(parent) then
		updateScroll()
	end
end
