|
Blender V5.0
|
#include <ANIM_action.hh>
Inherits ActionChannelbag.
Protected Member Functions | |
| FCurve & | fcurve_create (Main *bmain, const FCurveDescriptor &fcurve_descriptor) |
Additional Inherited Members | |
| Public Attributes inherited from ActionChannelbag | |
| int32_t | slot_handle |
| int | group_array_num |
| struct bActionGroup ** | group_array |
| uint8_t | _pad [4] |
| int | fcurve_array_num |
| struct FCurve ** | fcurve_array |
Collection of F-Curves, intended for a specific Slot handle.
In addition to F-Curves, Channelbags can also contain ChannelGroups, which are used to organize F-Curves within the Channelbag (e.g. all F-Curves for a given bone can be put into a ChannelGroup with that bone's name).
Definition at line 1061 of file ANIM_action.hh.
|
default |
References channel_group(), channel_group_containing_index(), channel_group_create(), channel_group_ensure(), channel_group_find(), channel_group_find_index(), channel_group_move_to_index(), channel_group_remove(), channel_groups(), Channelbag(), fcurve(), fcurve_append(), fcurve_assign_to_channel_group(), fcurve_create(), fcurve_create_many(), fcurve_create_unique(), fcurve_detach(), fcurve_detach_by_index(), fcurve_ensure(), fcurve_find(), fcurve_move_to_index(), fcurve_remove(), fcurve_remove_by_index(), fcurve_ungroup(), fcurves(), fcurves_clear(), and name.
Referenced by Channelbag(), and Channelbag().
|
explicit |
Definition at line 2239 of file animrig/intern/action.cc.
References BKE_fcurve_copy(), Channelbag(), ActionChannelbag::fcurve_array, ActionChannelbag::fcurve_array_num, ActionChannelbag::group_array, ActionChannelbag::group_array_num, i, MEM_calloc_arrayN(), MEM_dupallocN(), and ActionChannelbag::slot_handle.
| blender::animrig::Channelbag::~Channelbag | ( | ) |
Definition at line 2263 of file animrig/intern/action.cc.
References BKE_fcurve_free(), channel_groups(), ActionChannelbag::fcurve_array, ActionChannelbag::fcurve_array_num, fcurves(), ActionChannelbag::group_array, ActionChannelbag::group_array_num, and MEM_SAFE_FREE.
| bActionGroup * blender::animrig::Channelbag::channel_group | ( | int64_t | index | ) |
Definition at line 2308 of file animrig/intern/action.cc.
References BLI_assert, ActionChannelbag::group_array, and ActionChannelbag::group_array_num.
| const bActionGroup * blender::animrig::Channelbag::channel_group | ( | int64_t | index | ) | const |
Definition at line 2303 of file animrig/intern/action.cc.
References BLI_assert, ActionChannelbag::group_array, and ActionChannelbag::group_array_num.
Referenced by channel_group_create(), Channelbag(), fcurve_detach_by_index(), rearrange_layered_action_channel_groups(), blender::animrig::tests::TEST_F(), and blender::animrig::tests::TEST_F().
| int blender::animrig::Channelbag::channel_group_containing_index | ( | int | fcurve_array_index | ) |
Find the channel group that contains the fcurve at fcurve_array_index as a member.
Definition at line 2348 of file animrig/intern/action.cc.
References channel_groups(), and i.
Referenced by Channelbag(), and fcurve_detach_by_index().
| bActionGroup & blender::animrig::Channelbag::channel_group_create | ( | StringRefNull | name | ) |
Create a new empty channel group with the given name.
The new group is added to the end of the channel group array of the Channelbag.
This function ensures the group has a unique name, and thus the name of the created group may differ from the name parameter.
Definition at line 2363 of file animrig/intern/action.cc.
References AGRP_SELECTED, BLI_uniquename_cb(), channel_group(), channel_groups(), bActionGroup::channelbag, DATA_, bActionGroup::fcurve_range_length, bActionGroup::fcurve_range_start, bActionGroup::flag, ActionChannelbag::group_array, ActionChannelbag::group_array_num, blender::animrig::grow_array_and_append(), length(), MEM_callocN(), bActionGroup::name, name, STREQ, STRNCPY_UTF8, and unique_name().
Referenced by animchannels_group_channels(), channel_group_ensure(), Channelbag(), and blender::animrig::convert_to_layered_action().
| bActionGroup & blender::animrig::Channelbag::channel_group_ensure | ( | StringRefNull | name | ) |
Find a channel group with the given name, or if none exists create one.
If a new group is created, it's added to the end of the channel group array of the Channelbag.
Definition at line 2407 of file animrig/intern/action.cc.
References channel_group_create(), channel_group_find(), and name.
Referenced by Channelbag(), blender::animrig::channelbag_fcurves_move(), copy_animedit_keys(), fcurve_create(), fcurve_create_many(), and update_duplicate_action_constraint_settings().
| bActionGroup * blender::animrig::Channelbag::channel_group_find | ( | StringRef | name | ) |
Definition at line 2335 of file animrig/intern/action.cc.
References channel_groups(), and name.
| const bActionGroup * blender::animrig::Channelbag::channel_group_find | ( | StringRef | name | ) | const |
Find the first bActionGroup (channel group) with the given name.
Note that channel groups with the same name are allowed, and this simply returns the first match.
If no matching group is found, nullptr is returned.
Definition at line 2314 of file animrig/intern/action.cc.
References channel_groups(), and name.
Referenced by animviz_calc_motionpaths(), channel_group_ensure(), Channelbag(), and what_does_obaction().
| int blender::animrig::Channelbag::channel_group_find_index | ( | const bActionGroup * | group | ) | const |
Find the index of the channel group.
Definition at line 2325 of file animrig/intern/action.cc.
References ActionChannelbag::group_array, ActionChannelbag::group_array_num, and i.
Referenced by Channelbag(), and fcurve_create_many().
| void blender::animrig::Channelbag::channel_group_move_to_index | ( | bActionGroup & | group, |
| int | to_group_index ) |
Move the given channel group's to position to_group_index among the channel groups.
The fcurves in the channel group are moved with it, so that membership doesn't change.
group must belong to this channel bag, and to_group_index must be a valid index in the channel group array.
Definition at line 2442 of file animrig/intern/action.cc.
References blender::animrig::array_shift_range(), BLI_assert, BLI_assert_msg, channel_groups(), ActionChannelbag::fcurve_array, ActionChannelbag::fcurve_array_num, bActionGroup::fcurve_range_length, bActionGroup::fcurve_range_start, ActionChannelbag::group_array, ActionChannelbag::group_array_num, and size().
Referenced by Channelbag(), and rearrange_layered_action_channel_groups().
| bool blender::animrig::Channelbag::channel_group_remove | ( | bActionGroup & | group | ) |
Remove the given channel group from the channel bag.
Any fcurves that were part of this group will me moved to just after all grouped fcurves.
Definition at line 2417 of file animrig/intern/action.cc.
References blender::animrig::array_shift_range(), BLI_assert, channel_groups(), ActionChannelbag::fcurve_array, ActionChannelbag::fcurve_array_num, bActionGroup::fcurve_range_length, and bActionGroup::fcurve_range_start.
Referenced by Channelbag().
| blender::Span< bActionGroup * > blender::animrig::Channelbag::channel_groups | ( | ) |
Definition at line 2299 of file animrig/intern/action.cc.
References ActionChannelbag::group_array, and ActionChannelbag::group_array_num.
| blender::Span< const bActionGroup * > blender::animrig::Channelbag::channel_groups | ( | ) | const |
Definition at line 2295 of file animrig/intern/action.cc.
References ActionChannelbag::group_array, and ActionChannelbag::group_array_num.
Referenced by blender::bke::action_blend_write(), ANIM_animfilter_action_slot(), channel_group_containing_index(), channel_group_create(), channel_group_find(), channel_group_find(), channel_group_move_to_index(), channel_group_remove(), blender::animrig::legacy::channel_groups_for_assigned_slot(), Channelbag(), fcurve_assign_to_channel_group(), fcurve_detach_by_index(), fcurve_ungroup(), fcurves_clear(), rearrange_layered_action_channel_groups(), rearrange_layered_action_fcurves(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::bke::write_channelbag(), and ~Channelbag().
Definition at line 2290 of file animrig/intern/action.cc.
References ActionChannelbag::fcurve_array.
Definition at line 2286 of file animrig/intern/action.cc.
References ActionChannelbag::fcurve_array.
Referenced by blender::animrig::legacy::action_fcurves_remove(), animchannels_delete_containers(), Channelbag(), blender::animrig::channelbag_fcurves_move(), fcurve_append(), fcurve_assign_to_channel_group(), fcurve_create_many(), fcurve_move_to_index(), fcurve_remove_by_index(), fcurve_ungroup(), and rearrange_layered_action_fcurves().
| void blender::animrig::Channelbag::fcurve_append | ( | FCurve & | fcurve | ) |
Append an F-Curve to this Channelbag.
This transfers ownership of the F-Curve to this Channelbag, and it is up to the caller to ensure that this is valid (e.g. the F-Curve doesn't also belong to something else).
The F-Curve will not be member of any group after appending.
This is considered a low-level function. Things like depsgraph relations tagging is left to the caller.
Definition at line 2003 of file animrig/intern/action.cc.
References fcurve(), ActionChannelbag::fcurve_array, ActionChannelbag::fcurve_array_num, and blender::animrig::grow_array_and_append().
Referenced by blender::animrig::action_fcurve_attach(), blender::animrig::tests::add_fcurve_to_action(), Channelbag(), blender::animrig::channelbag_fcurves_move(), copy_animedit_keys(), and update_duplicate_action_constraint_settings().
| bool blender::animrig::Channelbag::fcurve_assign_to_channel_group | ( | FCurve & | fcurve, |
| bActionGroup & | to_group ) |
Assigns the given FCurve to the given channel group.
Fails if either doesn't belong to this channel bag, but otherwise always succeeds.
Definition at line 2976 of file animrig/intern/action.cc.
References blender::animrig::array_shift_range(), channel_groups(), fcurve(), ActionChannelbag::fcurve_array, ActionChannelbag::fcurve_array_num, fcurve_assign_to_channel_group(), bActionGroup::fcurve_range_length, and bActionGroup::fcurve_range_start.
Referenced by animchannels_group_channels(), Channelbag(), blender::animrig::channelbag_fcurves_move(), blender::animrig::convert_to_layered_action(), copy_animedit_keys(), fcurve_assign_to_channel_group(), and update_duplicate_action_constraint_settings().
|
protected |
Create an F-Curve.
Assumes that there is no such F-Curve yet on this Channelbag. If it is uncertain whether this is the case, use fcurve_create_unique() instead.
| bmain | Used to tag the dependency graph(s) for relationship rebuilding. This is necessary when adding a new F-Curve, as a previously-unanimated depsgraph component may become animated now. Can be nullptr, in which case the tagging is skipped and is left as the responsibility of the caller. |
Definition at line 1879 of file animrig/intern/action.cc.
References BLI_assert, blender::animrig::FCurveDescriptor::channel_group, channel_group_ensure(), blender::animrig::create_fcurve_for_channel(), DEG_relations_tag_update(), FCURVE_ACTIVE, ActionChannelbag::fcurve_array, ActionChannelbag::fcurve_array_num, bActionGroup::fcurve_range_length, bActionGroup::fcurve_range_start, FCurve::flag, and blender::animrig::grow_array_and_insert().
Referenced by Channelbag(), fcurve_create_unique(), and fcurve_ensure().
| Vector< FCurve * > blender::animrig::Channelbag::fcurve_create_many | ( | Main * | bmain, |
| Span< FCurveDescriptor > | fcurve_descriptors ) |
Create many F-Curves at once.
Conceptually the same as adding many curves in a loop:
However that is quadratic complexity due to each curve uniqueness check being a linear scan, plus invariants rebuilding after each curve.
| bmain | Used to tag the dependency graph(s) for relationship rebuilding. This is necessary when adding a new F-Curve, as a previously-unanimated depsgraph component may become animated now. Can be nullptr, in which case the tagging is skipped and is left as the responsibility of the caller. |
Definition at line 1907 of file animrig/intern/action.cc.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), blender::animrig::FCurveDescriptor::array_index, blender::animrig::array_shift_range(), BLI_assert, blender::animrig::FCurveDescriptor::channel_group, channel_group_ensure(), channel_group_find_index(), blender::animrig::create_fcurve_for_channel(), DEG_relations_tag_update(), fcurve(), FCURVE_ACTIVE, ActionChannelbag::fcurve_array, ActionChannelbag::fcurve_array_num, bActionGroup::fcurve_range_length, bActionGroup::fcurve_range_start, fcurves(), blender::get_default_hash(), ActionChannelbag::group_array, ActionChannelbag::group_array_num, blender::animrig::grow_array(), hash, i, blender::StringRefBase::is_empty(), operator==(), blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::reserve(), blender::Vector< T, InlineBufferCapacity, Allocator >::resize(), blender::animrig::FCurveDescriptor::rna_path, blender::animrig::shrink_array(), and blender::Span< T >::size().
Referenced by Channelbag(), and blender::io::fbx::import_animations().
| FCurve * blender::animrig::Channelbag::fcurve_create_unique | ( | Main * | bmain, |
| const FCurveDescriptor & | fcurve_descriptor ) |
Create an F-Curve, but only if it doesn't exist yet in this Channelbag.
| bmain | Used to tag the dependency graph(s) for relationship rebuilding. This is necessary when adding a new F-Curve, as a previously-unanimated depsgraph component may become animated now. Can be nullptr, in which case the tagging is skipped and is left as the responsibility of the caller. |
Definition at line 1871 of file animrig/intern/action.cc.
References fcurve_create(), and fcurve_find().
Referenced by Channelbag(), blender::io::fbx::create_fcurve(), blender::io::usd::create_fcurve(), and blender::animrig::tests::TEST_F().
| bool blender::animrig::Channelbag::fcurve_detach | ( | FCurve & | fcurve_to_detach | ) |
Detach an F-Curve from the Channelbag.
Additionally, if the fcurve was the last fcurve in a channel group, that channel group is deleted.
The F-Curve is not freed. After the call returns true, its ownership has transferred to the caller.
Definition at line 2038 of file animrig/intern/action.cc.
References fcurve_detach_by_index(), and fcurves().
Referenced by Channelbag(), blender::animrig::channelbag_fcurves_move(), and fcurve_remove().
| void blender::animrig::Channelbag::fcurve_detach_by_index | ( | int64_t | fcurve_index | ) |
Detach an F-Curve from the Channelbag, identified by its index in the array.
Acts the same as fcurve_detach() except it's a bit more efficient as it doesn't need to find the F-Curve in the array first.
Definition at line 2048 of file animrig/intern/action.cc.
References BLI_assert, channel_group(), channel_group_containing_index(), channel_groups(), ActionChannelbag::fcurve_array, ActionChannelbag::fcurve_array_num, blender::animrig::fcurve_ptr_noop_destructor(), bActionGroup::fcurve_range_length, and blender::dna::array::remove_index().
Referenced by Channelbag(), fcurve_detach(), and fcurve_remove_by_index().
| FCurve & blender::animrig::Channelbag::fcurve_ensure | ( | Main * | bmain, |
| const FCurveDescriptor & | fcurve_descriptor ) |
Find an FCurve matching the fcurve descriptor, or create one if it doesn't exist.
| bmain | Used to tag the dependency graph(s) for relationship rebuilding. This is necessary when adding a new F-Curve, as a previously-unanimated depsgraph component may become animated now. Can be nullptr, in which case the tagging is skipped and is left as the responsibility of the caller. |
Definition at line 1863 of file animrig/intern/action.cc.
References fcurve_create(), and fcurve_find().
Referenced by blender::animrig::action_fcurve_ensure(), Channelbag(), blender::animrig::StripKeyframeData::keyframe_insert(), blender::ed::animrig::replace_pose_key(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::editor::animation::tests::TEST_F(), and blender::editor::animation::tests::TEST_F().
| FCurve * blender::animrig::Channelbag::fcurve_find | ( | const FCurveDescriptor & | fcurve_descriptor | ) |
Definition at line 1856 of file animrig/intern/action.cc.
References blender::animrig::fcurve_find(), and fcurves().
| const FCurve * blender::animrig::Channelbag::fcurve_find | ( | const FCurveDescriptor & | fcurve_descriptor | ) | const |
Find an FCurve matching the fcurve descriptor.
If it cannot be found, nullptr is returned.
Definition at line 1851 of file animrig/intern/action.cc.
References blender::animrig::fcurve_find(), and fcurves().
Referenced by Channelbag(), fcurve_create_unique(), fcurve_ensure(), blender::animrig::fcurve_find_in_action_slot(), blender::animrig::StripKeyframeData::keyframe_insert(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), and blender::animrig::tests::TEST_F().
| void blender::animrig::Channelbag::fcurve_move_to_index | ( | FCurve & | fcurve, |
| int | to_fcurve_index ) |
Move the given fcurve to position to_fcurve_index in the fcurve array.
Note: this can indirectly alter channel group memberships, because the channel groups don't change what ranges in the fcurve array they cover.
fcurve must belong to this channel bag, and to_fcurve_index must be a valid index in the fcurve array.
Definition at line 2077 of file animrig/intern/action.cc.
References blender::animrig::array_shift_range(), BLI_assert, BLI_assert_msg, fcurve(), ActionChannelbag::fcurve_array, ActionChannelbag::fcurve_array_num, fcurves(), and size().
Referenced by Channelbag(), and rearrange_layered_action_fcurves().
| bool blender::animrig::Channelbag::fcurve_remove | ( | FCurve & | fcurve_to_remove | ) |
Remove an F-Curve from the Channelbag.
Additionally, if the F-Curve was the last F-Curve in a channel group, that channel group is also deleted.
After this call, if the F-Curve was found, the reference will no longer be valid, as the curve will have been freed.
Definition at line 2017 of file animrig/intern/action.cc.
References BKE_fcurve_free(), and fcurve_detach().
Referenced by animchannels_delete_containers(), Channelbag(), and remove_sequencer_fcurves().
| void blender::animrig::Channelbag::fcurve_remove_by_index | ( | int64_t | fcurve_index | ) |
Remove an F-Curve from the Channelbag, identified by its index in the array.
Acts the same as fcurve_remove() except it's a bit more efficient as it doesn't need to find the F-Curve in the array first.
Definition at line 2026 of file animrig/intern/action.cc.
References BKE_fcurve_free(), fcurve(), and fcurve_detach_by_index().
Referenced by blender::animrig::legacy::action_fcurves_remove(), and Channelbag().
| bool blender::animrig::Channelbag::fcurve_ungroup | ( | FCurve & | fcurve | ) |
Removes the given FCurve from the channel group it's in, if any.
As part of removing fcurve from its group, fcurve is moved to the end of the fcurve array. However, if fcurve is already ungrouped then this method is a no-op.
Fails if the fcurve doesn't belong to this channel bag, but otherwise always succeeds.
Definition at line 3013 of file animrig/intern/action.cc.
References blender::animrig::array_shift_range(), channel_groups(), fcurve(), ActionChannelbag::fcurve_array, ActionChannelbag::fcurve_array_num, bActionGroup::fcurve_range_length, and fcurve_ungroup().
Referenced by Channelbag(), and fcurve_ungroup().
| blender::Span< FCurve * > blender::animrig::Channelbag::fcurves | ( | ) |
Definition at line 2282 of file animrig/intern/action.cc.
References ActionChannelbag::fcurve_array, and ActionChannelbag::fcurve_array_num.
| blender::Span< const FCurve * > blender::animrig::Channelbag::fcurves | ( | ) | const |
Definition at line 2278 of file animrig/intern/action.cc.
References ActionChannelbag::fcurve_array, and ActionChannelbag::fcurve_array_num.
Referenced by blender::bke::action_blend_write(), action_group_to_keylist(), agrp_keyframes_loop(), ANIM_animfilter_action_slot(), blender::seq::animation_duplicate_backup_to_scene(), blender::seq::animation_restore_original(), Channelbag(), blender::animrig::channelbag_fcurves_move(), blender::animrig::evaluate_keyframe_data(), fcurve_create_many(), fcurve_detach(), fcurve_find(), fcurve_find(), fcurve_move_to_index(), blender::animrig::fcurves_for_action_slot(), blender::animrig::fcurves_for_action_slot(), blender::ed::animation::KeyframeCopyBuffer::is_single_fcurve(), blender::ed::animation::pastebuf_find_matching_copybuf_item(), blender::io::usd::USDCameraReader::read_object_data(), rearrange_layered_action_fcurves(), remove_sequencer_fcurves(), blender::seq::strip_animation_duplicate(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::bke::write_channelbag(), and ~Channelbag().
| void blender::animrig::Channelbag::fcurves_clear | ( | ) |
Remove all F-Curves from this Channelbag.
Since all channel groups become empty, this also removes all channel groups.
Definition at line 2090 of file animrig/intern/action.cc.
References channel_groups(), blender::dna::array::clear(), ActionChannelbag::fcurve_array, ActionChannelbag::fcurve_array_num, and blender::animrig::fcurve_ptr_destructor().
Referenced by Channelbag().