11#define DNA_DEPRECATED_ALLOW
34#include "RNA_prototypes.hh"
51 const bool has_animato_data = !(action.
curves.is_empty() && action.
groups.is_empty());
53 return has_layered_data || !has_animato_data;
76 Action &action = dna_action.wrap();
101 const int fcu_count = action.
curves.count();
102 const int group_count = action.
groups.count();
106 "Action versioning - groups");
109 int fcurve_index = 0;
110 for (
const auto [group_index, group] : action.
groups.enumerate()) {
114 group.fcurve_range_start = fcurve_index;
116 for (
FCurve &fcu : group.channels) {
117 if (fcu.
grp != &group) {
123 group.fcurve_range_length = fcurve_index - group.fcurve_range_start;
136 action.
curves = {
nullptr,
nullptr};
137 action.
groups = {
nullptr,
nullptr};
150 auto flag_adt = [](
ID &animated_id,
179 auto version_slot_assignment = [&](
ID &animated_id,
183 char *last_used_slot_identifier) {
185 Action &action = dna_action->wrap();
198 if (current_slot_ptr) {
210 *
reinterpret_cast<short *
>(last_used_slot_identifier) =
GS(animated_id.
name);
218 animated_id, action, last_used_slot_identifier);
219 if (!slot_to_assign) {
225 "\"%s\" is using Action \"%s\", which does not have a slot with identifier "
226 "\"%s\" or \"%s\". Manually assign the right action slot to \"%s\".\n",
229 last_used_slot_identifier,
231 animated_id.
name + 2);
236 &action.
id, RNA_ActionSlot, slot_to_assign);
238 &action_slot_owner_ptr, &action_slot_prop, slot_to_assign_ptr, reports);
283 ListBaseT<FCurve> ungrouped = {
nullptr,
nullptr};
294 act->
curves.clear_no_delete();
311 ListBaseT<FCurve> *fcurves,
314 for (
FCurve &fcu : *fcurves) {
315 if (!func(
id, &fcu)) {
324 ListBaseT<NlaStrip> *strips,
371 if (adt !=
nullptr) {
373 const auto wrapper = [&func](
ID *
id,
FCurve *fcurve) {
384 const auto wrapper = [&func](
ID *
id,
FCurve *fcurve) {
Functions and classes to work with Actions.
Functionality to iterate an Action in various ways.
Functions for backward compatibility with the legacy Action API.
Versioning of old animation data. Most animation versioning code lives in the versioning_xxx....
#define FOREACH_MAIN_ID_END
#define FOREACH_MAIN_ID_BEGIN(_bmain, _id)
external readfile function prototypes.
#define DNA_DEFAULT_ACTION_LAST_SLOT_HANDLE
void append(const T &value)
void slot_identifier_define(Slot &slot, StringRefNull new_identifier)
Layer & layer_add(std::optional< StringRefNull > name)
std::string idtype_string() const
static constexpr int identifier_length_max
const T & data(const Action &owning_action) const
constexpr const char * DEFAULT_LEGACY_LAYER_NAME
constexpr const char * DEFAULT_LEGACY_SLOT_NAME
void action_groups_reconstruct(bAction *act)
static bool adt_apply_all_fcurves_cb(ID *id, AnimData *adt, const IDFCurveCallback func)
void fcurves_main_cb(Main *bmain, const FunctionRef< void(ID *, FCurve *)> func)
static bool fcurves_listbase_apply_cb(ID *id, ListBaseT< FCurve > *fcurves, const IDFCurveCallback func)
void convert_legacy_animato_action(bAction &dna_action)
void tag_action_user_for_slotted_actions_conversion(ID &animated_id)
void fcurves_id_cb(ID *id, const FunctionRef< void(ID *, FCurve *)> func)
bool action_is_layered(const bAction &dna_action)
static bool nlastrips_apply_all_curves_cb(ID *id, ListBaseT< NlaStrip > *strips, const IDFCurveCallback func)
void convert_legacy_action_assignments(Main &bmain, ReportList *reports)
void convert_legacy_animato_actions(Main &bmain)
Vector< FCurve * > fcurves_for_legacy_action(bAction *action)
void tag_action_users_for_slotted_actions_conversion(Main &bmain)
FunctionRef< bool(ID *, FCurve *)> IDFCurveCallback
decltype(blender::ActionSlot::handle) slot_handle_t
bool foreach_action_slot_use_with_rna(ID &animated_id, FunctionRef< bool(ID &animated_id, bAction *action, PointerRNA &action_slot_owner_ptr, PropertyRNA &action_slot_prop, char *last_slot_identifier)> callback)
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)
Slot * generic_slot_for_autoassign(const ID &animated_id, Action &action, StringRefNull last_slot_identifier)
bNodeTree * node_tree_from_id(ID *id)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value, ReportList *reports)
void RNA_property_update_main(Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
void BKE_animdata_main_cb(struct Main *bmain, FunctionRef< void(ID *, AnimData *)> func)
void void void BLI_movelisttolist(ListBase *dst, ListBase *src) ATTR_NONNULL(1
AnimData * BKE_animdata_from_id(const ID *id)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
ID_Type GS(const char *name)
ID_Readfile_Data::Tags BLO_readfile_id_runtime_tags(const ID &id)
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
ListBaseT< FCurve > drivers
ListBaseT< NlaTrack > nla_tracks
struct blender::ID_Readfile_Data::Tags tags
bke::id::ID_Runtime * runtime
ListBaseT< bAction > actions
ListBaseT< NlaStrip > strips
ListBaseT< FCurve > channels
struct ActionChannelbag * channelbag
ListBaseT< FCurve > curves
ListBaseT< bActionGroup > groups
ID_Readfile_Data * readfile_data