[Bf-blender-cvs] [e0abad2f6a2] temp-T96710-pbvh-pixels: Pose Library: avoid errors in the legacy panel when the add-on is disabled

Sybren A. Stüvel noreply at git.blender.org
Fri Apr 8 11:07:47 CEST 2022


Commit: e0abad2f6a2d416cf8ffc1803b3115870a58d6f4
Author: Sybren A. Stüvel
Date:   Thu Apr 7 11:27:19 2022 +0200
Branches: temp-T96710-pbvh-pixels
https://developer.blender.org/rBe0abad2f6a2d416cf8ffc1803b3115870a58d6f4

Pose Library: avoid errors in the legacy panel when the add-on is disabled

Avoid errors in the legacy Pose Library panel (in Armature properties)
when the Pose Library add-on is disabled.

It's unfortunate that a built-in panel now has knowledge of an add-on.
Then again, it's temporary (one or two Blender releases), and it now uses
feature detection instead of just assuming the add-on is enabled.

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

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

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

diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py
index 5228c459d8c..6980f07eba4 100644
--- a/release/scripts/startup/bl_ui/properties_data_armature.py
+++ b/release/scripts/startup/bl_ui/properties_data_armature.py
@@ -188,8 +188,12 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, Panel):
         col.template_ID(ob, "pose_library", new="poselib.new", unlink="poselib.unlink")
 
         if poselib:
-            col.operator('poselib.convert_old_object_poselib',
-                text="Convert to Pose Assets", icon="ASSET_MANAGER")
+            if hasattr(bpy.types, 'POSELIB_OT_convert_old_object_poselib'):
+                col.operator('poselib.convert_old_object_poselib',
+                    text="Convert to Pose Assets", icon="ASSET_MANAGER")
+            else:
+                col.label(text="Enable the Pose Library add-on to convert", icon="ERROR")
+                col.label(text="this legacy pose library to pose assets.", icon="BLANK1")
 
             # Put the deprecated stuff in its own sub-layout.
 
@@ -226,7 +230,6 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, Panel):
                 ).pose_index = poselib.pose_markers.active_index
 
             col.operator("poselib.action_sanitize", icon='HELP', text="")  # XXX: put in menu?
-            col.operator("poselib.convert_old_poselib", icon='ASSET_MANAGER', text="")
 
             if pose_marker_active is not None:
                 col.operator("poselib.pose_move", icon='TRIA_UP', text="").direction = 'UP'



More information about the Bf-blender-cvs mailing list