mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 00:06:44 -04:00
*** empty log message ***
This commit is contained in:
parent
60b6871a48
commit
24110ec036
@ -171,10 +171,6 @@ class FFIMethodArgumentTreeCollection:
|
||||
indent(file, nesting+2, 'numArgs = len(_args)\n')
|
||||
|
||||
def outputOverloadedMethodFooter(self, file, nesting):
|
||||
# If the overloaded function got all the way through the if statements
|
||||
# it must have had the wrong number or type of arguments
|
||||
indent(file, nesting+2, "raise TypeError, 'Invalid arguments'\n")
|
||||
|
||||
# If this is a static method, we need to output a static version
|
||||
# If one is static, we assume they all are.
|
||||
# The current system does not support overloading static and non-static
|
||||
@ -209,12 +205,27 @@ class FFIMethodArgumentTreeCollection:
|
||||
self.outputOverloadedMethodHeader(file, nesting)
|
||||
numArgsKeys = self.treeDict.keys()
|
||||
numArgsKeys.sort()
|
||||
for numArgs in numArgsKeys:
|
||||
for i in range(len(numArgsKeys)):
|
||||
numArgs = numArgsKeys[i]
|
||||
trees = self.treeDict[numArgs]
|
||||
for tree in trees:
|
||||
indent(file, nesting+2, 'if (numArgs == ' + `numArgs` + '):\n')
|
||||
# If this is the first case, output an if clause
|
||||
if (i == 0):
|
||||
indent(file, nesting+2, 'if (numArgs == ' + `numArgs` + '):\n')
|
||||
# If this is a subsequent first case, output an elif clause
|
||||
else:
|
||||
indent(file, nesting+2, 'elif (numArgs == ' + `numArgs` + '):\n')
|
||||
tree.setup()
|
||||
tree.traverse(file, nesting+1)
|
||||
|
||||
# If the overloaded function got all the way through the if statements
|
||||
# it must have had the wrong number or type of arguments
|
||||
indent(file, nesting+2, "else:\n")
|
||||
indent(file, nesting+3, "raise TypeError, 'Invalid number of arguments: ' + `numArgs` + ', expected one of: ")
|
||||
for numArgs in numArgsKeys:
|
||||
indent(file, 0, (`numArgs` + ' '))
|
||||
indent(file, 0, "'\n")
|
||||
|
||||
self.outputOverloadedMethodFooter(file, nesting)
|
||||
|
||||
class FFIMethodArgumentTree:
|
||||
@ -268,11 +279,14 @@ class FFIMethodArgumentTree:
|
||||
self.tree[typeDesc] = [subTree, None]
|
||||
|
||||
def traverse(self, file, level=1):
|
||||
oneTreeHasArgs = 0
|
||||
typeNameList = []
|
||||
# Make a copy of the keys so we can sort them in place
|
||||
sortedKeys = self.tree.keys()
|
||||
# Sort the keys based on inheritance hierarchy, most generic classes first
|
||||
sortedKeys.sort(subclass)
|
||||
for typeDesc in sortedKeys:
|
||||
for i in range(len(sortedKeys)):
|
||||
typeDesc = sortedKeys[i]
|
||||
# See if this takes no arguments
|
||||
if (typeDesc == 0):
|
||||
# Output the function
|
||||
@ -280,16 +294,26 @@ class FFIMethodArgumentTree:
|
||||
indent(file, level+2, 'return ')
|
||||
methodSpec.outputOverloadedCall(file, self.classTypeDesc, 0)
|
||||
else:
|
||||
# Specify that at least one of these trees had arguments
|
||||
# so we know to output an else clause
|
||||
oneTreeHasArgs = 1
|
||||
typeName = getTypeName(self.classTypeDesc, typeDesc)
|
||||
indent(file, level+2, 'if (isinstance(_args[' + `level-1` + '], '
|
||||
+ typeName
|
||||
+ '))')
|
||||
typeNameList.append(typeName)
|
||||
if (i == 0):
|
||||
indent(file, level+2, 'if (isinstance(_args[' + `level-1` + '], '
|
||||
+ typeName
|
||||
+ '))')
|
||||
else:
|
||||
indent(file, level+2, 'elif (isinstance(_args[' + `level-1` + '], '
|
||||
+ typeName
|
||||
+ '))')
|
||||
# If it is looking for a float, make it accept an integer too
|
||||
if (typeName == 'types.FloatType'):
|
||||
file.write(' or (isinstance(_args[' + `level-1` + '], '
|
||||
+ 'types.IntType'
|
||||
+ '))')
|
||||
file.write(':\n')
|
||||
# Get to the bottom of this chain
|
||||
if (self.tree[typeDesc][0] != None):
|
||||
self.tree[typeDesc][0].traverse(file, level+1)
|
||||
else:
|
||||
@ -298,20 +322,11 @@ class FFIMethodArgumentTree:
|
||||
indent(file, level+3, 'return ')
|
||||
numArgs = level
|
||||
methodSpec.outputOverloadedCall(file, self.classTypeDesc, numArgs)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Output an else clause if one of the trees had arguments
|
||||
if oneTreeHasArgs:
|
||||
indent(file, level+2, 'else:\n')
|
||||
indent(file, level+3, "raise TypeError, 'Invalid argument " + `level-1` + ", expected one of: ")
|
||||
for name in typeNameList:
|
||||
indent(file, 0, ('<' + name + '> '))
|
||||
indent(file, 0, "'\n")
|
||||
|
||||
|
@ -688,16 +688,20 @@ class ClassTypeDescriptor(BaseTypeDescriptor):
|
||||
indent(file, nesting+2, '\n')
|
||||
|
||||
def outputEmptyConstructor(self, file, nesting):
|
||||
# If there is no C++ constructor, we just output this
|
||||
# empty one instead
|
||||
"""
|
||||
If there is no C++ constructor, we output code for a runtime error
|
||||
You really do not want to create a class with a null this pointer
|
||||
"""
|
||||
indent(file, nesting+1, 'def constructor(self):\n')
|
||||
indent(file, nesting+2, 'pass\n')
|
||||
indent(file, nesting+2, "raise RuntimeError, 'No C++ constructor defined for class: ' + self.__class__.__name__\n")
|
||||
|
||||
def outputBaseDestructor(self, file, nesting):
|
||||
# This destructor overwrites the builtin Python destructor
|
||||
# using the __del__ method. This will get called whenever a
|
||||
# Python object is garbage collected. We are going to overwrite
|
||||
# it with special cleanup for Panda.
|
||||
"""
|
||||
This destructor overwrites the builtin Python destructor
|
||||
using the __del__ method. This will get called whenever a
|
||||
Python object is garbage collected. We are going to overwrite
|
||||
it with special cleanup for Panda.
|
||||
"""
|
||||
indent(file, nesting+1, 'def __del__(self):\n')
|
||||
|
||||
# Reference counting is now handled in the C++ code
|
||||
@ -714,8 +718,10 @@ class ClassTypeDescriptor(BaseTypeDescriptor):
|
||||
indent(file, nesting+3, 'self.destructor()\n')
|
||||
|
||||
def outputEmptyDestructor(self, file, nesting):
|
||||
# If there is no C++ destructor, we just output this
|
||||
# empty one instead
|
||||
"""
|
||||
If there is no C++ destructor, we just output this
|
||||
empty one instead
|
||||
"""
|
||||
indent(file, nesting+1, 'def destructor(self):\n')
|
||||
indent(file, nesting+2, 'pass\n')
|
||||
|
||||
|
@ -62,8 +62,10 @@ class EventManager:
|
||||
eventParameterData = self.parseEventParameter(eventParameter)
|
||||
paramList.append(eventParameterData)
|
||||
|
||||
EventManager.notify.debug('received C++ event named: ' + eventName +
|
||||
' parameters: ' + `paramList`)
|
||||
# Do not print the new frame debug, it is too noisy!
|
||||
if (eventName != 'NewFrame'):
|
||||
EventManager.notify.debug('received C++ event named: ' + eventName +
|
||||
' parameters: ' + `paramList`)
|
||||
|
||||
|
||||
# Send the event, we used to send it with the event
|
||||
|
@ -16,9 +16,9 @@ class Loader:
|
||||
Loader constructor"""
|
||||
self.__base = base
|
||||
self.__loader = PandaLoader()
|
||||
self.__texturePool = TexturePool()
|
||||
self.__modelPool = ModelPool()
|
||||
self.__audioPool = AudioPool()
|
||||
#self.__texturePool = TexturePool()
|
||||
#self.__modelPool = ModelPool()
|
||||
#self.__audioPool = AudioPool()
|
||||
|
||||
# model loading funcs
|
||||
def loadModel(self, modelPath):
|
||||
@ -39,7 +39,7 @@ class Loader:
|
||||
then attempt to load it from disk. Return a nodepath to
|
||||
the model if successful or None otherwise"""
|
||||
Loader.notify.info("Loading model once: %s" % (modelPath))
|
||||
node = self.__modelPool.loadModel(modelPath)
|
||||
node = ModelPool.loadModel(modelPath)
|
||||
if (node != None):
|
||||
nodePath = self.__base.hidden.attachNewNode(node)
|
||||
else:
|
||||
@ -65,7 +65,7 @@ class Loader:
|
||||
Attempt to load a texture from the given file path using
|
||||
TexturePool class. Returns None if not found"""
|
||||
Loader.notify.info("Loading texture: %s" % (texturePath) )
|
||||
texture = self.__texturePool.loadTexture(texturePath)
|
||||
texture = TexturePool.loadTexture(texturePath)
|
||||
return texture
|
||||
|
||||
# sound loading funcs
|
||||
@ -74,7 +74,7 @@ class Loader:
|
||||
Attempt to load a sound from the given file path using
|
||||
Cary's sound class. Returns None if not found"""
|
||||
Loader.notify.info("Loading sound: %s" % (soundPath) )
|
||||
sound = self.__audioPool.loadSound(soundPath)
|
||||
sound = AudioPool.loadSound(soundPath)
|
||||
return sound
|
||||
|
||||
|
||||
|
@ -86,7 +86,9 @@ class Messenger:
|
||||
Send this event, optionally passing in arguments
|
||||
"""
|
||||
|
||||
Messenger.notify.debug('sent event: ' + event + ' sentArgs: ' + `sentArgs`)
|
||||
# Do not print the new frame debug, it is too noisy!
|
||||
if (event != 'NewFrame'):
|
||||
Messenger.notify.debug('sent event: ' + event + ' sentArgs: ' + `sentArgs`)
|
||||
|
||||
if self.dict.has_key(event):
|
||||
acceptorDict = self.dict[event]
|
||||
|
@ -79,11 +79,7 @@ class ShowBase:
|
||||
|
||||
def createAudioManager(self):
|
||||
if self.wantSound:
|
||||
from AudioManagerGlobal import *
|
||||
self.audioMgr = audioMgr
|
||||
self.audioMgr.spawnUpdate()
|
||||
else:
|
||||
self.audioMgr = None
|
||||
AudioManager.spawnUpdate()
|
||||
|
||||
def createRootPanel(self):
|
||||
if self.wantTk:
|
||||
|
Loading…
x
Reference in New Issue
Block a user