mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
added a ship flattening test function
This commit is contained in:
parent
7c430582d2
commit
b77514867b
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user