From 6d1fbd249b7114c21926e630a1d8fcf8966c8379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 7 Apr 2022 11:27:19 +0200 Subject: 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. --- release/scripts/startup/bl_ui/properties_data_armature.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to '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' -- cgit v1.2.3