forked from bartvdbraak/blender
more cleanup to bpy.context.copy(), exclude rna values and its self.
This commit is contained in:
parent
dd72ffe3ff
commit
006d5e82e8
@ -29,14 +29,14 @@ class Context(StructRNA):
|
|||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
|
|
||||||
def copy(self):
|
def copy(self):
|
||||||
import types
|
from types import BuiltinMethodType
|
||||||
new_context = {}
|
new_context = {}
|
||||||
generic_keys = StructRNA.__dict__.keys()
|
generic_attrs = list(StructRNA.__dict__.keys()) + ["bl_rna", "rna_type", "copy"]
|
||||||
for item in dir(self):
|
for attr in dir(self):
|
||||||
if item not in generic_keys:
|
if not (attr.startswith("_") or attr in generic_attrs):
|
||||||
value = getattr(self, item)
|
value = getattr(self, attr)
|
||||||
if type(value) != types.BuiltinMethodType:
|
if type(value) != BuiltinMethodType:
|
||||||
new_context[item] = getattr(self, item)
|
new_context[attr] = value
|
||||||
|
|
||||||
return new_context
|
return new_context
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user