added getNumDescendants
This commit is contained in:
parent
645a40e7e8
commit
184ff2a257
|
|
@ -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):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in New Issue