37 "The strip values replace the accumulated results by amount specified by influence"},
42 "The strip values are combined with accumulated results by appropriately using addition, "
43 "multiplication, or quaternion math, based on channel type"},
49 "Weighted result of strip is added to the accumulated results"},
54 "Weighted result of strip is removed from the accumulated results"},
59 "Weighted result of strip is multiplied with the accumulated results"},
60 {0,
nullptr, 0,
nullptr,
nullptr},
69 "Hold the first frame if no previous strips in track, and always hold last frame"},
71 {0,
nullptr, 0,
nullptr,
nullptr},
78# include <fmt/format.h>
102static void rna_NlaStrip_name_set(
PointerRNA *ptr,
const char *value)
116static std::optional<std::string> rna_NlaStrip_path(
const PointerRNA *ptr)
126 for (nlt = adt->nla_tracks.first(); nlt; nlt = nlt->next) {
127 for (nls = nlt->strips.first(); nls; nls = nls->next) {
130 char name_esc_nlt[
sizeof(nlt->name) * 2];
131 char name_esc_strip[
sizeof(strip->name) * 2];
134 BLI_str_escape(name_esc_strip, strip->name,
sizeof(name_esc_strip));
136 "animation_data.nla_tracks[\"{}\"].strips[\"{}\"]", name_esc_nlt, name_esc_strip);
148 ID *
id = ptr->owner_id;
157 rna_NlaStrip_update(bmain, scene, ptr);
178 rna_NlaStrip_update(bmain, scene, ptr);
181static void rna_NlaStrip_start_frame_set(
PointerRNA *ptr,
float value)
194 CLAMP(value, limit_prev, limit_next);
208 data->end = limit_next;
219static void rna_NlaStrip_frame_start_ui_set(
PointerRNA *ptr,
float value)
235 const float striplen =
data->end -
data->start;
249 CLAMP(value, limit_prev, limit_next);
265static void rna_NlaStrip_end_frame_set(
PointerRNA *ptr,
float value)
271 CLAMP(value, limit_prev, limit_next);
285 data->start = limit_prev;
296static void rna_NlaStrip_frame_end_ui_set(
PointerRNA *ptr,
float value)
304 const float old_strip_end =
data->end;
315 CLAMP(value, limit_prev, limit_next);
320 data->next->start = value;
335 float action_length_delta = (old_strip_end -
data->end) /
data->scale;
341 if (
IS_EQF(action_length_delta, actlen)) {
342 data->actend =
data->actstart + 1.0f;
345 else if (action_length_delta < actlen) {
347 data->actend =
data->actend - action_length_delta;
354 data->repeat -= (action_length_delta / actlen);
359static void rna_NlaStrip_scale_set(
PointerRNA *ptr,
float value)
366 CLAMP(value, 0.0001f, 1000.0f);
373static void rna_NlaStrip_repeat_set(
PointerRNA *ptr,
float value)
380 CLAMP(value, 0.01f, 1000.0f);
381 data->repeat = value;
387static void rna_NlaStrip_blend_in_set(
PointerRNA *ptr,
float value)
396 data->blendin = value;
399static void rna_NlaStrip_blend_out_set(
PointerRNA *ptr,
float value)
409 if ((
len - value) <
data->blendin) {
413 data->blendout = value;
416static void rna_NlaStrip_use_auto_blend_set(
PointerRNA *ptr,
bool value)
439 data->blendin = 0.0f;
440 data->blendout = 0.0f;
450 ID &animated_id = *ptr->owner_id;
462 "Could not assign action %s to NLA strip %s",
468static int rna_NlaStrip_action_editable(
const PointerRNA *ptr,
const char ** )
478 if ((adt->flag &
ADT_NLA_EDIT_ON) || (adt->actstrip) || (adt->tmpact)) {
493static void rna_NlaStrip_action_slot_handle_set(
PointerRNA *ptr,
497 rna_generic_action_slot_handle_set(new_slot_handle,
500 strip->action_slot_handle,
501 strip->last_slot_identifier);
509static void rna_NlaStrip_action_slot_handle_override_diff(
512 const NlaStrip *strip_a =
static_cast<NlaStrip *
>(rnadiff_ctx.prop_a->ptr->data);
513 const NlaStrip *strip_b =
static_cast<NlaStrip *
>(rnadiff_ctx.prop_b->ptr->data);
515 rna_generic_action_slot_handle_override_diff(bmain, rnadiff_ctx, strip_a->act, strip_b->act);
521 return rna_generic_action_slot_get(strip->act, strip->action_slot_handle);
527 rna_generic_action_slot_set(value,
530 strip->action_slot_handle,
531 strip->last_slot_identifier,
539 rna_iterator_generic_action_suitable_slots_begin(iter, ptr, strip->act);
542static void rna_NlaStrip_action_start_frame_set(
PointerRNA *ptr,
float value)
548 data->actstart = value;
555static void rna_NlaStrip_action_end_frame_set(
PointerRNA *ptr,
float value)
561 data->actend = value;
567static void rna_NlaStrip_animated_influence_set(
PointerRNA *ptr,
bool value)
581static void rna_NlaStrip_animated_time_set(
PointerRNA *ptr,
bool value)
597 const char *data_path,
600 if (data_path[0] ==
'\0') {
621 if (strip ==
nullptr) {
626 strip->end += (start - strip->start);
627 strip->start = start;
633 "Unable to add strip (the track does not have any space to accommodate this new strip)");
650 while ((nlt = nlt->prev) !=
nullptr) {
653 adt.nla_tracks.first_ = nlt_p;
658 while ((nlt = nlt->next) !=
nullptr) {
661 adt.nla_tracks.last_ = nlt_p;
675static void rna_NlaStrip_remove(
681 reports,
RPT_ERROR,
"NLA strip '%s' not found in track '%s'", strip->name, track->name);
686 strip_ptr->invalidate();
694static std::optional<std::string> rna_NlaTrack_path(
const PointerRNA *ptr)
703 char name_esc[
sizeof(nlt->name) * 2];
705 return fmt::format(
"animation_data.nla_tracks[\"{}\"]", name_esc);
711static void rna_NlaTrack_solo_set(
PointerRNA *ptr,
bool value)
717 if (
data ==
nullptr) {
722 for (nt =
data; nt; nt = nt->next) {
725 for (nt =
data; nt; nt = nt->prev) {
767 "Find an F-Curve. Note that this function performs a linear scan "
768 "of all F-Curves in the NLA strip.");
770 parm =
RNA_def_string(func,
"data_path",
nullptr, 0,
"Data Path",
"F-Curve data path");
775 func,
"fcurve",
"FCurve",
"",
"The found F-Curve, or None if it doesn't exist");
791 "NLA Strip 'transitions' between adjacent strips"},
792 {
NLASTRIP_TYPE_META,
"META", 0,
"Meta",
"NLA Strip acts as a container for adjacent strips"},
797 "NLA Strip representing a sound event for speakers"},
798 {0,
nullptr, 0,
nullptr,
nullptr},
830 prop,
"Extrapolation",
"Action to take for gaps past the strip extents");
837 prop,
"Blending",
"Method used for combining strip's result with accumulated result");
867 "Start Frame (raw value)",
868 "Same as frame_start, except that any value can be set, including ones "
869 "that create an invalid state");
876 "End Frame (raw value)",
877 "Same as frame_end, except that any value can be set, including ones "
878 "that create an invalid state");
888 "Start Frame (manipulated from UI)",
889 "Start frame of the NLA strip. Note: changing this value also updates the value of "
890 "the strip's end frame. If only the start frame should be changed, see the \"frame_start\" "
891 "property instead.");
903 "End Frame (manipulated from UI)",
904 "End frame of the NLA strip. Note: changing this value also updates the value of "
905 "the strip's repeats or its action's end frame. If only the end frame should be "
906 "changed, see the \"frame_end\" property instead.");
918 prop,
"Blend In",
"Number of frames at start of strip to fade in influence");
932 "Number of frames for Blending In/Out is automatically determined from "
933 "overlapping strips");
940 prop,
nullptr,
"rna_NlaStrip_action_set",
nullptr,
"rna_Action_id_poll");
954 "Action Slot Handle",
955 "A number that identifies which sub-set of the Action is considered "
956 "to be for this NLA strip");
959 prop,
"rna_NlaStrip_action_slot_handle_override_diff",
nullptr,
nullptr);
966 "Last Action Slot Identifier",
967 "The identifier of the most recently assigned action slot. The slot identifies which "
968 "sub-set of the Action is considered to be for this strip, and its identifier is used to "
969 "find the right slot when assigning an Action.");
978 "The slot identifies which sub-set of the Action is considered to be for this "
979 "strip, and its name is used to find the right slot when assigning another Action");
981 prop,
"rna_NlaStrip_action_slot_get",
"rna_NlaStrip_action_slot_set",
nullptr,
nullptr);
997 "rna_iterator_nlastrip_action_suitable_slots_begin",
998 "rna_iterator_array_next",
999 "rna_iterator_array_end",
1000 "rna_iterator_array_dereference_get",
1006 prop,
"Action Slots",
"The list of action slots suitable for this NLA strip");
1051 prop,
"F-Curves",
"F-Curves for controlling the strip's influence and timing");
1058 prop,
"Modifiers",
"Modifiers affecting all the F-Curves in the referenced Action");
1066 "NLA Strips that this strip acts as a container for (if it is of type Meta)");
1072 prop,
"Influence",
"Amount the strip contributes to the current result");
1093 "Animated Influence",
1094 "Influence setting is controlled by an F-Curve rather than automatically determined");
1102 "Animated Strip Time",
1103 "Strip time is controlled by an F-Curve rather than automatically determined");
1109 prop,
"Cyclic Strip Time",
"Cycle the animated time within the action start and end");
1136 "NLA Strip is played back in reverse order (only when timing is "
1137 "automatically determined)");
1143 "Sync Action Length",
1144 "Update range of frames referenced from action "
1145 "after tweaking strip and its keyframes");
1166 parm =
RNA_def_string(func,
"name",
"NlaStrip", 0,
"",
"Name for the NLA Strip");
1174 "Start frame for this strip",
1178 parm =
RNA_def_pointer(func,
"action",
"Action",
"",
"Action to assign to this strip");
1181 parm =
RNA_def_pointer(func,
"strip",
"NlaStrip",
"",
"New NLA Strip");
1189 parm =
RNA_def_pointer(func,
"strip",
"NlaStrip",
"",
"NLA Strip to remove");
1201 srna,
"NLA Track",
"An animation layer containing Actions referenced as NLA strips");
1218 "In a local override data, whether this NLA track comes from the linked "
1219 "reference data, or is local to the override");
1245 "NLA Track is evaluated itself (i.e. active Action and all other NLA Tracks in the "
1246 "same AnimData block are disabled)");
Functions and classes to work with Actions.
#define NLASTRIP_MIN_LEN_THRESH
#define STRNCPY_UTF8(dst, src)
#define BLT_I18NCONTEXT_ID_ACTION
Object is a sort of wrapper for general info.
#define RNA_ENUM_ITEM_SEPR
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
void unassign_action(NlaStrip &strip, ID &animated_id)
bool assign_action(NlaStrip &strip, Action &action, ID &animated_id)
decltype(blender::ActionSlot::handle) slot_handle_t
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
static void rna_def_strip_fcurves(BlenderRNA *brna, PropertyRNA *cprop)
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
static void rna_def_nlastrip(BlenderRNA *brna)
@ NLATRACK_OVERRIDELIBRARY_LOCAL
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
char * STRNCPY(char(&dst)[N], const char *src)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_override_funcs(PropertyRNA *prop, const char *diff, const char *store, const char *apply)
void BKE_nlastrip_recalculate_blend(NlaStrip *strip)
static void rna_api_nlatrack_strips(BlenderRNA *brna, PropertyRNA *cprop)
void BKE_nlameta_flush_transforms(NlaStrip *mstrip)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
@ NLASTRIP_FLAG_USR_INFLUENCE
@ NLASTRIP_FLAG_USR_TIME_CYCLIC
@ NLASTRIP_FLAG_TWEAKUSER
@ NLASTRIP_FLAG_SYNC_LENGTH
@ NLASTRIP_FLAG_AUTO_BLENDS
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
@ NLASTRIP_EXTEND_NOTHING
@ NLASTRIP_EXTEND_HOLD_FORWARD
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void RNA_define_lib_overridable(const bool make_overridable)
float BKE_nla_clip_length_get_nonzero(const NlaStrip *strip)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void BKE_nlastrip_validate_name(AnimData *adt, NlaStrip *strip)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void BKE_nlastrip_validate_fcurves(NlaStrip *strip)
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
@ PROPOVERRIDE_NO_COMPARISON
void RNA_def_property_float_default(PropertyRNA *prop, float value)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
AnimData * BKE_animdata_from_id(const ID *id)
void ANIM_id_update(Main *bmain, ID *id)
NlaStrip * BKE_nlastrip_new(bAction *act, ID &animated_id)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
const EnumPropertyItem rna_enum_nla_mode_extend_items[]
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void DEG_id_tag_update_ex(Main *bmain, ID *id, unsigned int flags)
void BKE_nla_validate_state(AnimData *adt)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void BKE_report(ReportList *reports, eReportType type, const char *message)
BMesh const char void * data
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
@ NLASTRIP_TYPE_TRANSITION
char char size_t BLI_str_escape(char *__restrict dst, StringRef src, size_t dst_maxncpy) ATTR_NONNULL(1)
float BKE_nlastrip_compute_frame_to_next_strip(NlaStrip *strip)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier_c_str, const char *call)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
float BKE_nlastrip_compute_frame_from_previous_strip(NlaStrip *strip)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_function_flag(FunctionRNA *func, FunctionFlag flag)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_nlastrip_recalculate_bounds(NlaStrip *strip)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
bool BKE_nlastrips_add_strip(ListBaseT< NlaStrip > *strips, NlaStrip *strip)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
const EnumPropertyItem rna_enum_nla_mode_blend_items[]
void DEG_relations_tag_update(Main *bmain)
void RNA_def_nla(BlenderRNA *brna)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
FCurve * BKE_fcurve_find(ListBaseT< FCurve > *list, const char rna_path[], int array_index)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop, const bool allow_replace)
void BKE_nlastrip_remove_and_free(ListBaseT< NlaStrip > *strips, NlaStrip *strip, const bool do_id_user)
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
static void rna_def_nlatrack(BlenderRNA *brna)
void BKE_nlastrip_free(NlaStrip *strip, bool do_id_user)