Browse Source

added POD.copyTo

Darren Ranalli 20 years ago
parent
commit
e225c565b2
1 changed files with 6 additions and 1 deletions
  1. 6 1
      direct/src/showbase/PythonUtil.py

+ 6 - 1
direct/src/showbase/PythonUtil.py

@@ -1202,7 +1202,7 @@ class POD:
                     raise "object '%s' doesn't have value '%s'" % (other, name)
                 else:
                     setattr(self, name, self.getDefaultValue(name))
-        # support 'p = POD.POD().copyFrom(other)'
+        # support 'p = POD.POD().copyFrom(other)' syntax
         return self
     def makeCopy(self):
         # returns a duplicate of this object
@@ -1730,6 +1730,11 @@ class Enum:
     def __len__(self):
         return len(self._stringTable)
 
+    def copyTo(self, obj):
+        # copies all members onto obj
+        for name, value in self._stringTable:
+            setattr(obj, name, value)
+
     if __debug__:
         def _checkExistingMembers(self, items):
             for item in items: