Fix T92530: Rigify is trying to copy addon properties

The copy_custom_properties() function needs to check if a property is actually a custom property created by the user, or a property defined by an addon. I think we don't want to copy addon-defined properties here, since that's not what is usually meant by "custom property".

Reviewed By: angavrilov

Maniphest Tasks: T92530

Differential Revision: https://developer.blender.org/D13084
This commit is contained in:
Demeter Dzadik 2021-11-05 16:47:40 +01:00 committed by Demeter Dzadik
parent 6274264545
commit 905cfc4040
Notes: blender-bot 2023-02-14 18:30:18 +01:00
Referenced by issue #92530, Rigify Error: generate rig with custom property from external addon (bpy.props.PointerProperty)
1 changed files with 9 additions and 3 deletions

View File

@ -463,14 +463,20 @@ def reactivate_custom_properties(obj):
def copy_custom_properties(src, dest, *, prefix='', dest_prefix='', link_driver=False, overridable=True):
"""Copy custom properties with filtering by prefix. Optionally link using drivers."""
res = []
exclude = {'rigify_parameters', 'rigify_type'}
# Exclude addon-defined properties.
exclude = {prop.identifier for prop in src.bl_rna.properties if prop.is_runtime}
for key, value in src.items():
if key.startswith(prefix) and key not in exclude:
new_key = dest_prefix + key[len(prefix):]
ui_data_src = src.id_properties_ui(key)
try:
ui_data_src = src.id_properties_ui(key)
except TypeError:
# Some property types, eg. Python dictionaries
# don't support id_properties_ui.
continue
if src != dest or new_key != key:
dest[new_key] = value