Browse Source

added destroy for functors and param sets

Dave Schuyler 19 years ago
parent
commit
927e52a363
1 changed files with 13 additions and 0 deletions
  1. 13 0
      direct/src/showbase/PythonUtil.py

+ 13 - 0
direct/src/showbase/PythonUtil.py

@@ -756,6 +756,13 @@ class Functor:
         self.__name__ = 'Functor: %s' % self._function.__name__
         self.__name__ = 'Functor: %s' % self._function.__name__
         self.__doc__ = self._function.__doc__
         self.__doc__ = self._function.__doc__
 
 
+    def destroy(self):
+        del self._function
+        del self._args
+        del self._kargs
+        del self.__name__
+        del self.__doc__
+    
     def __call__(self, *args, **kargs):
     def __call__(self, *args, **kargs):
         """call function"""
         """call function"""
         _args = list(self._args)
         _args = list(self._args)
@@ -1112,6 +1119,12 @@ class ParamObj:
         if params is not None:
         if params is not None:
             params.applyTo(self)
             params.applyTo(self)
 
 
+    def destroy(self):
+        for param in self.ParamSet.getParams():
+            setterName = getSetterName(param)
+            self.__dict__[setterName].destroy()
+            del self.__dict__[setterName]
+    
     def setDefaultParams(self):
     def setDefaultParams(self):
         # set all the default parameters on ourself
         # set all the default parameters on ourself
         self.ParamSet().applyTo(self)
         self.ParamSet().applyTo(self)