Plaster

common-lisp
(defun map-nodes/active (func &key root) (labels ((recurse (node) (unless (or (node/disabled node) (node/paused node)) (funcall func node) (dolist (child (node/children node)) (recurse child))))) (recurse (or root (get-root-node))))) (defun map-nodes (func &key root type include-disabled include-paused) (labels ((recurse (node) (when (and (or include-disabled (not (node/disabled node))) (or include-paused (not (node/paused node)))) (when (or (not type) (and type (has-component-p node type))) (funcall func node)) (dolist (child (node/children node)) (recurse child))))) (recurse (or root (get-root-node)))))