[Bf-extensions-cvs] [905cfc40] master: Fix T92530: Rigify is trying to copy addon properties

Demeter Dzadik noreply at git.blender.org
Fri Nov 5 18:14:37 CET 2021


Commit: 905cfc4040e71bcc60d5526506814431bd0a8e58
Author: Demeter Dzadik
Date:   Fri Nov 5 16:47:40 2021 +0100
Branches: master
https://developer.blender.org/rBA905cfc4040e71bcc60d5526506814431bd0a8e58

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

===================================================================

M	rigify/utils/mechanism.py

===================================================================

diff --git a/rigify/utils/mechanism.py b/rigify/utils/mechanism.py
index 00aef154..0b5c8d93 100644
--- a/rigify/utils/mechanism.py
+++ b/rigify/utils/mechanism.py
@@ -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



More information about the Bf-extensions-cvs mailing list