diff --git a/direct/src/extensions/NodePathCollection-extensions.py b/direct/src/extensions/NodePathCollection-extensions.py new file mode 100644 index 0000000000..af978b0dc4 --- /dev/null +++ b/direct/src/extensions/NodePathCollection-extensions.py @@ -0,0 +1,16 @@ + + """ + NodePathCollection-extensions module: contains methods to extend + functionality of the NodePathCollection class + """ + + # For iterating over children + def asList(self): + """Converts a NodePathCollection into a list""" + if self.isEmpty(): + return [] + else: + npList = [] + for nodePathIndex in range(self.getNumPaths()): + npList.append(self.getPath(nodePathIndex)) + return npList