diff --git a/direct/src/ffi/FFIOverload.py b/direct/src/ffi/FFIOverload.py index b2ff68e150..6edbeb0816 100644 --- a/direct/src/ffi/FFIOverload.py +++ b/direct/src/ffi/FFIOverload.py @@ -267,6 +267,8 @@ class FFIMethodArgumentTreeCollection: self.outputOverloadedMethodFooter(file, nesting) + + class FFIMethodArgumentTree: """ Tree is made from nested dictionaries. @@ -369,3 +371,16 @@ class FFIMethodArgumentTree: indent(file, 0, ('<' + name + '> ')) indent(file, 0, "'\n") + def isSinglePath(self): + if (len(self.tree.keys()) > 1): + # More than one child, return false + return 0 + else: + # Only have one child, see if he only has one child + key = self.tree.keys()[0] + tree = self.tree[key][0] + if tree: + return tree.isSinglePath() + else: + return self.tree[key][1] + diff --git a/direct/src/ffi/FFISpecs.py b/direct/src/ffi/FFISpecs.py index af3b102812..8e21d5d421 100644 --- a/direct/src/ffi/FFISpecs.py +++ b/direct/src/ffi/FFISpecs.py @@ -332,7 +332,8 @@ class MethodSpecification(FunctionSpecification): # The method body will look something like # panda.Class_destructor(self.this) self.outputCFunctionComment(file, nesting+2) - indent(file, nesting+2, self.typeDescriptor.moduleName + '.' + indent(file, nesting+2, 'if ' + self.typeDescriptor.moduleName + ':\n') + indent(file, nesting+3, self.typeDescriptor.moduleName + '.' + self.typeDescriptor.wrapperName + '(self.this)\n') def outputDestructorFooter(self, methodClass, file, nesting):