Blender V5.0
blender::animrig::legacy Namespace Reference

Functions

Slotslot_ensure (Action &action)
Channelbagchannelbag_get (Action &action)
Channelbagchannelbag_ensure (Action &action)
Vector< const FCurve * > fcurves_all (const bAction *action)
Vector< FCurve * > fcurves_all (bAction *action)
Vector< FCurve * > fcurves_first_slot (bAction *action)
Vector< FCurve * > fcurves_for_action_slot (bAction *action, slot_handle_t slot_handle)
Vector< const FCurve * > fcurves_for_action_slot (const bAction *action, slot_handle_t slot_handle)
Vector< FCurve * > fcurves_for_assigned_action (AnimData *adt)
Vector< const FCurve * > fcurves_for_assigned_action (const AnimData *adt)
bool assigned_action_has_keyframes (AnimData *adt)
Vector< bActionGroup * > channel_groups_all (bAction *action)
Vector< bActionGroup * > channel_groups_for_assigned_slot (AnimData *adt)
bool action_treat_as_legacy (const bAction &action)
bool action_fcurves_remove (bAction &action, slot_handle_t slot_handle, StringRefNull rna_path_prefix)
static Stripfirst_keyframe_strip (Action &action)
template<typename ActionType, typename FCurveType, typename LayerType, typename StripType, typename StripKeyframeDataType, typename ChannelbagType>
static Vector< FCurveType * > fcurves_all_templated (ActionType &action)
template<typename ActionType, typename FCurveType, typename LayerType, typename StripType, typename StripKeyframeDataType, typename ChannelbagType>
static Vector< FCurveType * > fcurves_for_action_slot_templated (ActionType &action, const slot_handle_t slot_handle)

Variables

constexpr const char * DEFAULT_LEGACY_SLOT_NAME = "Legacy Slot"
constexpr const char * DEFAULT_LEGACY_LAYER_NAME = "Legacy Layer"

Function Documentation

◆ action_fcurves_remove()

bool blender::animrig::legacy::action_fcurves_remove ( bAction & action,
slot_handle_t slot_handle,
StringRefNull rna_path_prefix )

Remove all F-Curves whose RNA path starts with the given prefix from an Action Slot.

This function works for both legacy and layered Actions. For the former, the slot handle is ignored.

Parameters
rna_path_prefixAll F-Curves whose RNA path start with this string will get removed. Note that there is no other semantics here, so prefix = "rotation" will remove "rotation_euler" as well. The prefix may not be an empty string.
Returns
true if any were removed, false otherwise.

Definition at line 301 of file action_legacy.cc.

References BKE_fcurve_free(), BLI_assert, BLI_remlink(), blender::StringRefNull::c_str(), blender::animrig::channelbag_for_action_slot(), bAction::curves, blender::animrig::Channelbag::fcurve(), ActionChannelbag::fcurve_array_num, blender::animrig::Channelbag::fcurve_remove_by_index(), blender::animrig::Action::is_action_legacy(), blender::StringRefBase::is_empty(), LISTBASE_FOREACH_MUTABLE, FCurve::rna_path, and STRPREFIX.

Referenced by BKE_animdata_fix_paths_remove(), nlastrips_path_remove_fix(), blender::animrig::tests::TEST_F(), and blender::animrig::tests::TEST_F().

◆ action_treat_as_legacy()

◆ assigned_action_has_keyframes()

bool blender::animrig::legacy::assigned_action_has_keyframes ( AnimData * adt)

Return whether the action (+slot), if any, assigned to adt has keyframes.

This works for both layered and legacy actions. For layered actions this only considers the assigned slot.

A null adt or a lack of assigned action are both handled, and are considered to mean no key frames (and thus will return false).

Definition at line 219 of file action_legacy.cc.

References AnimData::action, bAction::curves, ListBase::first, blender::animrig::Action::has_keyframes(), blender::animrig::Action::is_action_legacy(), and AnimData::slot_handle.

Referenced by animviz_motionpath_compute_range().

◆ channel_groups_all()

◆ channel_groups_for_assigned_slot()

Vector< bActionGroup * > blender::animrig::legacy::channel_groups_for_assigned_slot ( AnimData * adt)

Return all Channel Groups for the assigned Action Slot.

This works for both legacy and layered Actions. For the former, this function acts identical to channel_groups_all().

See also
blender::animrig::legacy::channel_groups_all

Definition at line 268 of file action_legacy.cc.

References AnimData::action, blender::animrig::Channelbag::channel_groups(), channel_groups_all(), blender::animrig::channelbag_for_action_slot(), blender::animrig::Action::is_action_legacy(), and AnimData::slot_handle.

◆ channelbag_ensure()

Channelbag & blender::animrig::legacy::channelbag_ensure ( Action & action)

Ensure a Channelbag exists, for compatibility with the legacy Python API.

This basically is channelbag_get(action), additionally creating the necessary slot, layer, and keyframe strip if necessary.

Definition at line 56 of file action_legacy.cc.

References blender::animrig::assert_baklava_phase_1_invariants(), blender::animrig::Strip::data(), DATA_, DEFAULT_LEGACY_LAYER_NAME, blender::animrig::Action::layer(), blender::animrig::Action::layer_add(), blender::animrig::Action::layers(), slot_ensure(), blender::animrig::Layer::strip(), blender::animrig::Layer::strip_add(), and blender::animrig::Layer::strips().

◆ channelbag_get()

Channelbag * blender::animrig::legacy::channelbag_get ( Action & action)

Return the Channelbag for compatibility with the legacy Python API.

Returns
the Channelbag for the first slot, of the first keyframe Strip on the bottom layer, or nullptr if that doesn't exist.

Definition at line 42 of file action_legacy.cc.

References blender::animrig::Strip::data(), first_keyframe_strip(), blender::animrig::Action::slot(), and blender::animrig::Action::slots().

◆ fcurves_all() [1/2]

Vector< FCurve * > blender::animrig::legacy::fcurves_all ( bAction * action)

Definition at line 118 of file action_legacy.cc.

References fcurves_all_templated().

◆ fcurves_all() [2/2]

Vector< const FCurve * > blender::animrig::legacy::fcurves_all ( const bAction * action)

Return all F-Curves in the Action.

This works for both legacy and layered Actions. For the latter, it will return all F-Curves for all slots/layers/strips.

The use of this function is an indicator for code that might have to be inspected to see if this is really the desired behavior, or whether the F-Curves for a specific slot/layer/strip should be used instead.

See also
blender::animrig::legacy::fcurves_for_action_slot

Definition at line 127 of file action_legacy.cc.

References fcurves_all_templated().

Referenced by blender::animrig::action_deselect_keys(), action_flip_pchan_rna_paths(), animsys_evaluate_action(), fcurves_first_slot(), blender::animrig::Action::get_frame_range(), blender::animrig::Action::get_frame_range_of_keys(), blender::animrig::Action::get_frame_range_of_slot(), blender::animrig::Action::has_single_frame(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), and blender::animrig::tests::TEST_F().

◆ fcurves_all_templated()

template<typename ActionType, typename FCurveType, typename LayerType, typename StripType, typename StripKeyframeDataType, typename ChannelbagType>
Vector< FCurveType * > blender::animrig::legacy::fcurves_all_templated ( ActionType & action)
static

◆ fcurves_first_slot()

Vector< FCurve * > blender::animrig::legacy::fcurves_first_slot ( bAction * action)

Return the F-Curves for the first slot of this Action.

This works for both legacy and layered Actions. For the former, it will return all F-Curves in the Action.

Definition at line 140 of file action_legacy.cc.

References fcurves_all(), fcurves_for_action_slot(), ActionSlot::handle, blender::animrig::Action::is_action_legacy(), blender::animrig::Action::slot(), and blender::animrig::Action::slots().

◆ fcurves_for_action_slot() [1/2]

Vector< FCurve * > blender::animrig::legacy::fcurves_for_action_slot ( bAction * action,
slot_handle_t slot_handle )

Return the F-Curves for this specific slot handle.

On a legacy Action, this returns all F-Curves, and ignores the slot handle.

The use of this function is an indicator for code that can be simplified when the slotted Actions feature is no longer experimental. When that switchover happens, calls to this function can be replaced with the more efficient blender::animrig::fcurves_for_action_slot().

See also
blender::animrig::fcurves_for_action_slot
blender::animrig::legacy::fcurves_all

Definition at line 177 of file action_legacy.cc.

References fcurves_for_action_slot_templated().

Referenced by adt_apply_all_fcurves_cb(), animsys_blend_in_action(), blender::bke::BKE_action_find_fcurves_with_bones(), BKE_action_fix_paths_rename(), BKE_animdata_fix_paths_rename(), fcurves_first_slot(), fcurves_for_assigned_action(), fcurves_for_assigned_action(), nla_eval_domain_action(), nlasnapshot_from_action(), nlastrips_apply_all_curves_cb(), nlastrips_path_rename_fix(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), and blender::animrig::tests::TEST_F().

◆ fcurves_for_action_slot() [2/2]

Vector< const FCurve * > blender::animrig::legacy::fcurves_for_action_slot ( const bAction * action,
slot_handle_t slot_handle )

Definition at line 189 of file action_legacy.cc.

References fcurves_for_action_slot_templated().

◆ fcurves_for_action_slot_templated()

template<typename ActionType, typename FCurveType, typename LayerType, typename StripType, typename StripKeyframeDataType, typename ChannelbagType>
Vector< FCurveType * > blender::animrig::legacy::fcurves_for_action_slot_templated ( ActionType & action,
const slot_handle_t slot_handle )
static

◆ fcurves_for_assigned_action() [1/2]

Vector< FCurve * > blender::animrig::legacy::fcurves_for_assigned_action ( AnimData * adt)

Return the F-Curves for the assigned Action Slot.

For legacy Actions, this ignores the slot and just returns all F-Curves of the assigned Action.

If adt is nullptr or there is no Action assigned (i.e. adt->action == nullptr), an empty Vector is returned.

Definition at line 203 of file action_legacy.cc.

References AnimData::action, fcurves_for_action_slot(), and AnimData::slot_handle.

Referenced by animviz_motionpath_compute_range(), blender::animrig::assigned_action_has_keyframe_at(), ED_curve_updateAnimPaths(), gather_frames_to_render_for_adt(), blender::ed::greasepencil::get_selected_object_keyframes(), blender::ed::vse::has_playback_animation(), modifiers_has_animation_check(), and blender::ed::vse::sequencer_paste_animation().

◆ fcurves_for_assigned_action() [2/2]

Vector< const FCurve * > blender::animrig::legacy::fcurves_for_assigned_action ( const AnimData * adt)

◆ first_keyframe_strip()

Strip * blender::animrig::legacy::first_keyframe_strip ( Action & action)
static

Definition at line 16 of file action_legacy.cc.

References blender::animrig::Action::layers().

Referenced by channelbag_get().

◆ slot_ensure()

Slot & blender::animrig::legacy::slot_ensure ( Action & action)

Ensure that a Slot exists, for legacy Python API shims that need one.

Returns
The first Slot if one already exists, or a newly created "Legacy Slot" otherwise.

Definition at line 29 of file action_legacy.cc.

References blender::animrig::assert_baklava_phase_1_invariants(), DATA_, DEFAULT_LEGACY_SLOT_NAME, blender::animrig::Action::slot(), blender::animrig::Action::slot_add(), blender::animrig::Action::slot_display_name_define(), and blender::animrig::Action::slots().

Referenced by channelbag_ensure().

Variable Documentation

◆ DEFAULT_LEGACY_LAYER_NAME

const char* blender::animrig::legacy::DEFAULT_LEGACY_LAYER_NAME = "Legacy Layer"
constexpr

◆ DEFAULT_LEGACY_SLOT_NAME

const char* blender::animrig::legacy::DEFAULT_LEGACY_SLOT_NAME = "Legacy Slot"
constexpr