Browse Source

*** empty log message ***

Joe Shochet 25 years ago
parent
commit
f20c160c06
1 changed files with 7 additions and 5 deletions
  1. 7 5
      direct/src/showbase/Finder.py

+ 7 - 5
direct/src/showbase/Finder.py

@@ -130,15 +130,17 @@ def copyFuncs(fromClass, toClass):
     for key in fromClass.__dict__.keys():
     for key in fromClass.__dict__.keys():
         value = fromClass.__dict__[key]
         value = fromClass.__dict__[key]
         if (type(value) == types.FunctionType):
         if (type(value) == types.FunctionType):
-            oldFunc = toClass.__dict__[key]
             newFunc = value
             newFunc = value
-            # Look in the messenger to see if this old function pointer
-            # is stored, and update it to the new function pointer
-            replaceMessengerFunc(oldFunc, newFunc)
+            # See if we already have a function with this name
+            if toClass.__dict__.has_key(key):
+                # Look in the messenger to see if this old function pointer
+                # is stored, and update it to the new function pointer
+                oldFunc = toClass.__dict__[key]
+                replaceMessengerFunc(oldFunc, newFunc)
             toClass.__dict__[key] = newFunc
             toClass.__dict__[key] = newFunc
 
 
 def replaceMessengerFunc(oldFunc, newFunc):
 def replaceMessengerFunc(oldFunc, newFunc):
     res = messenger.replaceMethod(oldFunc, newFunc)
     res = messenger.replaceMethod(oldFunc, newFunc)
     if res:
     if res:
-        print ('messenger replaced function: ' + newFunc.__name__)
+        print ('replaced messenger function: ' + newFunc.__name__)