more cleanup to bpy.context.copy(), exclude rna values and its self.

This commit is contained in:
Campbell Barton 2010-06-09 19:44:06 +00:00
parent dd72ffe3ff
commit 006d5e82e8

@ -29,14 +29,14 @@ class Context(StructRNA):
__slots__ = ()
def copy(self):
import types
from types import BuiltinMethodType
new_context = {}
generic_keys = StructRNA.__dict__.keys()
for item in dir(self):
if item not in generic_keys:
value = getattr(self, item)
if type(value) != types.BuiltinMethodType:
new_context[item] = getattr(self, item)
generic_attrs = list(StructRNA.__dict__.keys()) + ["bl_rna", "rna_type", "copy"]
for attr in dir(self):
if not (attr.startswith("_") or attr in generic_attrs):
value = getattr(self, attr)
if type(value) != BuiltinMethodType:
new_context[attr] = value
return new_context