bpy_extras submodule (bpy_extras.anim_utils)

bpy_extras.anim_utils.bake_action(obj, *, action, frames, bake_options)
Parameters:
  • obj (bpy.types.Object) – Object to bake.

  • action (bpy.types.Action | None) – An action to bake the data into, or None for a new action to be created.

  • frames (Iterable[int]) – Frames to bake.

  • bake_options (anim_utils.BakeOptions) – Options for baking.

Returns:

Action or None.

Return type:

bpy.types.Action | None

bpy_extras.anim_utils.bake_action_objects(object_action_pairs, *, frames, bake_options)

A version of bake_action_objects_iter() that takes frames and returns the output.

Parameters:
  • object_action_pairs (Sequence[tuple[bpy.types.Object, bpy.types.Action | None]]) – Sequence of object action tuples, action is the destination for the baked data. When None a new action will be created.

  • frames (Iterable[int]) – Frames to bake.

  • bake_options (anim_utils.BakeOptions) – Options for baking.

Returns:

A sequence of Action or None types (aligned with object_action_pairs)

Return type:

Sequence[bpy.types.Action]

bpy_extras.anim_utils.bake_action_iter(obj, *, action, bake_options)

A coroutine that bakes action for a single object.

Parameters:
  • obj (bpy.types.Object) – Object to bake.

  • action (bpy.types.Action | None) – An action to bake the data into, or None for a new action to be created.

  • bake_options (anim_utils.BakeOptions) – Options for baking.

Returns:

an action or None

Return type:

bpy.types.Action | None

bpy_extras.anim_utils.bake_action_objects_iter(object_action_pairs, bake_options)

A coroutine that bakes actions for multiple objects.

Parameters:
  • object_action_pairs (Sequence[tuple[bpy.types.Object, bpy.types.Action | None]]) – Sequence of object action tuples, action is the destination for the baked data. When None a new action will be created.

  • bake_options (anim_utils.BakeOptions) – Options for baking.

Returns:

A generator that yields None for each frame, then finally yields a tuple of actions (aligned with object_action_pairs).

Return type:

Generator

class bpy_extras.anim_utils.AutoKeying

Auto-keying support.

classmethod active_keyingset(context)

Return the active keying set, if it should be used.

Only returns the active keying set when the auto-key settings indicate it should be used, and when it is not using absolute paths (because that’s not supported by the Copy Global Transform add-on).

Parameters:

context (bpy.types.Context) – The context.

Returns:

The active keying set, or None when it should not be used.

Return type:

bpy.types.KeyingSet | None

classmethod autokey_transformation(context, target)

Auto-key transformation properties.

Parameters:
classmethod autokeying_options(context)

Retrieve the Auto Keyframe options, or None if disabled.

Parameters:

context (bpy.types.Context) – The context.

Returns:

The keyframing option flags, or None when auto-keying is disabled.

Return type:

set[str] | None

classmethod key_transformation(target, options)

Keyframe transformation properties, avoiding keying locked channels.

Parameters:
classmethod key_transformation_via_keyingset(context, target, keyingset)

Auto-key transformation properties with the given keying set.

Parameters:
classmethod keyframe_channels(target, options, data_path, group, locks)

Keyframe channels, avoiding keying locked channels.

Parameters:
  • target (bpy.types.Object | bpy.types.PoseBone) – The object or pose bone to keyframe.

  • options (set[str]) – Keyframing options.

  • data_path (str) – The data path to keyframe.

  • group (str) – The group name for the keyframes.

  • locks (Iterable[bool]) – Per-channel lock status.

classmethod keying_options(context)

Retrieve the general keyframing options from user preferences.

Parameters:

context (bpy.types.Context) – The context.

Returns:

The keyframing option flags.

Return type:

set[str]

classmethod keying_options_from_keyingset(context, keyingset)

Retrieve the general keyframing options from user preferences.

Parameters:
Returns:

The keyframing option flags.

Return type:

set[str]

classmethod keytype(the_keytype)

Context manager to set the key type that’s inserted.

Parameters:

the_keytype (str) – The key type to use.

Returns:

A context manager that resets the key type on exit.

Return type:

Iterator[None]

classmethod options(*, keytype='', use_loc=True, use_rot=True, use_scale=True, force_autokey=False)

Context manager to set various keyframing options.

Parameters:
  • keytype (str) – The key type to use.

  • use_loc (bool) – Key location channels.

  • use_rot (bool) – Key rotation channels.

  • use_scale (bool) – Key scale channels.

  • force_autokey (bool) – Allow use without the user activating auto-keying.

Returns:

A context manager that resets the options on exit.

Return type:

Iterator[None]

static get_4d_rotlock(bone)

Retrieve the lock status for 4D rotation.

Parameters:

bone (bpy.types.PoseBone) – The pose bone to check.

Returns:

Lock status for W, X, Y, Z rotation channels.

Return type:

list[bool]

class bpy_extras.anim_utils.BakeOptions

BakeOptions(only_selected: bool, do_pose: bool, do_object: bool, do_visual_keying: bool, do_constraint_clear: bool, do_parents_clear: bool, do_clean: bool, do_location: bool, do_rotation: bool, do_scale: bool, do_bbone: bool, do_custom_props: bool)