|
Blender V5.3
|
#include <ANIM_action.hh>
Inherits blender::ActionChannelbag.
Protected Member Functions | |
| FCurve & | fcurve_create (Main *bmain, const FCurveDescriptor &fcurve_descriptor) |
Additional Inherited Members | |
| Public Attributes inherited from blender::ActionChannelbag | |
| int32_t | slot_handle = 0 |
| int | group_array_num = 0 |
| struct bActionGroup ** | group_array = nullptr |
| uint8_t | _pad [4] = {} |
| int | fcurve_array_num = 0 |
| struct FCurve ** | fcurve_array = nullptr |
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 1010 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_clone(), 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(), and fcurves_clear().
Referenced by Channelbag(), Channelbag(), and blender::animrig::tests::ChannelbagTest::SetUp().
|
explicit |
Definition at line 2191 of file animrig/intern/action.cc.
References blender::BKE_fcurve_copy(), Channelbag(), blender::bActionGroup::channelbag, blender::ActionChannelbag::fcurve_array, blender::ActionChannelbag::fcurve_array_num, blender::ActionChannelbag::group_array, blender::ActionChannelbag::group_array_num, blender::MEM_new_array_zeroed(), and blender::ActionChannelbag::slot_handle.
| blender::animrig::Channelbag::~Channelbag | ( | ) |
| bActionGroup * blender::animrig::Channelbag::channel_group | ( | int64_t | index | ) |
Definition at line 2260 of file animrig/intern/action.cc.
References blender::BLI_assert(), blender::ActionChannelbag::group_array, and blender::ActionChannelbag::group_array_num.
| const bActionGroup * blender::animrig::Channelbag::channel_group | ( | int64_t | index | ) | const |
Definition at line 2255 of file animrig/intern/action.cc.
References blender::BLI_assert(), blender::ActionChannelbag::group_array, and blender::ActionChannelbag::group_array_num.
Referenced by channel_group_create(), Channelbag(), fcurve_detach_by_index(), and blender::rearrange_layered_action_channel_groups().
| 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 2300 of file animrig/intern/action.cc.
References channel_groups().
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 2315 of file animrig/intern/action.cc.
References blender::AGRP_SELECTED, blender::BLI_uniquename_cb(), channel_group(), channel_groups(), blender::bActionGroup::channelbag, blender::blender::StringRefBase::data(), DATA_, blender::bActionGroup::fcurve_range_length, blender::bActionGroup::fcurve_range_start, blender::bActionGroup::flag, blender::ActionChannelbag::group_array, blender::ActionChannelbag::group_array_num, blender::animrig::grow_array_and_append(), length(), blender::bActionGroup::name, STREQ, and STRNCPY_UTF8.
Referenced by blender::animchannels_group_channels(), channel_group_ensure(), and Channelbag().
| 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 2359 of file animrig/intern/action.cc.
References channel_group_create(), and channel_group_find().
Referenced by Channelbag(), blender::animrig::channelbag_fcurves_move(), blender::convert_rotation_mode_channelbag(), blender::copy_animedit_keys(), fcurve_clone(), fcurve_create(), and fcurve_create_many().
| bActionGroup * blender::animrig::Channelbag::channel_group_find | ( | StringRef | name | ) |
Definition at line 2287 of file animrig/intern/action.cc.
References channel_groups().
| 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 2266 of file animrig/intern/action.cc.
References channel_groups().
Referenced by blender::animviz_calc_motionpaths(), channel_group_ensure(), Channelbag(), and blender::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 2277 of file animrig/intern/action.cc.
References blender::ActionChannelbag::group_array, and blender::ActionChannelbag::group_array_num.
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 2394 of file animrig/intern/action.cc.
References blender::animrig::array_shift_range(), blender::BLI_assert(), BLI_assert_msg, channel_groups(), blender::ActionChannelbag::fcurve_array, blender::ActionChannelbag::fcurve_array_num, blender::bActionGroup::fcurve_range_length, blender::bActionGroup::fcurve_range_start, blender::ActionChannelbag::group_array, and blender::ActionChannelbag::group_array_num.
Referenced by Channelbag(), and blender::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 2369 of file animrig/intern/action.cc.
References blender::animrig::array_shift_range(), blender::BLI_assert(), channel_groups(), blender::ActionChannelbag::fcurve_array, blender::ActionChannelbag::fcurve_array_num, blender::bActionGroup::fcurve_range_length, and blender::bActionGroup::fcurve_range_start.
Referenced by Channelbag().
| Span< bActionGroup * > blender::animrig::Channelbag::channel_groups | ( | ) |
Definition at line 2251 of file animrig/intern/action.cc.
References blender::ActionChannelbag::group_array, and blender::ActionChannelbag::group_array_num.
| Span< const bActionGroup * > blender::animrig::Channelbag::channel_groups | ( | ) | const |
Definition at line 2247 of file animrig/intern/action.cc.
References blender::ActionChannelbag::group_array, and blender::ActionChannelbag::group_array_num.
Referenced by blender::bke::action_blend_write(), blender::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(), blender::rearrange_layered_action_channel_groups(), blender::rearrange_layered_action_fcurves(), blender::bke::write_channelbag(), and ~Channelbag().
Definition at line 2242 of file animrig/intern/action.cc.
References blender::ActionChannelbag::fcurve_array.
Definition at line 2238 of file animrig/intern/action.cc.
References blender::ActionChannelbag::fcurve_array.
Referenced by blender::animrig::legacy::action_fcurves_remove(), blender::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(), blender::paste_animedit_keys(), and blender::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 1955 of file animrig/intern/action.cc.
References fcurve(), blender::ActionChannelbag::fcurve_array, blender::ActionChannelbag::fcurve_array_num, blender::animrig::grow_array_and_append(), and blender::FCurve::grp.
Referenced by blender::animrig::action_fcurve_attach(), blender::animrig::tests::add_fcurve_to_action(), Channelbag(), blender::animrig::channelbag_fcurves_move(), blender::convert_rotation_mode_channelbag(), blender::copy_animedit_keys(), and fcurve_clone().
| 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 2846 of file animrig/intern/action.cc.
References blender::animrig::array_shift_range(), channel_groups(), fcurve(), blender::ActionChannelbag::fcurve_array, blender::ActionChannelbag::fcurve_array_num, blender::bActionGroup::fcurve_range_length, blender::bActionGroup::fcurve_range_start, and blender::FCurve::grp.
Referenced by blender::animchannels_group_channels(), Channelbag(), blender::animrig::channelbag_fcurves_move(), blender::convert_rotation_mode_channelbag(), blender::copy_animedit_keys(), and fcurve_clone().
| FCurve & blender::animrig::Channelbag::fcurve_clone | ( | const FCurve & | old_fcurve, |
| StringRefNull | new_path, | ||
| int | new_array_index, | ||
| StringRef | new_group_name ) |
Duplicates the FCurve and changes the data of the duplicate to the given new_... values. In case an FCurve with new_path and new_array_index already exists, the keys in it are replaced with the keys of old_fcurve and it is moved to new_group_name.
Definition at line 1931 of file animrig/intern/action.cc.
References blender::FCurve::array_index, blender::FCurve::bezt, blender::BKE_fcurve_copy(), channel_group_ensure(), blender::blender::StringRefBase::data(), fcurve_append(), fcurve_assign_to_channel_group(), fcurve_find(), blender::FCurve::fpt, and blender::FCurve::totvert.
Referenced by Channelbag(), and blender::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 1807 of file animrig/intern/action.cc.
References blender::BLI_assert(), blender::animrig::FCurveDescriptor::channel_group, channel_group_ensure(), blender::animrig::create_fcurve_for_channel(), blender::DEG_relations_tag_update(), blender::FCURVE_ACTIVE, blender::ActionChannelbag::fcurve_array, blender::ActionChannelbag::fcurve_array_num, blender::bActionGroup::fcurve_range_length, blender::bActionGroup::fcurve_range_start, blender::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 1835 of file animrig/intern/action.cc.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), blender::animrig::FCurveDescriptor::array_index, blender::FCurve::array_index, blender::animrig::array_shift_range(), blender::BLI_assert(), blender::animrig::FCurveDescriptor::channel_group, channel_group_ensure(), channel_group_find_index(), blender::animrig::create_fcurve_for_channel(), blender::DEG_relations_tag_update(), fcurve(), blender::FCURVE_ACTIVE, blender::ActionChannelbag::fcurve_array, blender::ActionChannelbag::fcurve_array_num, blender::bActionGroup::fcurve_range_length, blender::bActionGroup::fcurve_range_start, fcurves(), blender::FCurve::flag, blender::get_default_hash(), blender::ActionChannelbag::group_array, blender::ActionChannelbag::group_array_num, blender::animrig::grow_array(), hash, blender::blender::StringRefBase::is_empty(), blender::bke::path_templates::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 1799 of file animrig/intern/action.cc.
References fcurve_create(), and fcurve_find().
Referenced by Channelbag(), blender::io::alembic::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 1990 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 2000 of file animrig/intern/action.cc.
References blender::BLI_assert(), channel_group(), channel_group_containing_index(), channel_groups(), blender::ActionChannelbag::fcurve_array, blender::ActionChannelbag::fcurve_array_num, blender::animrig::fcurve_ptr_noop_destructor(), blender::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 1791 of file animrig/intern/action.cc.
References fcurve_create(), and fcurve_find().
Referenced by blender::animrig::action_fcurve_ensure(), Channelbag(), blender::io::fbx::create_fcurve(), blender::ed::animrig::ensure_baked_fcurves(), 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 1784 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 1779 of file animrig/intern/action.cc.
References blender::animrig::fcurve_find(), and fcurves().
Referenced by Channelbag(), fcurve_clone(), 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(), 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 2029 of file animrig/intern/action.cc.
References blender::animrig::array_shift_range(), blender::BLI_assert(), BLI_assert_msg, fcurve(), blender::ActionChannelbag::fcurve_array, blender::ActionChannelbag::fcurve_array_num, and fcurves().
Referenced by Channelbag(), and blender::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 1969 of file animrig/intern/action.cc.
References blender::BKE_fcurve_free(), and fcurve_detach().
Referenced by blender::animchannels_delete_containers(), Channelbag(), blender::ed::animrig::clean_baked_fcurves(), blender::remove_rotation_fcurves(), and blender::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 1978 of file animrig/intern/action.cc.
References blender::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 2883 of file animrig/intern/action.cc.
References blender::animrig::array_shift_range(), channel_groups(), fcurve(), blender::ActionChannelbag::fcurve_array, blender::ActionChannelbag::fcurve_array_num, blender::bActionGroup::fcurve_range_length, and blender::FCurve::grp.
Referenced by Channelbag().
Definition at line 2234 of file animrig/intern/action.cc.
References blender::ActionChannelbag::fcurve_array, and blender::ActionChannelbag::fcurve_array_num.
Definition at line 2230 of file animrig/intern/action.cc.
References blender::ActionChannelbag::fcurve_array, and blender::ActionChannelbag::fcurve_array_num.
Referenced by blender::bke::action_blend_write(), blender::action_group_to_keylist(), blender::agrp_keyframes_loop(), blender::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::io::alembic::FCurveCreationHelper::finish(), blender::ed::animation::KeyframeCopyBuffer::is_single_fcurve(), blender::ed::animation::pastebuf_find_matching_copybuf_item(), blender::io::usd::USDCameraReader::read_object_data(), blender::rearrange_layered_action_fcurves(), blender::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::update_duplicate_action_constraint_settings(), 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 2042 of file animrig/intern/action.cc.
References channel_groups(), blender::dna::array::clear(), blender::ActionChannelbag::fcurve_array, blender::ActionChannelbag::fcurve_array_num, and blender::animrig::fcurve_ptr_destructor().
Referenced by Channelbag().