From 8f72ae50796e5e34df961da38e449343b989dcbd Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 28 Mar 2002 01:19:06 +0000 Subject: [PATCH] fix upcast to renamed class --- direct/src/ffi/FFIInterrogateDatabase.py | 9 +++++++-- direct/src/ffi/FFISpecs.py | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/direct/src/ffi/FFIInterrogateDatabase.py b/direct/src/ffi/FFIInterrogateDatabase.py index 8c8d10a714..c21155d446 100644 --- a/direct/src/ffi/FFIInterrogateDatabase.py +++ b/direct/src/ffi/FFIInterrogateDatabase.py @@ -490,8 +490,13 @@ class FFIInterrogateDatabase: typeDescs = self.constructFunctionTypeDescriptors(funcIndex) for typeDesc in typeDescs: funcSpec = FFISpecs.MethodSpecification() - funcSpec.name = FFIRename.methodNameFromCppName( - interrogate_function_name(funcIndex)) + # We synthesize the upcast function name instead + # of using the name supplied by interrogate, to + # allow for possible renaming of types on this + # side. + funcSpec.name = 'upcastTo' + typeDesc.returnType.typeDescriptor.foreignTypeName + #funcSpec.name = FFIRename.methodNameFromCppName( + # interrogate_function_name(funcIndex)) funcSpec.typeDescriptor = typeDesc funcSpec.index = funcIndex funcSpecs.append(funcSpec) diff --git a/direct/src/ffi/FFISpecs.py b/direct/src/ffi/FFISpecs.py index b6008b2ff7..8b429e6fe2 100644 --- a/direct/src/ffi/FFISpecs.py +++ b/direct/src/ffi/FFISpecs.py @@ -473,9 +473,14 @@ class MethodSpecification(FunctionSpecification): childClass = parentList[i-1] if childClass.hasMethodNamed(methodName): indent(file, nesting+2, 'upcastSelf = upcastSelf.' + methodName + '()\n') + else: + indent(file, nesting+2, '# upcastSelf = upcastSelf.' + methodName + '()\n') else: if methodClass.hasMethodNamed(methodName): indent(file, nesting+2, 'upcastSelf = upcastSelf.' + methodName + '()\n') + else: + indent(file, nesting+2, '# upcastSelf = upcastSelf.' + methodName + '()\n') + indent(file, nesting+2, 'returnValue = ' + self.typeDescriptor.moduleName + '.' + self.typeDescriptor.wrapperName + '(upcastSelf.this') if (len(thislessArgTypes) > 0):