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