added a ship flattening test function

This commit is contained in:
Zachary Pavlov 2006-11-14 21:28:45 +00:00
parent 7c430582d2
commit b77514867b

View File

@ -23,7 +23,7 @@ __all__ = ['enumerate', 'unique', 'indent', 'nonRepeatingRandomList',
'_equal', '_notEqual', '_isNone', '_notNone', '_contains', '_notIn',
'ScratchPad', 'Sync', 'RefCounter', 'itype', 'getNumberedTypedString',
'printNumberedTyped', 'DelayedCall', 'DelayedFunctor',
'FrameDelayedCallback', 'ArgumentEater', 'ClassTree', 'getBase',]
'FrameDelayedCallback', 'ArgumentEater', 'ClassTree', 'getBase','superFlattenShip']
import types
import string
@ -2435,6 +2435,27 @@ def getBase():
except:
return simbase
def superFlattenShip(ship):
#PHASE 1: remove characters
characterNodes=ship.findAllMatches("**/+Character")
for i in range(characterNodes.getNumPaths()):
character=characterNodes.getPath(i)
children=character.getChildrenAsList()
for child in children:
child.copyTo(character.getParent())
character.reparentTo(hidden)
#PHASE 2: remove textures
tex=ship.findAllTextures().getTexture(0)
ship.setTexture(tex,1000)
#PHASE 3: stop rocking task
taskMgr.remove("shipRocking-%d"%(ship.getDoId()))
#PHASE 4: flatten strong!
return ship.flattenStrong()
def exceptionLogged(f):
"""decorator that prints the function name and all arguments if an
exception passes back through the stack frame