diff --git a/direct/src/extensions_native/NodePath_extensions.py b/direct/src/extensions_native/NodePath_extensions.py index f8e389e9c2..b6c0cf61e2 100644 --- a/direct/src/extensions_native/NodePath_extensions.py +++ b/direct/src/extensions_native/NodePath_extensions.py @@ -1340,6 +1340,18 @@ def flattenMultitex(self, stateFrom = None, target = None, Dtool_funcToMethod(flattenMultitex, NodePath) del flattenMultitex ##################################################################### +def getNumDescendants(self): + num = 0 + stack = [self] + while len(stack): + np = stack.pop() + numChildren = np.getNumChildren() + num += numChildren + stack.extend(np.getChildrenAsList()) + return num +Dtool_funcToMethod(getNumDescendants, NodePath) +del getNumDescendants +##################################################################### def subdivideCollisions(self, numSolidsInLeaves = 2): """