WIP: Animation: operators to update the pose library #104673

Draft
Sybren A. Stüvel wants to merge 10 commits from dr.sybren/blender-addons:pr/poselib-replace-pose into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit f16731a4ca - Show all commits

View File

@ -164,6 +164,7 @@ class POSELIB_OT_replace_pose_asset(Operator):
@classmethod @classmethod
def poll(cls, context: Context) -> bool: def poll(cls, context: Context) -> bool:
if not _get_action(context): if not _get_action(context):
cls.poll_message_set("Select a pose asset from the currently open blend file")
return False return False
if context.object is None or context.object.mode != "POSE": if context.object is None or context.object.mode != "POSE":
@ -171,11 +172,6 @@ class POSELIB_OT_replace_pose_asset(Operator):
cls.poll_message_set("An active armature object in pose mode is needed") cls.poll_message_set("An active armature object in pose mode is needed")
return False return False
asset_space_params = asset_browser.params(context.area)
if asset_space_params.asset_library_ref != 'LOCAL':
cls.poll_message_set("Asset Browser must be set to the Current File library")
return False
return True return True
def execute(self, context: Context) -> Set[str]: def execute(self, context: Context) -> Set[str]:
@ -230,20 +226,7 @@ class POSELIB_OT_update_pose_asset(Operator):
@classmethod @classmethod
def poll(cls, context: Context) -> bool: def poll(cls, context: Context) -> bool:
if not _get_action(context): return POSELIB_OT_replace_pose_asset(context)
return False
if context.object is None or context.object.mode != "POSE":
# The operator assumes pose mode, so that bone selection is visible.
cls.poll_message_set("An active armature object in pose mode is needed")
return False
asset_space_params = asset_browser.params(context.area)
if asset_space_params.asset_library_ref != 'LOCAL':
cls.poll_message_set("Asset Browser must be set to the Current File library")
return False
return True
def execute(self, context: Context) -> Set[str]: def execute(self, context: Context) -> Set[str]:
# Make sure the new keys are on the same frame as the old keys. # Make sure the new keys are on the same frame as the old keys.