33#include "RNA_prototypes.hh"
69constexpr const char *slot_default_name =
"Slot";
74constexpr const char *slot_untyped_prefix =
"XX";
76constexpr const char *layer_default_name =
"Layer";
91 const int new_array_num = *
num + add_num;
95 MEM_SAFE_DELETE(*
array);
104 (*array)[*
num - 1] = item;
111 const int new_array_num = *
num + 1;
115 new_array[
index] = item;
118 MEM_SAFE_DELETE(*
array);
121 *
num = new_array_num;
127 const int new_array_num = *
num - shrink_num;
128 if (new_array_num == 0) {
141 *
num = new_array_num;
147 const int new_array_num = *
num - 1;
155 *
num = new_array_num;
166 const int new_array_num = *
num - 1;
170 if (
index < new_array_num) {
171 new_array[
index] = (*array)[new_array_num];
177 *
num = new_array_num;
191 T *
array,
const int num,
const int range_start,
const int range_end,
const int to)
198 if (
ELEM(range_start, range_end, to)) {
202 if (to < range_start) {
204 T *mid =
array + range_start;
205 T *end =
array + range_end;
206 std::rotate(start, mid, end);
209 T *start =
array + range_start;
210 T *mid =
array + range_end;
211 T *end =
array + to + range_end - range_start;
212 std::rotate(start, mid, end);
248 if (name.has_value()) {
279 if (layer_index < 0) {
299 layer = this->layer(0);
303 if (
layer->strips().is_empty()) {
315 for (
const int64_t layer_index : this->
layers().index_range()) {
316 const Layer *visit_layer = this->layer(layer_index);
317 if (visit_layer == &
layer) {
326 for (
const int64_t slot_index : this->
slots().index_range()) {
327 const Slot *visit_slot = this->slot(slot_index);
328 if (visit_slot == &
slot) {
375 auto check_name_is_used = [&](
const StringRef name) ->
bool {
376 for (
const Slot *slot_iter : action.
slots()) {
377 if (slot_iter == &slot) {
381 if (slot_iter->identifier == name) {
400 "Action Slot display names must not be empty");
402 "Action Slot's existing identifier lacks the two-character type prefix, which "
403 "would make the display name copy meaningless due to early null termination.");
431 "Action Slot identifiers must be large enough for a 2-letter ID code + the display name");
450 if (!adt || adt->
action !=
this) {
477Slot &Action::slot_allocate()
479 Slot &
slot = *MEM_new<Slot>(__func__);
543 slot_identifier = animated_id.
name;
560 Slot &slot = (*dna_slot_ptr)->wrap();
568 if (slot_index < 0) {
574 strip_data->slot_data_remove(slot_to_remove.
handle);
590 const int from_slot_index = this->
slots().first_index_try(&
slot);
648 MEM_delete<StripKeyframeData>(
660 const int old_index = this->strip_keyframe_data_array_num;
664 strip->data_index =
index;
697 return this->
layer(0);
700void Action::slot_identifier_ensure_prefix(
Slot &slot)
721 this->slot_identifier_ensure_prefix(
slot);
736 bool found_key =
false;
737 float found_key_frame = 0.0f;
740 switch (fcu->totvert) {
752 const float this_key_frame = fcu->bezt !=
nullptr ? fcu->bezt[0].vec[1][0] :
756 found_key_frame = this_key_frame;
762 if (!
compare_ff(found_key_frame, this_key_frame, 0.001f)) {
806 const bool include_modifiers)
808 float min = 999999999.0f,
max = -999999999.0f;
809 bool foundvert =
false, foundmod =
false;
811 for (
const FCurve *fcu : fcurves) {
834 if ((include_modifiers) && (fcu->modifiers.last())) {
875 if (foundvert || foundmod) {
879 return float2{0.0f, 0.0f};
887 *copy = *
reinterpret_cast<const ActionLayer *
>(
this);
891 allocation_name.
c_str());
892 for (
int i : this->
strips().index_range()) {
893 Strip *strip_copy = MEM_new<Strip>(allocation_name.
c_str(), *this->strip(i));
894 copy->strip_array[i] = strip_copy;
897 return ©->wrap();
939 Strip &strip = (*dna_strip_ptr)->wrap();
946 if (strip_index < 0) {
960 switch (strip_type) {
971 for (
const int64_t strip_index : this->
strips().index_range()) {
972 const Strip *visit_strip = this->strip(strip_index);
973 if (visit_strip == &
strip) {
986 this->
runtime = MEM_new<SlotRuntime>(__func__);
991 this->
runtime = MEM_new<SlotRuntime>(__func__);
1002 this->
runtime = MEM_new<SlotRuntime>(__func__);
1013 const int animated_idtype = animated_id.id_type();
1014 return this->
idtype == animated_idtype;
1019 return this->
idtype != 0;
1086 this->
runtime->
users.append_non_duplicates(&animated_id);
1109 return slot_untyped_prefix;
1113 *
reinterpret_cast<short *
>(name) = this->
idtype;
1148 this->
identifier[0] = slot_untyped_prefix[0];
1149 this->
identifier[1] = slot_untyped_prefix[1];
1163 return dna_action->wrap();
1179 BKE_report(
nullptr,
RPT_ERROR,
"Cannot change action, as it is still being edited in NLA");
1216 if (adt && adt->
action == &action) {
1232 if (!slot && action.
slots().size() == 1) {
1246 const bool is_correct_action = adt && adt->
action == &action;
1247 if (!is_correct_action && !
assign_action(&action, animated_id)) {
1267 auto visit_action_use = [&](
const Action &used_action,
slot_handle_t used_slot_handle) ->
bool {
1268 const bool is_used = (&used_action == &action && used_slot_handle == slot_handle);
1273 return !looped_until_end;
1280 char *slot_identifier)
1285 if (action_ptr_ref) {
1289 nullptr, animated_id, action_ptr_ref, slot_handle_ref, slot_identifier);
1296 action_ptr_ref =
nullptr;
1299 if (!action_to_assign) {
1305 action_ptr_ref = action_to_assign;
1311 slot, animated_id, action_ptr_ref, slot_handle_ref, slot_identifier);
1327 if (!last_slot_identifier.
is_empty()) {
1343 const bool last_used_identifier_is_typed = last_slot_identifier.
substr(0, 2) !=
1344 slot_untyped_prefix;
1345 if (!last_used_identifier_is_typed) {
1346 const std::string with_idtype_prefix =
StringRef(animated_id.
name, 2) +
1347 last_slot_identifier.
substr(2);
1363 if (last_used_identifier_is_typed) {
1364 const std::string with_untyped_prefix =
StringRef(slot_untyped_prefix) +
1365 last_slot_identifier.
substr(2);
1399 if (action.
slots().size() == 1) {
1413 char *slot_identifier)
1416 if (!action_ptr_ref) {
1421 Action &action = action_ptr_ref->wrap();
1424 if (slot_to_assign) {
1425 if (!action.
slots().contains(slot_to_assign)) {
1438 if (slot_to_unassign) {
1454 if (!slot_to_assign) {
1459 slot_handle_ref = slot_to_assign->
handle;
1470 char *slot_identifier)
1479 if (!action_ptr_ref) {
1486 Slot *slot = action_ptr_ref->wrap().slot_for_handle(slot_handle_to_assign);
1488 slot, animated_id, action_ptr_ref, slot_handle_ref, slot_identifier);
1503 Slot *slot_to_assign,
1535 return &adt->
action->wrap();
1541 if (!adt || !adt->
action) {
1543 return std::nullopt;
1550 return std::nullopt;
1553 return std::make_pair(&action, slot);
1561 ActionStrip *strip = MEM_new<ActionStrip>(__func__);
1578 return strip->wrap();
1583 return this->
frame_start == -std::numeric_limits<float>::infinity() &&
1584 this->
frame_end == std::numeric_limits<float>::infinity();
1603 "only the end frame can be at positive infinity");
1605 "only the start frame can be at negative infinity");
1667 if (channels->slot_handle == slot_handle) {
1685 const auto *const_channels = const_this->channelbag_for_slot(slot_handle);
1686 return const_cast<Channelbag *
>(const_channels);
1705 "Cannot add channelbag for already-registered slot");
1708 Channelbag &channels = MEM_new<ActionChannelbag>(__func__)->wrap();
1733 Channelbag &channelbag = (*dna_channelbag_ptr)->wrap();
1734 MEM_delete(&channelbag);
1740 if (channelbag_index < 0) {
1772 Channelbag &target_cbag = *MEM_new<animrig::Channelbag>(__func__, *source_cbag);
1794 return *existing_fcurve;
1825 this->restore_channel_group_invariants();
1839 const int add_fcurve_num = int(fcurve_descriptors.
size());
1840 const bool make_first_active = prev_fcurve_num == 0;
1843 struct CurvePathIndex {
1846 bool operator==(
const CurvePathIndex &o)
const
1849 return this->array_index == o.array_index && this->rna_path == o.rna_path;
1857 unique_curves.
reserve(prev_fcurve_num);
1859 CurvePathIndex path_index;
1860 path_index.rna_path =
fcurve->rna_path();
1862 unique_curves.
add(path_index);
1870 new_fcurves.
resize(add_fcurve_num);
1871 int curve_index = prev_fcurve_num;
1872 for (
int i = 0; i < add_fcurve_num; i++) {
1875 CurvePathIndex path_index;
1876 path_index.rna_path = desc.
rna_path;
1880 new_fcurves[i] =
nullptr;
1895 this->
fcurve_array, this->fcurve_array_num, curve_index, curve_index + 1, insert_index);
1914 if (make_first_active) {
1924 this->restore_channel_group_invariants();
1933 const int new_array_index,
1938 MEM_delete(new_fcurve->
bezt);
1939 new_fcurve->
bezt = MEM_dupalloc(old_fcurve.
bezt);
1940 MEM_delete(new_fcurve->
fpt);
1941 new_fcurve->
fpt = MEM_dupalloc(old_fcurve.
fpt);
1946 new_fcurve->rna_path_set(new_path);
1992 const int64_t fcurve_index = this->
fcurves().first_index_try(&fcurve_to_detach);
1993 if (fcurve_index < 0) {
2006 if (group_index != -1) {
2011 const int group_index = this->
channel_groups().first_index_try(group);
2012 this->channel_group_remove_raw(group_index);
2017 &this->fcurve_array_num,
2022 this->restore_channel_group_invariants();
2033 const int fcurve_index = this->
fcurves().first_index_try(&
fcurve);
2034 BLI_assert_msg(fcurve_index >= 0,
"FCurve not in this channel bag.");
2039 this->restore_channel_group_invariants();
2048 group->fcurve_range_start = 0;
2049 group->fcurve_range_length = 0;
2085 if (fcurve.
totvert != 1 || fcurve.
bezt ==
nullptr) {
2089 const float period = cycle_range[1] - cycle_range[0];
2090 if (period < 0.1f) {
2095 const float frame_offset = fcurve.
bezt[0].
vec[1][0] - cycle_range[0];
2096 const float fix =
floorf(frame_offset / period) * period;
2098 fcurve.
bezt[0].
vec[0][0] -= fix;
2099 fcurve.
bezt[0].
vec[1][0] -= fix;
2100 fcurve.
bezt[0].
vec[2][0] -= fix;
2109 fcurve.
bezt[1].
vec[0][0] += period;
2110 fcurve.
bezt[1].
vec[1][0] += period;
2111 fcurve.
bezt[1].
vec[2][0] += period;
2120 const std::optional<float2> cycle_range)
2124 FCurve *fcurve =
nullptr;
2130 if (channels !=
nullptr) {
2131 fcurve = channels->
fcurve_find(fcurve_descriptor);
2137 "FCurve %s[%d] for slot %s was not created due to either the Only Insert "
2138 "Available setting or Replace keyframing mode.\n",
2148 "FCurve %s[%d] for slot %s doesn't allow inserting keys.\n",
2155 if (cycle_range && (*cycle_range)[0] < (*cycle_range)[1]) {
2171 fcurve, time_value, settings, insert_key_flags);
2175 "Could not insert key into FCurve %s[%d] for slot %s.\n",
2179 return insert_vert_result;
2212 this->restore_channel_group_invariants();
2224 MEM_SAFE_DELETE(group);
2304 if (fcurve_array_index >= group->fcurve_range_start &&
2305 fcurve_array_index < (group->fcurve_range_start + group->fcurve_range_length))
2317 bActionGroup *new_group = MEM_new<bActionGroup>(__func__);
2321 int fcurve_index = 0;
2350 name[0] ==
'\0' ?
DATA_(
"Group") : name);
2371 const int group_index = this->
channel_groups().first_index_try(&group);
2372 if (group_index == -1) {
2388 this->channel_group_remove_raw(group_index);
2389 this->restore_channel_group_invariants();
2398 const int group_index = this->
channel_groups().first_index_try(&group);
2399 BLI_assert_msg(group_index >= 0,
"Group not in this channel bag.");
2410 this->restore_channel_group_invariants();
2419 this->restore_channel_group_invariants();
2422void Channelbag::channel_group_remove_raw(
const int group_index)
2430void Channelbag::restore_channel_group_invariants()
2434 int start_index = 0;
2436 group->fcurve_range_start = start_index;
2437 start_index += group->fcurve_range_length;
2451 for (FCurve *
fcurve : group->wrap().fcurves()) {
2491 switch (strip->type()) {
2518 switch (strip->type()) {
2525 if (!visited_channelbags.
add(bag)) {
2540 const_cast<const Action &
>(action), slot_handle);
2566 if (act ==
nullptr) {
2570 Action &action = act->wrap();
2584 FCurve *fcu = channelbag->fcurve_find(fcurve_descriptor);
2602 if (act ==
nullptr) {
2606 Action &action = act->wrap();
2620 const size_t quoted_name_size = data_name.
size() + 1;
2621 char *quoted_name =
static_cast<char *
>(alloca(quoted_name_size));
2629 rna_path.c_str(), collection_rna_path.
c_str(), quoted_name, quoted_name_size))
2633 if (quoted_name != data_name) {
2649 if (predicate(fcurve)) {
2650 found.append(&fcurve);
2662 for (
FCurve *fcurve : fcurves) {
2663 if (predicate(*fcurve)) {
2676 for (
FCurve &fcurve : fcurves) {
2677 if (predicate(fcurve)) {
2690 if (act ==
nullptr) {
2711 if (ptr ==
nullptr || ptr->
owner_id ==
nullptr) {
2720 Action &action = dna_action.wrap();
2765 const bool is_detached = bag->fcurve_detach(fcurve_to_detach);
2777 FCurve &fcurve_to_attach,
2778 std::optional<StringRefNull> group_name)
2783 printf(
"Cannot find slot handle %d on Action %s, unable to attach F-Curve %s[%d] to it!\n",
2786 fcurve_to_attach.rna_path().c_str(),
2797 bActionGroup &group = cbag.channel_group_ensure(*group_name);
2798 cbag.fcurve_assign_to_channel_group(fcurve_to_attach, group);
2809 std::optional<std::string> group_name;
2811 group_name = fcurve.
grp->
name;
2823 while (!channelbag_src.
fcurves().is_empty()) {
2828 std::optional<std::string> group_name;
2830 group_name = fcurve.
grp->
name;
2833 const bool is_detached = channelbag_src.
fcurve_detach(fcurve);
2852 const int fcurve_index = this->fcurves().first_index_try(&
fcurve);
2853 if (fcurve_index == -1) {
2866 this->channel_group_remove_raw(group_index);
2868 this->restore_channel_group_invariants();
2878 this->restore_channel_group_invariants();
2885 const int fcurve_index = this->fcurves().first_index_try(&
fcurve);
2886 if (fcurve_index == -1) {
2904 const int old_group_index = this->
channel_groups().first_index_try(old_group);
2905 this->channel_group_remove_raw(old_group_index);
2908 this->restore_channel_group_invariants();
2919 if (slot ==
nullptr) {
2924 if (users.
size() == 1) {
2954 const Action &action = dna_action.wrap();
2963 if (action.
layers().is_empty()) {
2973 if (
layer.strips().is_empty()) {
3016 if (!from_action.
layers().is_empty() && !from_action.
layer(0)->
strips().is_empty()) {
3028 channelbag->slot_handle = target_slot.
handle;
3038 for (
ID *user : source_slot.
users(bmain)) {
3039 const auto assign_other_action = [&](
ID & ,
3042 char *slot_identifier) ->
bool {
3045 if (action_ptr_ref != &from_action) {
3051 *user, &to_action, action_ptr_ref, slot_handle_ref, slot_identifier);
3052 BLI_assert_msg(assign_ok,
"Expecting slotted Actions to always be assignable");
3057 &target_slot, *user, action_ptr_ref, slot_handle_ref, slot_identifier);
Functions and classes to work with Actions.
Functionality to iterate an Action in various ways.
Functions for backward compatibility with the legacy Action API.
Functions to work with AnimData.
Functions to modify FCurves.
Blender kernel action and pose functionality.
#define FOREACH_MAIN_LISTBASE_ID_END
#define FOREACH_MAIN_LISTBASE_ID_BEGIN(_lb, _id)
#define FOREACH_MAIN_LISTBASE_END
#define FOREACH_MAIN_LISTBASE_BEGIN(_bmain, _lb)
#define STRNCPY_UTF8(dst, src)
#define CLOG_WARN(clg_ref,...)
#define ID_IS_EDITABLE(_id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
Read Blender memory allocation and freeing.
Internal C++ functions to deal with Actions, Slots, and their runtime data.
#define BLI_assert_unreachable()
#define UNUSED_VARS_NDEBUG(...)
#define BLI_assert_msg(a, msg)
#define MEM_realloc_uninitialized(vmemh, len)
void reserve(const int64_t n)
constexpr int64_t size() const
constexpr IndexRange index_range() const
constexpr bool is_empty() const
constexpr bool contains(const T &value) const
constexpr const char * c_str() const
int64_t remove_if(Predicate &&predicate)
void append(const T &value)
void resize(const int64_t new_size)
void slot_active_set(slot_handle_t slot_handle)
Slot & slot_add_for_id(const ID &animated_id)
float2 get_frame_range_of_slot(slot_handle_t slot_handle) const ATTR_WARN_UNUSED_RESULT
void layer_keystrip_ensure()
Span< const Slot * > slots() const
void slot_display_name_define(Slot &slot, StringRefNull new_display_name)
float2 get_frame_range() const ATTR_WARN_UNUSED_RESULT
bool is_cyclic() const ATTR_WARN_UNUSED_RESULT
int strip_keyframe_data_append(StripKeyframeData *strip_data)
void slot_identifier_propagate(Main &bmain, const Slot &slot)
const Layer * layer(int64_t index) const
void slot_identifier_set(Main &bmain, Slot &slot, StringRefNull new_identifier)
int64_t find_slot_index(const Slot &slot) const
Layer * get_layer_for_keyframing()
const Slot * slot(int64_t index) const
void slot_idtype_define(Slot &slot, ID_Type idtype)
void slot_move_to_index(Slot &slot, int to_slot_index)
bool has_keyframes(slot_handle_t action_slot_handle) const ATTR_WARN_UNUSED_RESULT
void slot_display_name_set(Main &bmain, Slot &slot, StringRefNull new_display_name)
void strip_keyframe_data_remove_if_unused(int index)
int64_t find_layer_index(const Layer &layer) const
Span< const Layer * > layers() const
Slot & slot_add_for_id_type(ID_Type idtype)
bool layer_remove(Layer &layer_to_remove)
Slot * slot_find_by_identifier(StringRefNull slot_identifier)
float2 get_frame_range_of_keys(bool include_modifiers) const ATTR_WARN_UNUSED_RESULT
void slot_identifier_define(Slot &slot, StringRefNull new_identifier)
bool slot_remove(Slot &slot_to_remove)
Slot * slot_for_handle(slot_handle_t handle)
bool has_single_frame() const ATTR_WARN_UNUSED_RESULT
Span< const StripKeyframeData * > strip_keyframe_data() const
bool is_slot_animated(slot_handle_t slot_handle) const
void slot_setup_for_id(Slot &slot, const ID &animated_id)
Layer & layer_add(std::optional< StringRefNull > name)
Span< FCurve * > fcurves()
bool channel_group_remove(bActionGroup &group)
const FCurve * fcurve(int64_t index) const
void fcurve_remove_by_index(int64_t fcurve_index)
bool fcurve_detach(FCurve &fcurve_to_detach)
void fcurve_move_to_index(FCurve &fcurve, int to_fcurve_index)
bool fcurve_assign_to_channel_group(FCurve &fcurve, bActionGroup &to_group)
FCurve & fcurve_clone(const FCurve &old_fcurve, StringRefNull new_path, int new_array_index, StringRef new_group_name)
Span< const bActionGroup * > channel_groups() const
bActionGroup & channel_group_create(StringRefNull name)
bool fcurve_remove(FCurve &fcurve_to_remove)
const bActionGroup * channel_group(int64_t index) const
FCurve & fcurve_create(Main *bmain, const FCurveDescriptor &fcurve_descriptor)
const bActionGroup * channel_group_find(StringRef name) const
Span< const FCurve * > fcurves() const
Vector< FCurve * > fcurve_create_many(Main *bmain, Span< FCurveDescriptor > fcurve_descriptors)
void fcurve_detach_by_index(int64_t fcurve_index)
int channel_group_find_index(const bActionGroup *group) const
FCurve & fcurve_ensure(Main *bmain, const FCurveDescriptor &fcurve_descriptor)
FCurve * fcurve_create_unique(Main *bmain, const FCurveDescriptor &fcurve_descriptor)
const FCurve * fcurve_find(const FCurveDescriptor &fcurve_descriptor) const
bool fcurve_ungroup(FCurve &fcurve)
void fcurve_append(FCurve &fcurve)
void channel_group_move_to_index(bActionGroup &group, int to_group_index)
int channel_group_containing_index(int fcurve_array_index)
bActionGroup & channel_group_ensure(StringRefNull name)
bool strip_remove(Action &owning_action, Strip &strip)
Span< const Strip * > strips() const
Layer * duplicate_with_shallow_strip_copies(StringRefNull allocation_name) const
const Strip * strip(int64_t index) const
Strip & strip_add(Action &owning_action, Strip::Type strip_type)
int64_t find_strip_index(const Strip &strip) const
static void users_invalidate(Main &bmain)
Vector< ID * > runtime_users()
StringRef identifier_prefix() const
void users_add(ID &animated_id)
void set_active(bool active)
void identifier_ensure_prefix()
bool is_suitable_for(const ID &animated_id) const
std::string idtype_string() const
static constexpr int identifier_length_min
void set_expanded(bool expanded)
static constexpr int identifier_length_max
void set_selected(bool selected)
Span< ID * > users(Main &bmain) const
static constexpr slot_handle_t unassigned
StringRefNull identifier_without_prefix() const
void users_remove(ID &animated_id)
const Channelbag * channelbag_for_slot(const Slot &slot) const
int64_t find_channelbag_index(const Channelbag &channelbag) const
void slot_data_remove(slot_handle_t slot_handle)
void slot_data_duplicate(slot_handle_t source_slot_handle, slot_handle_t target_slot_handle)
static constexpr Strip::Type TYPE
Channelbag & channelbag_for_slot_add(const Slot &slot)
Span< const Channelbag * > channelbags() const
SingleKeyingResult keyframe_insert(Main *bmain, const Slot &slot, const FCurveDescriptor &fcurve_descriptor, float2 time_value, const KeyframeSettings &settings, eInsertKeyFlags insert_key_flags=INSERTKEY_NOFLAGS, std::optional< float2 > cycle_range=std::nullopt)
Channelbag & channelbag_for_slot_ensure(const Slot &slot)
bool channelbag_remove(Channelbag &channelbag_to_remove)
const Channelbag * channelbag(int64_t index) const
StripKeyframeData()=default
bool contains_frame(float frame_time) const
void resize(float frame_start, float frame_end)
static Strip & create(Action &owning_action, const Strip::Type type)
bool is_last_frame(float frame_time) const
const T & data(const Action &owning_action) const
constexpr bool is_empty() const
constexpr int64_t size() const
constexpr StringRef substr(int64_t start, int64_t size) const
constexpr const char * data() const
float length(VecOp< float, D >) RET
void rebuild_slot_user_cache(Main &bmain)
Vector< const FCurve * > fcurves_all(const bAction *action)
void action_fcurve_attach(Action &action, slot_handle_t action_slot, FCurve &fcurve_to_attach, std::optional< StringRefNull > group_name)
slot_handle_t first_slot_handle(const bAction &dna_action)
void foreach_fcurve_in_action_slot(Action &action, slot_handle_t handle, FunctionRef< void(FCurve &fcurve)> callback)
bool action_fcurve_remove(Action &action, FCurve &fcu)
static void shrink_array_and_swap_remove(T **array, int *num, const int index)
void assert_baklava_phase_1_invariants(const Action &action)
static void strip_ptr_destructor(ActionStrip **dna_strip_ptr)
bool fcurve_matches_collection_path(const FCurve &fcurve, StringRefNull collection_rna_path, StringRefNull data_name)
decltype(blender::ActionSlot::handle) slot_handle_t
static bool is_id_using_action_slot(const ID &animated_id, const Action &action, const slot_handle_t slot_handle)
static animrig::Layer & ActionLayer_alloc()
void channelbag_fcurves_move(Channelbag &channelbag_dst, Channelbag &channelbag_src)
static void slot_ptr_destructor(ActionSlot **dna_slot_ptr)
static void array_shift_range(T *array, const int num, const int range_start, const int range_end, const int to)
Vector< FCurve * > fcurves_in_action_slot_filtered(bAction *act, slot_handle_t slot_handle, FunctionRef< bool(const FCurve &fcurve)> predicate)
Slot * assign_action_ensure_slot_for_keying(Action &action, ID &animated_id)
bool foreach_action_slot_use(const ID &animated_id, FunctionRef< bool(Action &action, slot_handle_t slot_handle)> callback)
FCurve * action_fcurve_ensure_ex(Main *bmain, bAction *act, PointerRNA *ptr, const FCurveDescriptor &fcurve_descriptor)
FCurve * create_fcurve_for_channel(const FCurveDescriptor &fcurve_descriptor)
void action_fcurve_move(Action &action_dst, slot_handle_t action_slot_dst, Action &action_src, FCurve &fcurve)
void update_autoflags_fcurve_direct(FCurve *fcu, PropertyType prop_type)
Action & action_add(Main &bmain, StringRefNull name)
const animrig::Channelbag * channelbag_for_action_slot(const Action &action, slot_handle_t slot_handle)
ActionSlotAssignmentResult assign_tmpaction_and_slot_handle(bAction *action, slot_handle_t slot_handle, OwnedAnimData owned_adt)
static void layer_ptr_destructor(ActionLayer **dna_layer_ptr)
static void cyclic_keying_ensure_modifier(FCurve &fcurve)
Slot & duplicate_slot(Action &action, const Slot &slot)
static void grow_array_and_append(T **array, int *num, T item)
Vector< FCurve * > fcurves_in_span_filtered(Span< FCurve * > fcurves, FunctionRef< bool(const FCurve &fcurve)> predicate)
bool generic_assign_action(ID &animated_id, bAction *action_to_assign, bAction *&action_ptr_ref, slot_handle_t &slot_handle_ref, char *slot_identifier)
static void clone_slot(const Slot &from, Slot &to)
static float2 get_frame_range_of_fcurves(Span< const FCurve * > fcurves, bool include_modifiers)
static void cyclic_keying_ensure_cycle_range_exists(FCurve &fcurve, const float2 cycle_range)
ID * action_slot_get_id_best_guess(Main &bmain, Slot &slot, ID *primary_id)
ActionSlotAssignmentResult generic_assign_action_slot(Slot *slot_to_assign, ID &animated_id, bAction *&action_ptr_ref, slot_handle_t &slot_handle_ref, char *slot_identifier)
ActionSlotAssignmentResult assign_action_and_slot(Action *action, Slot *slot_to_assign, ID &animated_id)
Vector< FCurve * > fcurves_in_listbase_filtered(ListBaseT< FCurve > fcurves, FunctionRef< bool(const FCurve &fcurve)> predicate)
Vector< animrig::Channelbag * > channelbags_for_action_slot(Action &action, slot_handle_t slot_handle)
Channelbag & action_channelbag_ensure(bAction &dna_action, ID &animated_id)
SingleKeyingResult insert_vert_fcurve(FCurve *fcu, const float2 position, const KeyframeSettings &settings, eInsertKeyFlags flag)
Main Key-framing API call.
Span< FCurve * > fcurves_for_action_slot(Action &action, slot_handle_t slot_handle)
ID * action_slot_get_id_for_keying(Main &bmain, Action &action, slot_handle_t slot_handle, ID *primary_id)
static void shrink_array_and_remove(T **array, int *num, const int index)
static void grow_array_and_insert(T **array, int *num, const int index, T item)
const FCurve * fcurve_find(Span< const FCurve * > fcurves, const FCurveDescriptor &fcurve_descriptor)
Action * get_action(ID &animated_id)
bool assign_tmpaction(bAction *action, OwnedAnimData owned_adt)
static void fcurve_ptr_noop_destructor(FCurve **)
static void fcurve_ptr_destructor(FCurve **fcurve_ptr)
bool unassign_action(ID &animated_id)
bool action_fcurve_detach(Action &action, FCurve &fcurve_to_detach)
bool assign_action(bAction *action, ID &animated_id)
FCurve * fcurve_find_in_assigned_slot(AnimData &adt, const FCurveDescriptor &fcurve_descriptor)
std::optional< std::pair< Action *, Slot * > > get_action_slot_pair(ID &animated_id)
static void grow_array(T **array, int *num, const int add_num)
FCurve & action_fcurve_ensure(Main *bmain, bAction &action, ID &animated_id, const FCurveDescriptor &fcurve_descriptor)
bool key_insertion_may_create_fcurve(eInsertKeyFlags insert_key_flags)
FCurve * fcurve_find_in_action(bAction *act, const FCurveDescriptor &fcurve_descriptor)
static void shrink_array(T **array, int *num, const int shrink_num)
static void channelbag_ptr_destructor(ActionChannelbag **dna_channelbag_ptr)
ActionSlotAssignmentResult generic_assign_action_slot_handle(slot_handle_t slot_handle_to_assign, ID &animated_id, bAction *&action_ptr_ref, slot_handle_t &slot_handle_ref, char *slot_identifier)
ActionSlotAssignmentResult assign_action_slot(Slot *slot_to_assign, ID &animated_id)
bool foreach_action_slot_use_with_references(ID &animated_id, FunctionRef< bool(ID &animated_id, bAction *&action_ptr_ref, slot_handle_t &slot_handle_ref, char *last_slot_identifier)> callback)
void move_slot(Main &bmain, Slot &slot, Action &from_action, Action &to_action)
Slot * generic_slot_for_autoassign(const ID &animated_id, Action &action, StringRefNull last_slot_identifier)
static void slot_identifier_ensure_unique(Action &action, Slot &slot)
@ FCURVE_NOT_KEYFRAMEABLE
ActionSlotAssignmentResult
FCurve * fcurve_find_in_action_slot(bAction *act, slot_handle_t slot_handle, const FCurveDescriptor &fcurve_descriptor)
bool operator==(const Error &left, const Error &right)
void remove_index(T **items, int *items_num, int *active_index, const int index, void(*destruct_item)(T *))
void clear(T **items, int *items_num, int *active_index, void(*destruct_item)(T *))
MINLINE float min_ff(float a, float b)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
bool BKE_animdata_action_editable(const AnimData *adt)
unsigned __int64 uint64_t
bool BKE_fcurve_calc_range(const FCurve *fcu, float *r_min, float *r_max, bool selected_keys_only)
bool bool BLI_str_quoted_substr(const char *__restrict str, const char *__restrict prefix, char *result, size_t result_maxncpy)
bool BKE_fcurve_is_keyframable(const FCurve &fcu)
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
bAction * BKE_action_add(Main *bmain, const char name[])
FModifier * add_fmodifier(ListBaseT< FModifier > *modifiers, int type, FCurve *owner_fcu)
bool id_can_have_animdata(const ID *id)
AnimData * BKE_animdata_ensure_id(ID *id)
AnimData * BKE_animdata_from_id(const ID *id)
size_t void BLI_uniquename_cb(FunctionRef< bool(StringRefNull)> unique_check, const char *defname, char delim, char *name, size_t name_maxncpy) ATTR_NONNULL(2
VecBase< float, 2 > float2
void DEG_id_tag_update(ID *id, unsigned int flags)
void BKE_report(ReportList *reports, eReportType type, const char *message)
FCurve * BKE_fcurve_copy(const FCurve *fcu)
constexpr size_t ARRAY_SIZE(const T(&arg)[N]) noexcept
ATTR_WARN_UNUSED_RESULT const size_t num
void BKE_fcurve_free(FCurve *fcu)
void _DNA_internal_memzero(void *dst, size_t size)
MINLINE float max_ff(float a, float b)
@ ID_RECALC_ANIMATION_NO_FLUSH
ID_Type GS(const char *name)
void DEG_relations_tag_update(Main *bmain)
void uninitialized_relocate_n(T *src, int64_t n, T *dst)
constexpr uint64_t get_default_hash(const T &v, const Args &...args)
MINLINE int compare_ff(float a, float b, float max_diff)
void uninitialized_move_n(T *src, int64_t n, T *dst)
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
struct FCurve ** fcurve_array
struct bActionGroup ** group_array
struct ActionStrip ** strip_array
animrig::SlotRuntime * runtime
struct ActionChannelbag ** channelbag_array
char tmp_last_slot_identifier[258]
char last_slot_identifier[258]
ListBaseT< FModifier > modifiers
eFMod_Cycling_Modes after_mode
eFMod_Cycling_Modes before_mode
bool is_action_slot_to_id_map_dirty
std::optional< StringRefNull > channel_group
std::optional< PropertyType > prop_type
struct ActionChannelbag * channelbag
struct ActionSlot ** slot_array
int strip_keyframe_data_array_num
struct ActionStripKeyframeData ** strip_keyframe_data_array
ListBaseT< bActionGroup > groups
struct ActionLayer ** layer_array