[Bf-blender-cvs] [0c0553ace7b] master: Fix T85915: Cannot save new theme preset

Campbell Barton noreply at git.blender.org
Wed Feb 24 13:40:21 CET 2021


Commit: 0c0553ace7b31107ba03952e013d802a5f6b1f35
Author: Campbell Barton
Date:   Wed Feb 24 23:36:15 2021 +1100
Branches: master
https://developer.blender.org/rB0c0553ace7b31107ba03952e013d802a5f6b1f35

Fix T85915: Cannot save new theme preset

Since making bpy.types a real module `dir(bpy.types)` now includes
__dir__ and __getattr__ methods which need to be ignored.

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

M	release/scripts/modules/rna_xml.py

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

diff --git a/release/scripts/modules/rna_xml.py b/release/scripts/modules/rna_xml.py
index d9fc09e7d18..58abb5c90db 100644
--- a/release/scripts/modules/rna_xml.py
+++ b/release/scripts/modules/rna_xml.py
@@ -26,14 +26,21 @@ def build_property_typemap(skip_classes, skip_typemap):
     property_typemap = {}
 
     for attr in dir(bpy.types):
+        # Skip internal methods.
+        if attr.startswith("_"):
+            continue
         cls = getattr(bpy.types, attr)
         if issubclass(cls, skip_classes):
             continue
+        bl_rna = getattr(cls, "bl_rna", None)
+        # Needed to skip classes added to the modules `__dict__`.
+        if bl_rna is None:
+            continue
 
         # # to support skip-save we can't get all props
-        # properties = cls.bl_rna.properties.keys()
+        # properties = bl_rna.properties.keys()
         properties = []
-        for prop_id, prop in cls.bl_rna.properties.items():
+        for prop_id, prop in bl_rna.properties.items():
             if not prop.is_skip_save:
                 properties.append(prop_id)



More information about the Bf-blender-cvs mailing list