def asset_clear(context: Context, datablock: Any) -> Set[str]: asset_clear_ctx = { **context.copy(), "id": datablock, } result = bpy.ops.asset.clear(asset_clear_ctx) assert isinstance(result, set) if "FINISHED" in result: datablock.use_fake_user = False return result
def create_poselib_action( context: Context, src_action: Action, src_frame_nr: float, bone_names: Set[str], pose_name: str, ) -> Action: """Create a single-frame Action containing only the given bones.""" dst_action = bpy.data.actions.new(pose_name) dst_action.id_root = src_action.id_root copy_fcurves(dst_action, src_action, src_frame_nr, bone_names) asset_mark_ctx = { **context.copy(), "id": dst_action, } bpy.ops.asset.mark(asset_mark_ctx) # TODO(Sybren): Add Asset metadata. return dst_action
def execute(self, context: Context) -> Set[str]: flipped = context.window_manager.poselib_flipped return bpy.ops.poselib.apply_pose_asset(context.copy(), 'EXEC_DEFAULT', flipped=flipped)
def poll(cls, context: Context) -> bool: return bpy.ops.poselib.apply_pose_asset.poll(context.copy())
def invoke(self, context: Context, event: Event) -> Set[str]: flipped = context.window_manager.poselib_flipped return bpy.ops.poselib.blend_pose_asset(context.copy(), 'INVOKE_DEFAULT', flipped=flipped)
def poll(cls, context: Context) -> bool: if not asset_utils.SpaceAssetInfo.is_asset_browser(context.space_data): return False return bpy.ops.poselib.apply_pose_asset.poll(context.copy())
def asset_mark(context: Context, datablock: Any) -> Set[str]: asset_mark_ctx = { **context.copy(), "id": datablock, } return cast(Set[str], bpy.ops.asset.mark(asset_mark_ctx))