Browse Source

Merge pull request #341 from Hoikas/fix_331

Fix #331.
pull/346/head
Adam Johnson 2 years ago committed by GitHub
parent
commit
50a9b1a025
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      korman/operators/op_modifier.py

8
korman/operators/op_modifier.py

@ -94,12 +94,14 @@ class ModifierClipboard:
def _paste_property(self, src, dst, prop): def _paste_property(self, src, dst, prop):
prop_name = prop.identifier prop_name = prop.identifier
if prop_name in {"rna_type"}:
return
# Old properties? Discard their asses. # Old properties? Discard their asses.
if not hasattr(dst, prop_name): if not hasattr(dst, prop_name):
return return
# Collection properties must be manually copied... # Collection and pointer properties must be manually copied...
if prop.type == "COLLECTION": if prop.type == "COLLECTION":
dst_prop, src_prop = getattr(dst, prop_name), getattr(src, prop_name) dst_prop, src_prop = getattr(dst, prop_name), getattr(src, prop_name)
dst_prop.clear() dst_prop.clear()
@ -107,6 +109,10 @@ class ModifierClipboard:
dst_item = dst_prop.add() dst_item = dst_prop.add()
for item_prop in src_item.rna_type.properties: for item_prop in src_item.rna_type.properties:
self._paste_property(src_item, dst_item, item_prop) self._paste_property(src_item, dst_item, item_prop)
elif prop.type == "POINTER" and prop.fixed_type.base.name != "ID":
dst_prop, src_prop = getattr(dst, prop_name), getattr(src, prop_name)
for subprop_name in src_prop.rna_type.properties:
self._paste_property(src_prop, dst_prop, subprop_name)
else: else:
try: try:
if src.is_property_set(prop_name): if src.is_property_set(prop_name):

Loading…
Cancel
Save