#NEWLINE# def _mergeCol( node ) : #NEWLINE# #INDENT# '\n    assumes all passed nodes are collision nodes\n    \n    merges solids for child nodes up to minimize nodes with few solids\n    ' #NEWLINE# mergeCount = 10 #NEWLINE# c = node . node ( ) #NEWLINE# for n in node . getChildren ( ) : #NEWLINE# #INDENT# _mergeCol ( n ) #NEWLINE# cn = n . node ( ) #NEWLINE# removed = False #NEWLINE# if ( n . getNumChildren ( ) == 0 ) : #NEWLINE# #INDENT# num = cn . getNumSolids ( ) #NEWLINE# if ( num < mergeCount ) : #NEWLINE# #INDENT# for i in xrange ( num ) : #NEWLINE# #INDENT# c . addSolid ( cn . getSolid ( i ) ) #NEWLINE# #UNINDENT# n . removeNode ( ) #NEWLINE# removed = True #NEWLINE# #UNINDENT# #UNINDENT# if ( not removed ) : #NEWLINE# #INDENT# numChildren = n . getNumChildren ( ) #NEWLINE# num = cn . getNumSolids ( ) #NEWLINE# if ( ( num == 0 ) and ( numChildren == 1 ) ) : #NEWLINE# #INDENT# nn = n . getChild ( 0 ) #NEWLINE# nn . reparentTo ( node ) #NEWLINE# n . removeNode ( )