- Make it clearer that contrib isn't shipped with releases, by already excluding it in beta
- Hide the "Testing" enum item in that case
Details
Diff Detail
Event Timeline
Since this doesn't change at run-time, a static value can be assigned.
Example noted inline.
| release/scripts/startup/bl_ui/__init__.py | ||
|---|---|---|
| 144–152 | ||
| release/scripts/startup/bl_ui/__init__.py | ||
|---|---|---|
| 144–152 | PS: if you want to have this a "static" property, the addon_support_items() function can just be defined at the module level (and named _addon_support_items() to indicate it's "private") and used to determine the enum items just once. | |
Update patch to avoid the extra function as Campbell suggested. This way the defalt set of strings can be kept.
@Sybren A. Stüvel (sybren) I used the integer, as Blender complained about the set of strings, if the items are defined within a function.
I'm not a huge fan of the "let's concatenate things, but concatenate an empty tuple if we shouldn't" approach.
Something like this seems a bit clearer to me. It also avoids the ugly (subjective, I know) tuple-of-one notation.
@staticmethod 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 == 'rc': items.append(('TESTING', "Testing", "Newly contributed scripts (excluded from release builds)")) return items WindowManager.addon_support = EnumProperty( items=_addon_support_items(), name="Support", description="Display support level", default={'OFFICIAL', 'COMMUNITY'}, options={'ENUM_FLAG'}, )
This doesn't have anything to do with using a function. It has to do with how the function is used ;-)
@Sybren A. Stüvel (sybren) I used the integer, as Blender complained about the set of strings, if the items are defined within a function.
Ugh.
| release/scripts/startup/bl_ui/__init__.py | ||
|---|---|---|
| 97–98 | My bad, remove the @staticmethod. I typed it too quickly and mixed up "indentation because in a class" and "indentation because in a function" ;-) | |