File: BreadthFirstIterator.py

package info (click to toggle)
uranium 5.0.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,304 kB
  • sloc: python: 31,765; sh: 132; makefile: 12
file content (15 lines) | stat: -rw-r--r-- 534 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Copyright (c) 2018 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.

from . import Iterator
from UM.Scene.SceneNode import SceneNode


class BreadthFirstIterator(Iterator.Iterator):
    def __init__(self, scene_node: SceneNode) -> None:
        super().__init__(scene_node)

    def _fillStack(self) -> None:
        self._node_stack.append(self._scene_node)
        for node in self._node_stack:  # Loop through list, add children to back of list
            self._node_stack.extend(node.getChildren())