From bb587e5bf80ea81d03f4ad7a22f209d687dbf818 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= <sybren@stuvel.eu>
Date: Tue, 10 Aug 2021 12:53:56 +0200
Subject: [PATCH] Pose Library: transparently handle removal of experimental
 flag

Add code to deal with the future removal of the experimental flag
`context.preferences.experimental.use_asset_browser`.

If the `use_asset_browser` attribute is no longer there, allow the pose
library UI elements to be shown.
---
 pose_library/gui.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/pose_library/gui.py b/pose_library/gui.py
index 5ac6a934d..a2f04a227 100644
--- a/pose_library/gui.py
+++ b/pose_library/gui.py
@@ -41,7 +41,12 @@ class VIEW3D_PT_pose_library(Panel):
 
     @classmethod
     def poll(cls, context: Context) -> bool:
-        return context.preferences.experimental.use_asset_browser
+        exp_prefs =  context.preferences.experimental
+        try:
+            return exp_prefs.use_asset_browser
+        except AttributeError:
+            # The 'use_asset_browser' experimental option was removed from Blender.
+            return True
 
     def draw(self, context: Context) -> None:
         layout = self.layout
@@ -172,7 +177,12 @@ class DOPESHEET_PT_asset_panel(Panel):
 
     @classmethod
     def poll(cls, context: Context) -> bool:
-        return context.preferences.experimental.use_asset_browser
+        exp_prefs =  context.preferences.experimental
+        try:
+            return exp_prefs.use_asset_browser
+        except AttributeError:
+            # The 'use_asset_browser' experimental option was removed from Blender.
+            return True
 
     def draw(self, context: Context) -> None:
         layout = self.layout
-- 
GitLab