added getNumDescendants

This commit is contained in:
Darren Ranalli 2007-04-11 08:37:54 +00:00
parent 645a40e7e8
commit 184ff2a257
1 changed files with 12 additions and 0 deletions

View File

@ -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):
"""