user: Show practical ways to work with Anim Operators in a Blender add-on or script – include code.

assistant: # Anim Operators

bpy.ops.anim.change_frame(*\**, *frame=0.0*, *snap=False*, *seq_solo_preview=False*)
:   Interactively change the current frame number

    Parameters:
    :   - **frame** (*float in* *[**-1.04857e+06**,* *1.04857e+06**]**,* *(**optional**)*) – Frame
        - **snap** (*boolean**,* *(**optional**)*) – Snap
        - **seq_solo_preview** (*boolean**,* *(**optional**)*) – Strip Preview

bpy.ops.anim.channel_select_keys(*\**, *extend=False*)
:   Select all keyframes of channel under mouse

    Parameters:
    :   **extend** (*boolean**,* *(**optional**)*) – Extend, Extend selection

bpy.ops.anim.channel_view_pick(*\**, *include_handles=True*, *use_preview_range=True*)
:   Reset viewable area to show the channel under the cursor

    Parameters:
    :   - **include_handles** (*boolean**,* *(**optional**)*) – Include Handles, Include handles of keyframes when calculating extents
        - **use_preview_range** (*boolean**,* *(**optional**)*) – Use Preview Range, Ignore frames outside of the preview range

bpy.ops.anim.channels_bake(*\**, *range=(0, 0)*, *step=1.0*, *remove_outside_range=False*, *interpolation_type='BEZIER'*, *bake_modifiers=True*)
:   Create keyframes following the current shape of F-Curves of selected channels

    Parameters:
    :   - **range** (*int array* *of* *2 items in* *[**-inf**,* *inf**]**,* *(**optional**)*) – Frame Range, The range in which to create new keys
        - **step** (*float in* *[**0.01**,* *inf**]**,* *(**optional**)*) – Frame Step, At which interval to add keys
        - **remove_outside_range** (*boolean**,* *(**optional**)*) – Remove Outside Range, Removes keys outside the given range, leaving only the newly baked
        - **interpolation_type** (enum in [`'BEZIER'`, `'LIN'`, `'CONST'`], (optional)) –

          Interpolation Type, Choose the interpolation type with which new keys will be added

          - `BEZIER`
            Bézier – New keys will be Bézier.
          - `LIN`
            Linear – New keys will be linear.
          - `CONST`
            Constant – New keys will be constant.
        - **bake_modifiers** (*boolean**,* *(**optional**)*) – Bake Modifiers, Bake Modifiers into keyframes and delete them after

bpy.ops.anim.channels_clean_empty()
:   Delete all empty animation data containers from visible data-blocks

bpy.ops.anim.channels_click(*\**, *extend=False*, *extend_range=False*, *children_only=False*)
:   Handle mouse clicks over animation channels

    Parameters:
    :   - **extend** (*boolean**,* *(**optional**)*) – Extend Select
        - **extend_range** (*boolean**,* *(**optional**)*) – Extend Range, Selection of active channel to clicked channel
        - **children_only** (*boolean**,* *(**optional**)*) – Select Children Only

bpy.ops.anim.channels_collapse(*\**, *all=True*)
:   Collapse (close) all selected expandable animation channels

    Parameters:
    :   **all** (*boolean**,* *(**optional**)*) – All, Collapse all channels (not just selected ones)

bpy.ops.anim.channels_delete()
:   Delete all selected animation channels

bpy.ops.anim.channels_editable_toggle(*\**, *mode='TOGGLE'*, *type='PROTECT'*)
:   Toggle editability of selected channels

    Parameters:
    :   - **mode** (enum in [`'TOGGLE'`, `'DISABLE'`, `'ENABLE'`, `'INVERT'`], (optional)) – Mode
        - **type** (enum in [`'PROTECT'`, `'MUTE'`], (optional)) – Type

bpy.ops.anim.channels_expand(*\**, *all=True*)
:   Expand (open) all selected expandable animation channels

    Parameters:
    :   **all** (*boolean**,* *(**optional**)*) – All, Expand all channels (not just selected ones)

bpy.ops.anim.channels_fcurves_enable()
:   Clear ‘disabled’ tag from all F-Curves to get broken F-Curves working again

bpy.ops.anim.channels_group(*\**, *name='New Group'*)
:   Add selected F-Curves to a new group

    Parameters:
    :   **name** (*string**,* *(**optional**,* *never None**)*) – Name, Name of newly created group

bpy.ops.anim.channels_move(*\**, *direction='DOWN'*)
:   Rearrange selected animation channels

    Parameters:
    :   **direction** (enum in [`'TOP'`, `'UP'`, `'DOWN'`, `'BOTTOM'`], (optional)) – Direction

bpy.ops.anim.channels_rename()
:   Rename animation channel under mouse

bpy.ops.anim.channels_select_all(*\**, *action='TOGGLE'*)
:   Toggle selection of all animation channels

    Parameters:
    :   **action** (enum in [`'TOGGLE'`, `'SELECT'`, `'DESELECT'`, `'INVERT'`], (optional)) –

        Action, Selection action to execute

        - `TOGGLE`
          Toggle – Toggle selection for all elements.
        - `SELECT`
          Select – Select all elements.
        - `DESELECT`
          Deselect – Deselect all elements.
        - `INVERT`
          Invert – Invert selection of all elements.

bpy.ops.anim.channels_select_box(*\**, *xmin=0*, *xmax=0*, *ymin=0*, *ymax=0*, *wait_for_input=True*, *deselect=False*, *extend=True*)
:   Select all animation channels within the specified region

    Parameters:
    :   - **xmin** (*int in* *[**-inf**,* *inf**]**,* *(**optional**)*) – X Min
        - **xmax** (*int in* *[**-inf**,* *inf**]**,* *(**optional**)*) – X Max
        - **ymin** (*int in* *[**-inf**,* *inf**]**,* *(**optional**)*) – Y Min
        - **ymax** (*int in* *[**-inf**,* *inf**]**,* *(**optional**)*) – Y Max
        - **wait_for_input** (*boolean**,* *(**optional**)*) – Wait for Input
        - **deselect** (*boolean**,* *(**optional**)*) – Deselect, Deselect rather than select items
        - **extend** (*boolean**,* *(**optional**)*) – Extend, Extend selection instead of deselecting everything first

bpy.ops.anim.channels_select_filter()
:   Start entering text which filters the set of channels shown to only include those with matching names

bpy.ops.anim.channels_setting_disable(*\**, *mode='DISABLE'*, *type='PROTECT'*)
:   Disable specified setting on all selected animation channels

    Parameters:
    :   - **mode** (enum in [`'TOGGLE'`, `'DISABLE'`, `'ENABLE'`, `'INVERT'`], (optional)) – Mode
        - **type** (enum in [`'PROTECT'`, `'MUTE'`], (optional)) – Type

bpy.ops.anim.channels_setting_enable(*\**, *mode='ENABLE'*, *type='PROTECT'*)
:   Enable specified setting on all selected animation channels

    Parameters:
    :   - **mode** (enum in [`'TOGGLE'`, `'DISABLE'`, `'ENABLE'`, `'INVERT'`], (optional)) – Mode
        - **type** (enum in [`'PROTECT'`, `'MUTE'`], (optional)) – Type

bpy.ops.anim.channels_setting_toggle(*\**, *mode='TOGGLE'*, *type='PROTECT'*)
:   Toggle specified setting on all selected animation channels

    Parameters:
    :   - **mode** (enum in [`'TOGGLE'`, `'DISABLE'`, `'ENABLE'`, `'INVERT'`], (optional)) – Mode
        - **type** (enum in [`'PROTECT'`, `'MUTE'`], (optional)) – Type

bpy.ops.anim.channels_ungroup()
:   Remove selected F-Curves from their current groups

bpy.ops.anim.channels_view_selected(*\**, *include_handles=True*, *use_preview_range=True*)
:   Reset viewable area to show the selected channels

    Parameters:
    :   - **include_handles** (*boolean**,* *(**optional**)*) – Include Handles, Include handles of keyframes when calculating extents
        - **use_preview_range** (*boolean**,* *(**optional**)*) – Use Preview Range, Ignore frames outside of the preview range

bpy.ops.anim.clear_useless_actions(*\**, *only_unused=True*)
:   Mark actions with no F-Curves for deletion after save and reload of file preserving “action libraries”

    Parameters:
    :   **only_unused** (*boolean**,* *(**optional**)*) – Only Unused, Only unused (Fake User only) actions get considered

    File:
    :   [startup/bl_operators/anim.py:365](https://projects.blender.org/blender/blender/src/branch/main/scripts/startup/bl_operators/anim.py#L365)

bpy.ops.anim.convert_legacy_action()
:   Convert a legacy Action to a layered Action on the active object

bpy.ops.anim.copy_driver_button()
:   Copy the driver for the highlighted button

bpy.ops.anim.driver_button_add()
:   Add driver for the property under the cursor

bpy.ops.anim.driver_button_edit()
:   Edit the drivers for the connected property represented by the highlighted button

bpy.ops.anim.driver_button_remove(*\**, *all=True*)
:   Remove the driver(s) for the connected property(s) represented by the highlighted button

    Parameters:
    :   **all** (*boolean**,* *(**optional**)*) – All, Delete drivers for all elements of the array

bpy.ops.anim.end_frame_set()
:   Set the current frame as the preview or scene end frame

bpy.ops.anim.keyframe_clear_button(*\**, *all=True*)
:   Clear all keyframes on the currently active property

    Parameters:
    :   **all** (*boolean**,* *(**optional**)*) – All, Clear keyframes from all elements of the array

bpy.ops.anim.keyframe_clear_v3d(*\**, *confirm=True*)
:   Remove all keyframe animation for selected objects

    Parameters:
    :   **confirm** (*boolean**,* *(**optional**)*) – Confirm, Prompt for confirmation

bpy.ops.anim.keyframe_clear_vse(*\**, *confirm=True*)
:   Remove all keyframe animation for selected strips

    Parameters:
    :   **confirm** (*boolean**,* *(**optional**)*) – Confirm, Prompt for confirmation

bpy.ops.anim.keyframe_delete(*\**, *type='DEFAULT'*)
:   Delete keyframes on the current frame for all properties in the specified Keying Set

    Parameters:
    :   **type** (enum in [`'DEFAULT'`], (optional)) – Keying Set, The Keying Set to use

bpy.ops.anim.keyframe_delete_button(*\**, *all=True*)
:   Delete current keyframe of current UI-active property

    Parameters:
    :   **all** (*boolean**,* *(**optional**)*) – All, Delete keyframes from all elements of the array

bpy.ops.anim.keyframe_delete_by_name(*\**, *type=''*)
:   Alternate access to ‘Delete Keyframe’ for keymaps to use

    Parameters:
    :   **type** (*string**,* *(**optional**,* *never None**)*) – Keying Set, The Keying Set to use

bpy.ops.anim.keyframe_delete_v3d(*\**, *confirm=True*)
:   Remove keyframes on current frame for selected objects and bones

    Parameters:
    :   **confirm** (*boolean**,* *(**optional**)*) – Confirm, Prompt for confirmation

bpy.ops.anim.keyframe_delete_vse(*\**, *confirm=True*)
:   Remove keyframes on current frame for selected strips

    Parameters:
    :   **confirm** (*boolean**,* *(**optional**)*) – Confirm, Prompt for confirmation

bpy.ops.anim.keyframe_insert(*\**, *type='DEFAULT'*)
:   Insert keyframes on the current frame using either the active keying set, or the user preferences if no keying set is active

    Parameters:
    :   **type** (enum in [`'DEFAULT'`], (optional)) – Keying Set, The Keying Set to use

bpy.ops.anim.keyframe_insert_button(*\**, *all=True*)
:   Insert a keyframe for current UI-active property

    Parameters:
    :   **all** (*boolean**,* *(**optional**)*) – All, Insert a keyframe for all element of the array

bpy.ops.anim.keyframe_insert_by_name(*\**, *type=''*)
:   Alternate access to ‘Insert Keyframe’ for keymaps to use

    Parameters:
    :   **type** (*string**,* *(**optional**,* *never None**)*) – Keying Set, The Keying Set to use

bpy.ops.anim.keyframe_insert_menu(*\**, *type='DEFAULT'*, *always_prompt=False*)
:   Insert Keyframes for specified Keying Set, with menu of available Keying Sets if undefined

    Parameters:
    :   - **type** (enum in [`'DEFAULT'`], (optional)) – Keying Set, The Keying Set to use
        - **always_prompt** (*boolean**,* *(**optional**)*) – Always Show Menu

bpy.ops.anim.keying_set_active_set(*\**, *type='DEFAULT'*)
:   Set a new active keying set

    Parameters:
    :   **type** (enum in [`'DEFAULT'`], (optional)) – Keying Set, The Keying Set to use

bpy.ops.anim.keying_set_add()
:   Add a new (empty) keying set to the active Scene

bpy.ops.anim.keying_set_export(*\**, *filepath=''*, *filter_folder=True*, *filter_text=True*, *filter_python=True*)
:   Export Keying Set to a Python script

    Parameters:
    :   - **filepath** (*string**,* *(**optional**,* *never None**)*) – filepath
        - **filter_folder** (*boolean**,* *(**optional**)*) – Filter folders
        - **filter_text** (*boolean**,* *(**optional**)*) – Filter text
        - **filter_python** (*boolean**,* *(**optional**)*) – Filter Python

    File:
    :   [startup/bl_operators/anim.py:46](https://projects.blender.org/blender/blender/src/branch/main/scripts/startup/bl_operators/anim.py#L46)

bpy.ops.anim.keying_set_path_add()
:   Add empty path to active keying set

bpy.ops.anim.keying_set_path_remove()
:   Remove active Path from active keying set

bpy.ops.anim.keying_set_remove()
:   Remove the active keying set

bpy.ops.anim.keyingset_button_add(*\**, *all=True*)
:   Add current UI-active property to current keying set

    Parameters:
    :   **all** (*boolean**,* *(**optional**)*) – All, Add all elements of the array to a Keying Set

bpy.ops.anim.keyingset_button_remove()
:   Remove current UI-active property from current keying set

bpy.ops.anim.merge_animation()
:   Merge the animation of the selected objects into the action of the active object. Actions are not deleted by this, but might end up with zero users

bpy.ops.anim.paste_driver_button()
:   Paste the driver in the internal clipboard to the highlighted button

bpy.ops.anim.previewrange_clear()
:   Clear preview range

bpy.ops.anim.previewrange_set(*\**, *xmin=0*, *xmax=0*, *ymin=0*, *ymax=0*, *wait_for_input=True*)
:   Interactively define frame range used for playback

    Parameters:
    :   - **xmin** (*int in* *[**-inf**,* *inf**]**,* *(**optional**)*) – X Min
        - **xmax** (*int in* *[**-inf**,* *inf**]**,* *(**optional**)*) – X Max
        - **ymin** (*int in* *[**-inf**,* *inf**]**,* *(**optional**)*) – Y Min
        - **ymax** (*int in* *[**-inf**,* *inf**]**,* *(**optional**)*) – Y Max
        - **wait_for_input** (*boolean**,* *(**optional**)*) – Wait for Input

bpy.ops.anim.scene_range_frame()
:   Reset the horizontal view to the current scene frame range, taking the preview range into account if it is active

bpy.ops.anim.separate_slots()
:   Move all slots of the action on the active object into newly created, separate actions. All users of those slots will be reassigned to the new actions. The current action won’t be deleted but will be empty and might end up having zero users

bpy.ops.anim.slot_channels_move_to_new_action()
:   Move the selected slots into a newly created action

bpy.ops.anim.slot_new_for_id()
:   Create a new action slot for this data-block, to hold its animation

    File:
    :   [startup/bl_operators/anim.py:722](https://projects.blender.org/blender/blender/src/branch/main/scripts/startup/bl_operators/anim.py#L722)

bpy.ops.anim.slot_unassign_from_constraint()
:   Un-assign the action slot from this constraint

    File:
    :   [startup/bl_operators/anim.py:780](https://projects.blender.org/blender/blender/src/branch/main/scripts/startup/bl_operators/anim.py#L780)

bpy.ops.anim.slot_unassign_from_id()
:   Un-assign the action slot, effectively making this data-block non-animated

    File:
    :   [startup/bl_operators/anim.py:759](https://projects.blender.org/blender/blender/src/branch/main/scripts/startup/bl_operators/anim.py#L759)

bpy.ops.anim.slot_unassign_from_nla_strip()
:   Un-assign the action slot from this NLA strip, effectively making it non-animated

    File:
    :   [startup/bl_operators/anim.py:780](https://projects.blender.org/blender/blender/src/branch/main/scripts/startup/bl_operators/anim.py#L780)

bpy.ops.anim.start_frame_set()
:   Set the current frame as the preview or scene start frame

bpy.ops.anim.update_animated_transform_constraints(*\**, *use_convert_to_radians=True*)
:   Update f-curves/drivers affecting Transform constraints (use it with files from 2.70 and earlier)

    Parameters:
    :   **use_convert_to_radians** (*boolean**,* *(**optional**)*) – Convert to Radians, Convert f-curves/drivers affecting rotations to radians.Warning: Use this only once

    File:
    :   [startup/bl_operators/anim.py:400](https://projects.blender.org/blender/blender/src/branch/main/scripts/startup/bl_operators/anim.py#L400)

bpy.ops.anim.version_bone_hide_property()
:   Moves any F-Curves for the hide property of selected armatures into the action of the object. This will only operate on the first layer and strip of the action

    File:
    :   [startup/bl_operators/anim.py:843](https://projects.blender.org/blender/blender/src/branch/main/scripts/startup/bl_operators/anim.py#L843)

bpy.ops.anim.view_curve_in_graph_editor(*\**, *all=False*, *isolate=False*)
:   Frame the property under the cursor in the Graph Editor

    Parameters:
    :   - **all** (*boolean**,* *(**optional**)*) – Show All, Frame the whole array property instead of only the index under the cursor
        - **isolate** (*boolean**,* *(**optional**)*) – Isolate, Hides all F-Curves other than the ones being framed