From d899f20cc431ca08e3428b7d9352ea05fd9c97dd Mon Sep 17 00:00:00 2001 From: David Rose Date: Sat, 12 May 2001 15:03:21 +0000 Subject: [PATCH] *** empty log message *** --- direct/src/ffi/FFIExternalObject.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/direct/src/ffi/FFIExternalObject.py b/direct/src/ffi/FFIExternalObject.py index 0f85ea7c4d..beb871f6d7 100644 --- a/direct/src/ffi/FFIExternalObject.py +++ b/direct/src/ffi/FFIExternalObject.py @@ -69,14 +69,17 @@ class FFIExternalObject: # Start with an empty list of downcast functions downcastFunctionList = [] - # If it could not find the baseClass anywhere in the lineage, return empty + # If it could not find the baseClass anywhere in the lineage, + # return empty if not lineage: return [] - # Walk along the lineage looking for downcast functions from class to class+1 - for i in range((len(lineage) - 1)): - toClass = lineage[i] - fromClass = lineage[i+1] + # Walk along the lineage looking for downcast functions from + # class to class+1. Start at the top and work downwards. + top = len(lineage) - 1 + for i in range(top): + toClass = lineage[top - i - 1] + fromClass = lineage[top - i] downcastFuncName = ('downcastTo' + toClass.__name__ + 'From' + fromClass.__name__) # Look over this classes global modules dictionaries