Otherwise, there will be a useless tab in the sidebar, and panels in the
Asset Browser and Dopesheet that do nothing. So far the Asset Browser
hides these panels unless the Animation category is selected, but this
won't work once asset catalogs replace the categories.
Details
Details
- Reviewers
Sybren A. Stüvel (sybren) - Maniphest Tasks
- T91484: Hide Pose Library Panels unless in Pose Mode
- Commits
- rBA4a278c282fe6: Hide Pose Library panels unless in Pose Mode
Diff Detail
Diff Detail
- Repository
- rBA Blender Add-ons
- Branch
- master
- Build Status
Buildable 17190 Build 17190: arc lint + arc unit
Event Timeline
Comment Actions
This will have to go along with this change in the main repository:
diff --git a/release/scripts/modules/bpy_extras/asset_utils.py b/release/scripts/modules/bpy_extras/asset_utils.py index 2cd5dddefbc..adfbd32958a 100644 --- a/release/scripts/modules/bpy_extras/asset_utils.py +++ b/release/scripts/modules/bpy_extras/asset_utils.py @@ -60,12 +60,23 @@ class AssetBrowserSpecificCategoryPanel(AssetBrowserPanel): asset_categories = set() # Set of strings like 'ANIMATIONS', see `asset_category_items` in rna_space.c @classmethod - def poll(cls, context): + def asset_category_poll(cls, context): + """ + This tries to accesses the static variable `asset_categories` in the + sub-class which won't work if there are multiple mixins with their own + `poll()` method. The caller would have to explicitly call the `poll()` + on the mixin classes, which makes the mixin access the wrong `cls`. + Instead the sub-class can call this function directly on its `cls`. + """ return ( SpaceAssetInfo.is_asset_browser_poll(context) and context.space_data.params.asset_category in cls.asset_categories ) + @classmethod + def poll(cls, context): + return cls.asset_category_poll(context) + class AssetMetaDataPanel: bl_space_type = 'FILE_BROWSER'