浏览代码

*** empty log message ***

rdb 14 年之前
父节点
当前提交
66e8c2aafa
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      direct/src/ffi/panda3d.py

+ 8 - 1
direct/src/ffi/panda3d.py

@@ -25,6 +25,8 @@ class panda3d_import_manager:
     sys = sys
     imp = imp
 
+    __libraries__ = {}
+
     # Figure out the dll suffix (commonly, _d for windows debug builds),
     # and the dll extension.
     dll_suffix = ''
@@ -100,6 +102,9 @@ class panda3d_import_manager:
         """ Imports and returns the specified library name. The
         provided library name has to be without dll extension. """
 
+        if name in cls.__libraries__:
+            return cls.__libraries__[name]
+
         if not cls.prepared: cls.__prepare()
 
         # Try to import it normally first.
@@ -125,7 +130,9 @@ class panda3d_import_manager:
         target = cls.os.path.abspath(target)
 
         # Now import the file explicitly.
-        return cls.imp.load_dynamic(name, target)
+        lib = cls.imp.load_dynamic(name, target)
+        cls.__libraries__[name] = lib
+        return lib
 
 class panda3d_submodule(type(sys)):
     """ Represents a submodule of 'panda3d' that represents a dynamic