[Bf-blender-cvs] [2dd27d5f06b] master: Cleanup: remove function for accessing supported add-ons

Campbell Barton noreply at git.blender.org
Wed Dec 14 23:47:28 CET 2022


Commit: 2dd27d5f06bd4bc01ce3db66a731468b3004552c
Author: Campbell Barton
Date:   Thu Dec 15 09:39:23 2022 +1100
Branches: master
https://developer.blender.org/rB2dd27d5f06bd4bc01ce3db66a731468b3004552c

Cleanup: remove function for accessing supported add-ons

This was only called once in a situation where such functions
are typically used as a dynamic enum callbacks.

Prefer keeping the items close to the EnumProperty definition &
avoid the need to note why this is a special case that doesn't follow
the common pattern for enum callbacks.

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

M	release/scripts/startup/bl_ui/__init__.py

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

diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py
index 592eaf57a97..01ae0730fab 100644
--- a/release/scripts/startup/bl_ui/__init__.py
+++ b/release/scripts/startup/bl_ui/__init__.py
@@ -95,18 +95,6 @@ _modules_loaded = [_namespace[name] for name in _modules]
 del _namespace
 
 
-def _addon_support_items():
-    """Return the addon support levels suitable for this Blender build."""
-
-    items = [
-        ('OFFICIAL', "Official", "Officially supported"),
-        ('COMMUNITY', "Community", "Maintained by community developers"),
-    ]
-    if bpy.app.version_cycle == 'alpha':
-        items.append(('TESTING', "Testing", "Newly contributed scripts (excluded from release builds)"))
-    return items
-
-
 def register():
     from bpy.utils import register_class
     for mod in _modules_loaded:
@@ -152,13 +140,23 @@ def register():
         description="Filter add-ons by category",
     )
 
+    # These items are static but depend on the version cycle.
+    items = [
+        ('OFFICIAL', "Official", "Officially supported"),
+        ('COMMUNITY', "Community", "Maintained by community developers"),
+    ]
+    if bpy.app.version_cycle == "alpha":
+        items.append(('TESTING', "Testing", "Newly contributed scripts (excluded from release builds)"))
+
     WindowManager.addon_support = EnumProperty(
-        items=_addon_support_items(),
+        items=items,
         name="Support",
         description="Display support level",
         default={'OFFICIAL', 'COMMUNITY'},
         options={'ENUM_FLAG'},
     )
+    del items
+
     # done...



More information about the Bf-blender-cvs mailing list