mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
added traceParentCall; print fsm tre unfinished
This commit is contained in:
parent
a4a9c9e151
commit
c85e84adc6
@ -31,6 +31,18 @@ def indent(stream, numIndents, str):
|
|||||||
stream.write(' ' * numIndents + str)
|
stream.write(' ' * numIndents + str)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def writeFsmTree(instance, indent = 0):
|
||||||
|
if hasattr(instance, 'parentFSM'):
|
||||||
|
writeFsmTree(instance.parentFSM, indent-2)
|
||||||
|
elif hasattr(instance, 'fsm'):
|
||||||
|
name = ''
|
||||||
|
if hasattr(instance.fsm, 'state'):
|
||||||
|
name = instance.fsm.state.name
|
||||||
|
print "%s: %s"%(instance.fsm.name, name)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def traceFunctionCall(frame):
|
def traceFunctionCall(frame):
|
||||||
"""
|
"""
|
||||||
@ -45,12 +57,16 @@ def traceFunctionCall(frame):
|
|||||||
if co.co_flags & 4: n = n+1
|
if co.co_flags & 4: n = n+1
|
||||||
if co.co_flags & 8: n = n+1
|
if co.co_flags & 8: n = n+1
|
||||||
r=f.f_code.co_name+'('
|
r=f.f_code.co_name+'('
|
||||||
|
comma=0 # formatting, whether we should type a comma.
|
||||||
for i in range(n):
|
for i in range(n):
|
||||||
name = co.co_varnames[i]
|
name = co.co_varnames[i]
|
||||||
if name=='self':
|
if name=='self':
|
||||||
continue
|
continue
|
||||||
if i:
|
if comma:
|
||||||
r+=', '
|
r+=', '
|
||||||
|
else:
|
||||||
|
# ok, we skipped the first one, the rest get commas:
|
||||||
|
comma=1
|
||||||
r+=name
|
r+=name
|
||||||
r+='='
|
r+='='
|
||||||
if dict.has_key(name):
|
if dict.has_key(name):
|
||||||
@ -62,6 +78,9 @@ def traceFunctionCall(frame):
|
|||||||
else: r+="*** undefined ***"
|
else: r+="*** undefined ***"
|
||||||
return r+')'
|
return r+')'
|
||||||
|
|
||||||
|
def traceParentCall():
|
||||||
|
return traceFunctionCall(sys._getframe(2))
|
||||||
|
|
||||||
def printThisCall():
|
def printThisCall():
|
||||||
print traceFunctionCall(sys._getframe(1))
|
print traceFunctionCall(sys._getframe(1))
|
||||||
return 1 # to allow "assert printThisCall()"
|
return 1 # to allow "assert printThisCall()"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user