Blender V4.3
rna_nla.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#include <cstdlib>
10
11#include "DNA_action_types.h"
12#include "DNA_anim_types.h"
13#include "DNA_scene_types.h"
14
15#ifdef WITH_ANIM_BAKLAVA
16# include "ANIM_action.hh"
17# include "ANIM_nla.hh"
18#endif
19
20#include "BLI_utildefines.h"
21
22#include "MEM_guardedalloc.h"
23
24#include "RNA_access.hh"
25#include "RNA_define.hh"
26#include "RNA_enum_types.hh"
27
28#include "rna_action_tools.hh"
29#include "rna_internal.hh"
30
31#include "WM_api.hh"
32#include "WM_types.hh"
33
34/* Enum defines exported for `rna_animation.cc`. */
35
38 "REPLACE",
39 0,
40 "Replace",
41 "The strip values replace the accumulated results by amount specified by influence"},
43 "COMBINE",
44 0,
45 "Combine",
46 "The strip values are combined with accumulated results by appropriately using addition, "
47 "multiplication, or quaternion math, based on channel type"},
50 "ADD",
51 0,
52 "Add",
53 "Weighted result of strip is added to the accumulated results"},
55 "SUBTRACT",
56 0,
57 "Subtract",
58 "Weighted result of strip is removed from the accumulated results"},
60 "MULTIPLY",
61 0,
62 "Multiply",
63 "Weighted result of strip is multiplied with the accumulated results"},
64 {0, nullptr, 0, nullptr, nullptr},
65};
66
68 {NLASTRIP_EXTEND_NOTHING, "NOTHING", 0, "Nothing", "Strip has no influence past its extents"},
70 "HOLD",
71 0,
72 "Hold",
73 "Hold the first frame if no previous strips in track, and always hold last frame"},
74 {NLASTRIP_EXTEND_HOLD_FORWARD, "HOLD_FORWARD", 0, "Hold Forward", "Only hold last frame"},
75 {0, nullptr, 0, nullptr, nullptr},
76};
77
78#ifdef RNA_RUNTIME
79
80# include <fmt/format.h>
81# include <math.h>
82# include <stdio.h>
83
84/* needed for some of the validation stuff... */
85# include "BKE_anim_data.hh"
86# include "BKE_fcurve.hh"
87# include "BKE_nla.hh"
88
89# include "DNA_object_types.h"
90
91# include "ED_anim_api.hh"
92
93# include "DEG_depsgraph.hh"
94# include "DEG_depsgraph_build.hh"
95
96static void rna_NlaStrip_name_set(PointerRNA *ptr, const char *value)
97{
98 NlaStrip *data = (NlaStrip *)ptr->data;
99
100 /* copy the name first */
101 STRNCPY_UTF8(data->name, value);
102
103 /* validate if there's enough info to do so */
104 if (ptr->owner_id) {
107 }
108}
109
110static std::optional<std::string> rna_NlaStrip_path(const PointerRNA *ptr)
111{
112 NlaStrip *strip = (NlaStrip *)ptr->data;
114
115 /* if we're attached to AnimData, try to resolve path back to AnimData */
116 if (adt) {
117 NlaTrack *nlt;
118 NlaStrip *nls;
119
120 for (nlt = static_cast<NlaTrack *>(adt->nla_tracks.first); nlt; nlt = nlt->next) {
121 for (nls = static_cast<NlaStrip *>(nlt->strips.first); nls; nls = nls->next) {
122 if (nls == strip) {
123 /* XXX but if we animate like this, the control will never work... */
124 char name_esc_nlt[sizeof(nlt->name) * 2];
125 char name_esc_strip[sizeof(strip->name) * 2];
126
127 BLI_str_escape(name_esc_nlt, nlt->name, sizeof(name_esc_nlt));
128 BLI_str_escape(name_esc_strip, strip->name, sizeof(name_esc_strip));
129 return fmt::format(
130 "animation_data.nla_tracks[\"{}\"].strips[\"{}\"]", name_esc_nlt, name_esc_strip);
131 }
132 }
133 }
134 }
135
136 /* no path */
137 return "";
138}
139
140static void rna_NlaStrip_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
141{
142 ID *id = ptr->owner_id;
143
144 ANIM_id_update(bmain, id);
145}
146
147static void rna_NlaStrip_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
148{
150
151 rna_NlaStrip_update(bmain, scene, ptr);
152}
153
154static void rna_NlaStrip_transform_update(Main *bmain, Scene *scene, PointerRNA *ptr)
155{
156 NlaStrip *strip = (NlaStrip *)ptr->data;
157
159
160 /* set the flag */
161 if ((strip->flag & NLASTRIP_FLAG_AUTO_BLENDS) && ptr->owner_id) {
162 /* validate state to ensure that auto-blend gets applied immediately */
164
165 if (iat->adt) {
166 BKE_nla_validate_state(iat->adt);
167 }
168 }
169
171
172 rna_NlaStrip_update(bmain, scene, ptr);
173}
174
175static void rna_NlaStrip_start_frame_set(PointerRNA *ptr, float value)
176{
177 /* Simply set the frame start in a valid range : if there are any NLA strips before/after, clamp
178 * the start value. If the new start value is past-the-end, clamp it. Otherwise, set it.
179 *
180 * NOTE: Unless neighboring strips are transitions, NLASTRIP_MIN_LEN_THRESH is not needed, as
181 * strips can be 'glued' to one another. If they are however, ensure transitions have a bit of
182 * time allotted in order to be performed.
183 */
184 NlaStrip *data = (NlaStrip *)ptr->data;
185
186 const float limit_prev = BKE_nlastrip_compute_frame_from_previous_strip(data);
187 const float limit_next = BKE_nlastrip_compute_frame_to_next_strip(data);
188 CLAMP(value, limit_prev, limit_next);
189
190 data->start = value;
191
192 /* The ONLY case where we actively modify the value set by the user, is in case the start value
193 * value is past the old end frame (here delta = NLASTRIP_MIN_LEN_THRESH) :
194 * - if there's no "room" for the end frame to be placed at (new_start + delta), move old_end to
195 * the limit, and new_start to (limit - delta)
196 * - otherwise, do _not_ change the end frame. This property is not accessible from the UI, and
197 * can only be set via scripts. The script should be responsible of setting the end frame.
198 */
199 if (data->start > (data->end - NLASTRIP_MIN_LEN_THRESH)) {
200 /* If past-the-allowed-end : */
201 if ((data->start + NLASTRIP_MIN_LEN_THRESH) > limit_next) {
202 data->end = limit_next;
203 data->start = data->end - NLASTRIP_MIN_LEN_THRESH;
204 }
205 }
206
207 /* Ensure transitions are kept 'glued' to the strip : */
208 if (data->prev && data->prev->type == NLASTRIP_TYPE_TRANSITION) {
209 data->prev->end = data->start;
210 }
211}
212
213static void rna_NlaStrip_frame_start_ui_set(PointerRNA *ptr, float value)
214{
215 NlaStrip *data = (NlaStrip *)ptr->data;
216
217 /* Changing the NLA strip's start frame is exactly the same as translating it in the NLA editor.
218 * When 'translating' the clip, the length of it should stay identical. Se we also need to set
219 * this strip's end frame after modifying its start (to `start + (old_end - old_start)`).
220 * Of course, we might have a few other strips on this NLA track, so we have to respect the
221 * previous strip's end frame.
222 *
223 * Also, different types of NLA strips (*_CLIP, *_TRANSITION, *_META, *_SOUND) have their own
224 * properties to respect. Needs testing on a real-world use case for the transition, meta, and
225 * sound types.
226 */
227
228 /* The strip's total length before modifying it & also how long we'd like it to be afterwards. */
229 const float striplen = data->end - data->start;
230
231 /* We're only modifying one strip at a time. The start and end times of its neighbors should not
232 * change. As such, here are the 'bookends' (frame limits) for the start position to respect :
233 * - if a next strip exists, don't allow the strip to start after (next->end - striplen - delta),
234 * (delta being the min length of a Nla Strip : the NLASTRIP_MIN_THRESH macro)
235 * - if a previous strip exists, don't allow this strip to start before it (data->prev) ends
236 * - otherwise, limit to the program limit macros defined in DNA_scene_types.h : {MINA|MAX}FRAMEF
237 */
238 const float limit_prev = BKE_nlastrip_compute_frame_from_previous_strip(data);
239 const float limit_next = BKE_nlastrip_compute_frame_to_next_strip(data) - striplen;
240 /* For above : we want to be able to fit the entire strip before the next frame limit, so shift
241 * the next limit by 'striplen' no matter the context. */
242
243 CLAMP(value, limit_prev, limit_next);
244 data->start = value;
245
246 if (data->type != NLASTRIP_TYPE_TRANSITION) {
247 data->end = data->start + striplen;
248 }
249
250 /* Update properties of the prev/next strips if they are transitions to ensure consistency : */
251 if (data->prev && data->prev->type == NLASTRIP_TYPE_TRANSITION) {
252 data->prev->end = data->start;
253 }
254 if (data->next && data->next->type == NLASTRIP_TYPE_TRANSITION) {
255 data->next->start = data->end;
256 }
257}
258
259static void rna_NlaStrip_end_frame_set(PointerRNA *ptr, float value)
260{
261 NlaStrip *data = (NlaStrip *)ptr->data;
262
263 const float limit_prev = BKE_nlastrip_compute_frame_from_previous_strip(data);
264 const float limit_next = BKE_nlastrip_compute_frame_to_next_strip(data);
265 CLAMP(value, limit_prev, limit_next);
266
267 data->end = value;
268
269 /* The ONLY case where we actively modify the value set by the user, is in case the start value
270 * value is past the old end frame (here delta = NLASTRIP_MIN_LEN_THRESH):
271 * - if there's no "room" for the end frame to be placed at (new_start + delta), move old_end to
272 * the limit, and new_start to (limit - delta)
273 * - otherwise, do _not_ change the end frame. This property is not accessible from the UI, and
274 * can only be set via scripts. The script should be responsible for setting the end frame.
275 */
276 if (data->end < (data->start + NLASTRIP_MIN_LEN_THRESH)) {
277 /* If before-the-allowed-start : */
278 if ((data->end - NLASTRIP_MIN_LEN_THRESH) < limit_prev) {
279 data->start = limit_prev;
280 data->end = data->start + NLASTRIP_MIN_LEN_THRESH;
281 }
282 }
283
284 /* Ensure transitions are kept "glued" to the strip: */
285 if (data->next && data->next->type == NLASTRIP_TYPE_TRANSITION) {
286 data->next->start = data->end;
287 }
288}
289
290static void rna_NlaStrip_frame_end_ui_set(PointerRNA *ptr, float value)
291{
292 NlaStrip *data = (NlaStrip *)ptr->data;
293
294 /* Changing the strip's end frame will update its action 'range' (defined by actstart->actend) to
295 * accommodate the extra length of the strip. No other parameters of the strip will change. But
296 * this means we have to get the current strip's end frame right now :
297 */
298 const float old_strip_end = data->end;
299
300 /* clamp value to lie within valid limits
301 * - must not have zero or negative length strip, so cannot start before the first frame
302 * + some minimum-strip-length threshold
303 * - cannot end later than the start of the next strip (if present)
304 * -> relies on the BKE_nlastrip_compute_frame_to_next_strip() function
305 */
306 const float limit_prev = data->start + NLASTRIP_MIN_LEN_THRESH;
307 const float limit_next = BKE_nlastrip_compute_frame_to_next_strip(data);
308
309 CLAMP(value, limit_prev, limit_next);
310 data->end = value;
311
312 /* Only adjust transitions at this stage : */
313 if (data->next && data->next->type == NLASTRIP_TYPE_TRANSITION) {
314 data->next->start = value;
315 }
316
317 /* calculate the lengths the strip and its action : *
318 * (Meta and transitions shouldn't be updated, but clip and sound should) */
319 if (data->type == NLASTRIP_TYPE_CLIP || data->type == NLASTRIP_TYPE_SOUND) {
320 const float actlen = BKE_nla_clip_length_get_nonzero(data);
321
322 /* Modify the strip's action end frame, or repeat based on :
323 * - if data->repeat == 1.0f, modify the action end frame :
324 * - if the number of frames to subtract is the number of frames, set the action end frame
325 * to the action start + 1 and modify the end of the strip to add that frame
326 * - if the number of frames
327 * - otherwise, modify the repeat property to accommodate for the new length
328 */
329 float action_length_delta = (old_strip_end - data->end) / data->scale;
330 /* If no repeats are used, then modify the action end frame : */
331 if (IS_EQF(data->repeat, 1.0f)) {
332 /* If they're equal, strip has been reduced by the same amount as the whole strip length,
333 * so clamp the action clip length to 1 frame, and add a frame to end so that
334 * `len(strip) != 0`. */
335 if (IS_EQF(action_length_delta, actlen)) {
336 data->actend = data->actstart + 1.0f;
337 data->end += 1.0f;
338 }
339 else if (action_length_delta < actlen) {
340 /* Now, adjust the new strip's actend to the value it's supposed to have : */
341 data->actend = data->actend - action_length_delta;
342 }
343 /* The case where the delta is bigger than the action length should not be possible, since
344 * data->end is guaranteed to be clamped to data->start + threshold above.
345 */
346 }
347 else {
348 data->repeat -= (action_length_delta / actlen);
349 }
350 }
351}
352
353static void rna_NlaStrip_scale_set(PointerRNA *ptr, float value)
354{
355 NlaStrip *data = (NlaStrip *)ptr->data;
356
357 /* set scale value */
358 /* NOTE: these need to be synced with the values in the
359 * property definition in rna_def_nlastrip() */
360 CLAMP(value, 0.0001f, 1000.0f);
361 data->scale = value;
362
363 /* adjust the strip extents in response to this */
365}
366
367static void rna_NlaStrip_repeat_set(PointerRNA *ptr, float value)
368{
369 NlaStrip *data = (NlaStrip *)ptr->data;
370
371 /* set repeat value */
372 /* NOTE: these need to be synced with the values in the
373 * property definition in rna_def_nlastrip() */
374 CLAMP(value, 0.01f, 1000.0f);
375 data->repeat = value;
376
377 /* adjust the strip extents in response to this */
379}
380
381static void rna_NlaStrip_blend_in_set(PointerRNA *ptr, float value)
382{
383 NlaStrip *data = (NlaStrip *)ptr->data;
384 float len;
385
386 /* blend-in is limited to the length of the strip, and also cannot overlap with blendout */
387 len = (data->end - data->start) - data->blendout;
388 CLAMP(value, 0, len);
389
390 data->blendin = value;
391}
392
393static void rna_NlaStrip_blend_out_set(PointerRNA *ptr, float value)
394{
395 NlaStrip *data = (NlaStrip *)ptr->data;
396 float len;
397
398 /* blend-out is limited to the length of the strip */
399 len = (data->end - data->start);
400 CLAMP(value, 0, len);
401
402 /* it also cannot overlap with blendin */
403 if ((len - value) < data->blendin) {
404 value = len - data->blendin;
405 }
406
407 data->blendout = value;
408}
409
410static void rna_NlaStrip_use_auto_blend_set(PointerRNA *ptr, bool value)
411{
412 NlaStrip *data = (NlaStrip *)ptr->data;
413
414 if (value) {
415 /* set the flag */
416 data->flag |= NLASTRIP_FLAG_AUTO_BLENDS;
417
418 /* validate state to ensure that auto-blend gets applied immediately */
419 if (ptr->owner_id) {
421
422 if (iat->adt) {
423 BKE_nla_validate_state(iat->adt);
424 }
425 }
426 }
427 else {
428 /* clear the flag */
429 data->flag &= ~NLASTRIP_FLAG_AUTO_BLENDS;
430
431 /* clear the values too, so that it's clear that there has been an effect */
432 /* TODO: it's somewhat debatable whether it's better to leave these in instead... */
433 data->blendin = 0.0f;
434 data->blendout = 0.0f;
435 }
436}
437
438static int rna_NlaStrip_action_editable(const PointerRNA *ptr, const char ** /*r_info*/)
439{
440 NlaStrip *strip = (NlaStrip *)ptr->data;
441
442 /* Strip actions shouldn't be editable if NLA tweak-mode is on. */
443 if (ptr->owner_id) {
445
446 if (adt) {
447 /* active action is only editable when it is not a tweaking strip */
448 if ((adt->flag & ADT_NLA_EDIT_ON) || (adt->actstrip) || (adt->tmpact)) {
449 return 0;
450 }
451 }
452 }
453
454 /* check for clues that strip probably shouldn't be used... */
455 if (strip->flag & NLASTRIP_FLAG_TWEAKUSER) {
456 return 0;
457 }
458
459 /* should be ok, though we may still miss some cases */
460 return PROP_EDITABLE;
461}
462
463# ifdef WITH_ANIM_BAKLAVA
464static void rna_NlaStrip_action_slot_handle_set(
465 PointerRNA *ptr, const blender::animrig::slot_handle_t new_slot_handle)
466{
467 NlaStrip *strip = (NlaStrip *)ptr->data;
468 rna_generic_action_slot_handle_set(new_slot_handle,
469 *ptr->owner_id,
470 strip->act,
471 strip->action_slot_handle,
472 strip->action_slot_name);
473}
474
475static PointerRNA rna_NlaStrip_action_slot_get(PointerRNA *ptr)
476{
477 NlaStrip *strip = (NlaStrip *)ptr->data;
478 return rna_generic_action_slot_get(strip->act, strip->action_slot_handle);
479}
480
481static void rna_NlaStrip_action_slot_set(PointerRNA *ptr, PointerRNA value, ReportList *reports)
482{
483 NlaStrip *strip = (NlaStrip *)ptr->data;
484 rna_generic_action_slot_set(value,
485 *ptr->owner_id,
486 strip->act,
487 strip->action_slot_handle,
488 strip->action_slot_name,
489 reports);
490}
491
492static void rna_iterator_nlastrip_action_slots_begin(CollectionPropertyIterator *iter,
494{
495 NlaStrip *strip = (NlaStrip *)ptr->data;
496 rna_iterator_generic_action_slots_begin(iter, strip->act);
497}
498# endif /* WITH_ANIM_BAKLAVA */
499
500static void rna_NlaStrip_action_start_frame_set(PointerRNA *ptr, float value)
501{
502 NlaStrip *data = (NlaStrip *)ptr->data;
503
504 /* prevent start frame from occurring after end of action */
505 CLAMP(value, MINAFRAME, data->actend);
506 data->actstart = value;
507
508 /* adjust the strip extents in response to this */
509 /* TODO: should the strip be moved backwards instead as a special case? */
511}
512
513static void rna_NlaStrip_action_end_frame_set(PointerRNA *ptr, float value)
514{
515 NlaStrip *data = (NlaStrip *)ptr->data;
516
517 /* prevent end frame from starting before start of action */
518 CLAMP(value, data->actstart, MAXFRAME);
519 data->actend = value;
520
521 /* adjust the strip extents in response to this */
523}
524
525static void rna_NlaStrip_animated_influence_set(PointerRNA *ptr, bool value)
526{
527 NlaStrip *data = (NlaStrip *)ptr->data;
528
529 if (value) {
530 /* set the flag, then make sure a curve for this exists */
531 data->flag |= NLASTRIP_FLAG_USR_INFLUENCE;
533 }
534 else {
535 data->flag &= ~NLASTRIP_FLAG_USR_INFLUENCE;
536 }
537}
538
539static void rna_NlaStrip_animated_time_set(PointerRNA *ptr, bool value)
540{
541 NlaStrip *data = (NlaStrip *)ptr->data;
542
543 if (value) {
544 /* set the flag, then make sure a curve for this exists */
545 data->flag |= NLASTRIP_FLAG_USR_TIME;
547 }
548 else {
549 data->flag &= ~NLASTRIP_FLAG_USR_TIME;
550 }
551}
552
553static FCurve *rna_NlaStrip_fcurve_find(NlaStrip *strip,
554 ReportList *reports,
555 const char *data_path,
556 int index)
557{
558 if (data_path[0] == '\0') {
559 BKE_report(reports, RPT_ERROR, "F-Curve data path empty, invalid argument");
560 return nullptr;
561 }
562
563 /* Returns nullptr if not found. */
564 return BKE_fcurve_find(&strip->fcurves, data_path, index);
565}
566
567static NlaStrip *rna_NlaStrip_new(ID *id,
568 NlaTrack *track,
569 Main *bmain,
570 bContext *C,
571 ReportList *reports,
572 const char * /*name*/,
573 int start,
574 bAction *action)
575{
576 BLI_assert(id);
577 NlaStrip *strip = BKE_nlastrip_new(action, *id);
578
579 if (strip == nullptr) {
580 BKE_report(reports, RPT_ERROR, "Unable to create new strip");
581 return nullptr;
582 }
583
584 strip->end += (start - strip->start);
585 strip->start = start;
586
587 if (!BKE_nlastrips_add_strip(&track->strips, strip)) {
589 reports,
590 RPT_ERROR,
591 "Unable to add strip (the track does not have any space to accommodate this new strip)");
592 BKE_nlastrip_free(strip, true);
593 return nullptr;
594 }
595
596 /* create dummy AnimData block so that BKE_nlastrip_validate_name()
597 * can be used to ensure a valid name, as we don't have one here...
598 * - only the nla_tracks list is needed there, which we aim to reverse engineer here...
599 */
600 {
601 AnimData adt = {nullptr};
602 NlaTrack *nlt, *nlt_p;
603
604 /* 'first' NLA track is found by going back up chain of given
605 * track's parents until we fall off. */
606 nlt_p = track;
607 nlt = track;
608 while ((nlt = nlt->prev) != nullptr) {
609 nlt_p = nlt;
610 }
611 adt.nla_tracks.first = nlt_p;
612
613 /* do the same thing to find the last track */
614 nlt_p = track;
615 nlt = track;
616 while ((nlt = nlt->next) != nullptr) {
617 nlt_p = nlt;
618 }
619 adt.nla_tracks.last = nlt_p;
620
621 /* now we can just auto-name as usual */
622 BKE_nlastrip_validate_name(&adt, strip);
623 }
624
626
629
630 return strip;
631}
632
633static void rna_NlaStrip_remove(
634 ID *id, NlaTrack *track, Main *bmain, bContext *C, ReportList *reports, PointerRNA *strip_ptr)
635{
636 NlaStrip *strip = static_cast<NlaStrip *>(strip_ptr->data);
637 if (BLI_findindex(&track->strips, strip) == -1) {
639 reports, RPT_ERROR, "NLA strip '%s' not found in track '%s'", strip->name, track->name);
640 return;
641 }
642
643 BKE_nlastrip_remove_and_free(&track->strips, strip, true);
644 RNA_POINTER_INVALIDATE(strip_ptr);
645
647
650}
651
652/* Set the 'solo' setting for the given NLA-track, making sure that it is the only one
653 * that has this status in its AnimData block.
654 */
655static void rna_NlaTrack_solo_set(PointerRNA *ptr, bool value)
656{
657 NlaTrack *data = (NlaTrack *)ptr->data;
659 NlaTrack *nt;
660
661 if (data == nullptr) {
662 return;
663 }
664
665 /* firstly, make sure 'solo' flag for all tracks is disabled */
666 for (nt = data; nt; nt = nt->next) {
667 nt->flag &= ~NLATRACK_SOLO;
668 }
669 for (nt = data; nt; nt = nt->prev) {
670 nt->flag &= ~NLATRACK_SOLO;
671 }
672
673 /* now, enable 'solo' for the given track if appropriate */
674 if (value) {
675 /* set solo status */
676 data->flag |= NLATRACK_SOLO;
677
678 /* set solo-status on AnimData */
679 adt->flag |= ADT_NLA_SOLO_TRACK;
680 }
681 else {
682 /* solo status was already cleared on track */
683
684 /* clear solo-status on AnimData */
685 adt->flag &= ~ADT_NLA_SOLO_TRACK;
686 }
687}
688
689#else
690
692{
693 StructRNA *srna;
694
695 FunctionRNA *func;
696 PropertyRNA *parm;
697
698 RNA_def_property_srna(cprop, "NlaStripFCurves");
699 srna = RNA_def_struct(brna, "NlaStripFCurves", nullptr);
700 RNA_def_struct_sdna(srna, "NlaStrip");
701 RNA_def_struct_ui_text(srna, "NLA-Strip F-Curves", "Collection of NLA strip F-Curves");
702
703 /* `Strip.fcurves.find(...)`. */
704 func = RNA_def_function(srna, "find", "rna_NlaStrip_fcurve_find");
706 func,
707 "Find an F-Curve. Note that this function performs a linear scan "
708 "of all F-Curves in the NLA strip.");
710 parm = RNA_def_string(func, "data_path", nullptr, 0, "Data Path", "F-Curve data path");
712 RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Array index", 0, INT_MAX);
713
714 parm = RNA_def_pointer(
715 func, "fcurve", "FCurve", "", "The found F-Curve, or None if it doesn't exist");
716 RNA_def_function_return(func, parm);
717}
718
719static void rna_def_nlastrip(BlenderRNA *brna)
720{
721 StructRNA *srna;
722 PropertyRNA *prop;
723
724 /* Enum definitions. */
725 static const EnumPropertyItem prop_type_items[] = {
726 {NLASTRIP_TYPE_CLIP, "CLIP", 0, "Action Clip", "NLA Strip references some Action"},
728 "TRANSITION",
729 0,
730 "Transition",
731 "NLA Strip 'transitions' between adjacent strips"},
732 {NLASTRIP_TYPE_META, "META", 0, "Meta", "NLA Strip acts as a container for adjacent strips"},
734 "SOUND",
735 0,
736 "Sound Clip",
737 "NLA Strip representing a sound event for speakers"},
738 {0, nullptr, 0, nullptr, nullptr},
739 };
740
741 /* struct definition */
742 srna = RNA_def_struct(brna, "NlaStrip", nullptr);
743 RNA_def_struct_ui_text(srna, "NLA Strip", "A container referencing an existing Action");
744 RNA_def_struct_path_func(srna, "rna_NlaStrip_path");
745 RNA_def_struct_ui_icon(srna, ICON_NLA); /* XXX */
746
748
749 /* name property */
750 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
751 RNA_def_property_ui_text(prop, "Name", "");
752 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_NlaStrip_name_set");
754 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, nullptr); /* this will do? */
755
756 /* Enums */
757 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
758 RNA_def_property_enum_sdna(prop, nullptr, "type");
760 prop, PROP_EDITABLE); /* XXX for now, not editable, since this is dangerous */
761 RNA_def_property_enum_items(prop, prop_type_items);
762 RNA_def_property_ui_text(prop, "Type", "Type of NLA Strip");
763 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
764
765 prop = RNA_def_property(srna, "extrapolation", PROP_ENUM, PROP_NONE);
766 RNA_def_property_enum_sdna(prop, nullptr, "extendmode");
769 prop, "Extrapolation", "Action to take for gaps past the strip extents");
770 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
771
772 prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
773 RNA_def_property_enum_sdna(prop, nullptr, "blendmode");
776 prop, "Blending", "Method used for combining strip's result with accumulated result");
777 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
778
779 /* Strip extents */
780 prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME);
781 RNA_def_property_float_sdna(prop, nullptr, "start");
782 RNA_def_property_float_funcs(prop, nullptr, "rna_NlaStrip_start_frame_set", nullptr);
783 RNA_def_property_ui_text(prop, "Start Frame", "");
785 prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
786 /* The `frame_start` and `frame_end` properties should NOT be considered for library overrides,
787 * as their setters always enforce a valid state. While library overrides are applied, the
788 * intermediate state may be invalid, even when the end state is valid. */
790
791 prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_TIME);
792 RNA_def_property_float_sdna(prop, nullptr, "end");
793 RNA_def_property_float_funcs(prop, nullptr, "rna_NlaStrip_end_frame_set", nullptr);
794 RNA_def_property_ui_text(prop, "End Frame", "");
796 prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
797 /* The `frame_start` and `frame_end` properties should NOT be considered for library overrides,
798 * as their setters always enforce a valid state. While library overrides are applied, the
799 * intermediate state may be invalid, even when the end state is valid. */
801
802 /* Strip extents without enforcing a valid state. */
803 prop = RNA_def_property(srna, "frame_start_raw", PROP_FLOAT, PROP_TIME);
804 RNA_def_property_float_sdna(prop, nullptr, "start");
806 "Start Frame (raw value)",
807 "Same as frame_start, except that any value can be set, including ones "
808 "that create an invalid state");
810 prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
811
812 prop = RNA_def_property(srna, "frame_end_raw", PROP_FLOAT, PROP_TIME);
813 RNA_def_property_float_sdna(prop, nullptr, "end");
815 "End Frame (raw value)",
816 "Same as frame_end, except that any value can be set, including ones "
817 "that create an invalid state");
819 prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
820
821 /* Strip extents, when called from UI elements : */
822 prop = RNA_def_property(srna, "frame_start_ui", PROP_FLOAT, PROP_TIME);
823 RNA_def_property_float_sdna(prop, nullptr, "start");
824 RNA_def_property_float_funcs(prop, nullptr, "rna_NlaStrip_frame_start_ui_set", nullptr);
826 prop,
827 "Start Frame (manipulated from UI)",
828 "Start frame of the NLA strip. Note: changing this value also updates the value of "
829 "the strip's end frame. If only the start frame should be changed, see the \"frame_start\" "
830 "property instead.");
832 prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
833 /* The `..._ui` properties should NOT be considered for library overrides, as they are meant to
834 * have different behavior than when setting their non-`..._ui` counterparts. */
836
837 prop = RNA_def_property(srna, "frame_end_ui", PROP_FLOAT, PROP_TIME);
838 RNA_def_property_float_sdna(prop, nullptr, "end");
839 RNA_def_property_float_funcs(prop, nullptr, "rna_NlaStrip_frame_end_ui_set", nullptr);
841 prop,
842 "End Frame (manipulated from UI)",
843 "End frame of the NLA strip. Note: changing this value also updates the value of "
844 "the strip's repeats or its action's end frame. If only the end frame should be "
845 "changed, see the \"frame_end\" property instead.");
847 prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
848 /* The `..._ui` properties should NOT be considered for library overrides, as they are meant to
849 * have different behavior than when setting their non-`..._ui` counterparts. */
851
852 /* Blending */
853 prop = RNA_def_property(srna, "blend_in", PROP_FLOAT, PROP_NONE);
854 RNA_def_property_float_sdna(prop, nullptr, "blendin");
855 RNA_def_property_float_funcs(prop, nullptr, "rna_NlaStrip_blend_in_set", nullptr);
857 prop, "Blend In", "Number of frames at start of strip to fade in influence");
858 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
859
860 prop = RNA_def_property(srna, "blend_out", PROP_FLOAT, PROP_NONE);
861 RNA_def_property_float_sdna(prop, nullptr, "blendout");
862 RNA_def_property_float_funcs(prop, nullptr, "rna_NlaStrip_blend_out_set", nullptr);
863 RNA_def_property_ui_text(prop, "Blend Out", "");
864 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
865
866 prop = RNA_def_property(srna, "use_auto_blend", PROP_BOOLEAN, PROP_NONE);
868 RNA_def_property_boolean_funcs(prop, nullptr, "rna_NlaStrip_use_auto_blend_set");
870 "Auto Blend In/Out",
871 "Number of frames for Blending In/Out is automatically determined from "
872 "overlapping strips");
873 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
874
875 /* Action */
876 prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
877 RNA_def_property_pointer_sdna(prop, nullptr, "act");
878 RNA_def_property_pointer_funcs(prop, nullptr, nullptr, nullptr, "rna_Action_id_poll");
880 RNA_def_property_editable_func(prop, "rna_NlaStrip_action_editable");
881 RNA_def_property_ui_text(prop, "Action", "Action referenced by this strip");
883 prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_dependency_update");
884
885# ifdef WITH_ANIM_BAKLAVA
886 /* This property is not necessary for the Python API (that is better off using
887 * slot references/pointers directly), but it is needed for library overrides
888 * to work. */
889 prop = RNA_def_property(srna, "action_slot_handle", PROP_INT, PROP_NONE);
890 RNA_def_property_int_sdna(prop, nullptr, "action_slot_handle");
891 RNA_def_property_int_funcs(prop, nullptr, "rna_NlaStrip_action_slot_handle_set", nullptr);
893 "Action Slot Handle",
894 "A number that identifies which sub-set of the Action is considered "
895 "to be for this NLA strip");
897 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA_ACTCHANGE, "rna_NlaStrip_dependency_update");
898
899 prop = RNA_def_property(srna, "action_slot_name", PROP_STRING, PROP_NONE);
900 RNA_def_property_string_sdna(prop, nullptr, "action_slot_name");
902 prop,
903 "Action Slot Name",
904 "The name of the action slot. The slot identifies which sub-set of the Action "
905 "is considered to be for this strip, and its name is used to find the right slot "
906 "when assigning an Action.");
907
908 prop = RNA_def_property(srna, "action_slot", PROP_POINTER, PROP_NONE);
909 RNA_def_property_struct_type(prop, "ActionSlot");
913 prop,
914 "Action Slot",
915 "The slot identifies which sub-set of the Action is considered to be for this "
916 "strip, and its name is used to find the right slot when assigning another Action");
918 prop, "rna_NlaStrip_action_slot_get", "rna_NlaStrip_action_slot_set", nullptr, nullptr);
919 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA_ACTCHANGE, "rna_NlaStrip_dependency_update");
920 /* `strip.action_slot` is exposed to RNA as a pointer for things like the action slot selector in
921 * the GUI. The ground truth of the assigned slot, however, is `action_slot_handle` declared
922 * above. That property is used for library override operations, and this pointer property should
923 * just be ignored.
924 *
925 * This needs PROPOVERRIDE_IGNORE; PROPOVERRIDE_NO_COMPARISON is not suitable here. This property
926 * should act as if it is an overridable property (as from the user's perspective, it is), but an
927 * override operation should not be created for it. It will be created for `action_slot_handle`,
928 * and that's enough. */
930
931 prop = RNA_def_property(srna, "action_slots", PROP_COLLECTION, PROP_NONE);
932 RNA_def_property_struct_type(prop, "ActionSlot");
934 "rna_iterator_nlastrip_action_slots_begin",
935 "rna_iterator_array_next",
936 "rna_iterator_array_end",
937 "rna_iterator_array_dereference_get",
938 nullptr,
939 nullptr,
940 nullptr,
941 nullptr);
943 prop, "Action Slots", "The list of action slots suitable for this NLA strip");
944# endif /* WITH_ANIM_BAKLAVA */
945
946 /* Action extents */
947 prop = RNA_def_property(srna, "action_frame_start", PROP_FLOAT, PROP_TIME);
948 RNA_def_property_float_sdna(prop, nullptr, "actstart");
949 RNA_def_property_float_funcs(prop, nullptr, "rna_NlaStrip_action_start_frame_set", nullptr);
950 RNA_def_property_ui_text(prop, "Action Start Frame", "First frame from action to use");
952 prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
953
954 prop = RNA_def_property(srna, "action_frame_end", PROP_FLOAT, PROP_TIME);
955 RNA_def_property_float_sdna(prop, nullptr, "actend");
956 RNA_def_property_float_funcs(prop, nullptr, "rna_NlaStrip_action_end_frame_set", nullptr);
957 RNA_def_property_ui_text(prop, "Action End Frame", "Last frame from action to use");
959 prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
960
961 /* Action Reuse */
962 prop = RNA_def_property(srna, "repeat", PROP_FLOAT, PROP_NONE);
963 RNA_def_property_float_sdna(prop, nullptr, "repeat");
964 RNA_def_property_float_funcs(prop, nullptr, "rna_NlaStrip_repeat_set", nullptr);
965 /* these limits have currently be chosen arbitrarily, but could be extended
966 * (minimum should still be > 0 though) if needed... */
968 RNA_def_property_range(prop, 0.1f, 1000.0f);
969 RNA_def_property_ui_text(prop, "Repeat", "Number of times to repeat the action range");
971 prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
972
973 prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
974 RNA_def_property_float_sdna(prop, nullptr, "scale");
975 RNA_def_property_float_funcs(prop, nullptr, "rna_NlaStrip_scale_set", nullptr);
976 /* these limits can be extended, but beyond this, we can get some crazy+annoying bugs
977 * due to numeric errors */
979 RNA_def_property_range(prop, 0.0001f, 1000.0f);
980 RNA_def_property_ui_text(prop, "Scale", "Scaling factor for action");
982 prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
983
984 /* Strip's F-Curves */
985 prop = RNA_def_property(srna, "fcurves", PROP_COLLECTION, PROP_NONE);
986 RNA_def_property_collection_sdna(prop, nullptr, "fcurves", nullptr);
987 RNA_def_property_struct_type(prop, "FCurve");
989 prop, "F-Curves", "F-Curves for controlling the strip's influence and timing");
990 rna_def_strip_fcurves(brna, prop);
991
992 /* Strip's F-Modifiers */
993 prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
994 RNA_def_property_struct_type(prop, "FModifier");
996 prop, "Modifiers", "Modifiers affecting all the F-Curves in the referenced Action");
997
998 /* Strip's Sub-Strips (for Meta-Strips) */
999 prop = RNA_def_property(srna, "strips", PROP_COLLECTION, PROP_NONE);
1000 RNA_def_property_struct_type(prop, "NlaStrip");
1002 prop,
1003 "NLA Strips",
1004 "NLA Strips that this strip acts as a container for (if it is of type Meta)");
1005
1006 /* Settings - Values necessary for evaluation */
1007 prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
1008 RNA_def_property_range(prop, 0.0f, 1.0f);
1010 prop, "Influence", "Amount the strip contributes to the current result");
1011 /* XXX: Update temporarily disabled so that the property can be edited at all!
1012 * Even auto-key only applies after the curves have been re-evaluated,
1013 * causing the unkeyed values to be lost. */
1015 prop, NC_ANIMATION | ND_NLA | NA_EDITED, /*"rna_NlaStrip_update"*/ nullptr);
1016
1017 prop = RNA_def_property(srna, "strip_time", PROP_FLOAT, PROP_TIME);
1018 RNA_def_property_ui_text(prop, "Strip Time", "Frame of referenced Action to evaluate");
1019 /* XXX: Update temporarily disabled so that the property can be edited at all!
1020 * Even auto-key only applies after the curves have been re-evaluated,
1021 * causing the unkeyed values to be lost. */
1023 prop, NC_ANIMATION | ND_NLA | NA_EDITED, /*"rna_NlaStrip_update"*/ nullptr);
1024
1025 /* TODO: should the animated_influence/time settings be animatable themselves? */
1026 prop = RNA_def_property(srna, "use_animated_influence", PROP_BOOLEAN, PROP_NONE);
1028 RNA_def_property_boolean_funcs(prop, nullptr, "rna_NlaStrip_animated_influence_set");
1030 prop,
1031 "Animated Influence",
1032 "Influence setting is controlled by an F-Curve rather than automatically determined");
1033 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
1034
1035 prop = RNA_def_property(srna, "use_animated_time", PROP_BOOLEAN, PROP_NONE);
1037 RNA_def_property_boolean_funcs(prop, nullptr, "rna_NlaStrip_animated_time_set");
1039 prop,
1040 "Animated Strip Time",
1041 "Strip time is controlled by an F-Curve rather than automatically determined");
1042 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
1043
1044 prop = RNA_def_property(srna, "use_animated_time_cyclic", PROP_BOOLEAN, PROP_NONE);
1047 prop, "Cyclic Strip Time", "Cycle the animated time within the action start and end");
1049 prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
1050
1051 /* settings */
1052 prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
1053 /* can be made editable by hooking it up to the necessary NLA API methods */
1056 RNA_def_property_ui_text(prop, "Active", "NLA Strip is active");
1057 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, nullptr); /* this will do? */
1058
1059 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
1061 RNA_def_property_ui_text(prop, "Select", "NLA Strip is selected");
1062 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, nullptr); /* this will do? */
1063
1064 prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
1065 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NLASTRIP_FLAG_MUTED);
1066 RNA_def_property_ui_icon(prop, ICON_CHECKBOX_HLT, -1);
1067 RNA_def_property_ui_text(prop, "Mute", "Disable NLA Strip evaluation");
1068 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
1069
1070 prop = RNA_def_property(srna, "use_reverse", PROP_BOOLEAN, PROP_NONE);
1073 "Reversed",
1074 "NLA Strip is played back in reverse order (only when timing is "
1075 "automatically determined)");
1076 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
1077
1078 prop = RNA_def_property(srna, "use_sync_length", PROP_BOOLEAN, PROP_NONE);
1081 "Sync Action Length",
1082 "Update range of frames referenced from action "
1083 "after tweaking strip and its keyframes");
1084 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
1085
1087}
1088
1090{
1091 StructRNA *srna;
1092 PropertyRNA *parm;
1093 FunctionRNA *func;
1094
1095 RNA_def_property_srna(cprop, "NlaStrips");
1096 srna = RNA_def_struct(brna, "NlaStrips", nullptr);
1097 RNA_def_struct_sdna(srna, "NlaTrack");
1098 RNA_def_struct_ui_text(srna, "NLA Strips", "Collection of NLA Strips");
1099
1100 func = RNA_def_function(srna, "new", "rna_NlaStrip_new");
1103 RNA_def_function_ui_description(func, "Add a new Action-Clip strip to the track");
1104 parm = RNA_def_string(func, "name", "NlaStrip", 0, "", "Name for the NLA Strips");
1106 parm = RNA_def_int(func,
1107 "start",
1108 0,
1109 INT_MIN,
1110 INT_MAX,
1111 "Start Frame",
1112 "Start frame for this strip",
1113 INT_MIN,
1114 INT_MAX);
1116 parm = RNA_def_pointer(func, "action", "Action", "", "Action to assign to this strip");
1118 /* return type */
1119 parm = RNA_def_pointer(func, "strip", "NlaStrip", "", "New NLA Strip");
1120 RNA_def_function_return(func, parm);
1121
1122 func = RNA_def_function(srna, "remove", "rna_NlaStrip_remove");
1125 RNA_def_function_ui_description(func, "Remove a NLA Strip");
1126 parm = RNA_def_pointer(func, "strip", "NlaStrip", "", "NLA Strip to remove");
1129}
1130
1132{
1133 StructRNA *srna;
1134 PropertyRNA *prop;
1135
1136 srna = RNA_def_struct(brna, "NlaTrack", nullptr);
1138 srna, "NLA Track", "An animation layer containing Actions referenced as NLA strips");
1139 RNA_def_struct_ui_icon(srna, ICON_NLA);
1140
1141 /* strips collection */
1142 prop = RNA_def_property(srna, "strips", PROP_COLLECTION, PROP_NONE);
1143 RNA_def_property_struct_type(prop, "NlaStrip");
1144 /* We do not support inserting or removing strips in overrides of tracks for now. */
1146 RNA_def_property_ui_text(prop, "NLA Strips", "NLA Strips on this NLA-track");
1147
1148 rna_api_nlatrack_strips(brna, prop);
1149
1150 prop = RNA_def_boolean(srna,
1151 "is_override_data",
1152 false,
1153 "Override Track",
1154 "In a local override data, whether this NLA track comes from the linked "
1155 "reference data, or is local to the override");
1158
1160
1161 /* name property */
1162 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1163 RNA_def_property_ui_text(prop, "Name", "");
1164 RNA_def_struct_name_property(srna, prop);
1165 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, nullptr); /* this will do? */
1166
1167 /* settings */
1168 prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
1169 /* can be made editable by hooking it up to the necessary NLA API methods */
1171 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NLATRACK_ACTIVE);
1172 RNA_def_property_ui_text(prop, "Active", "NLA Track is active");
1173 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, nullptr); /* this will do? */
1174
1175 prop = RNA_def_property(srna, "is_solo", PROP_BOOLEAN, PROP_NONE);
1176 /* can be made editable by hooking it up to the necessary NLA API methods */
1177 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NLATRACK_SOLO);
1179 prop,
1180 "Solo",
1181 "NLA Track is evaluated itself (i.e. active Action and all other NLA Tracks in the "
1182 "same AnimData block are disabled)");
1183 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
1184 RNA_def_property_boolean_funcs(prop, nullptr, "rna_NlaTrack_solo_set");
1185
1186 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
1187 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NLATRACK_SELECTED);
1188 RNA_def_property_ui_text(prop, "Select", "NLA Track is selected");
1189 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, nullptr); /* this will do? */
1190
1191 prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
1192 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NLATRACK_MUTED);
1193 RNA_def_property_ui_text(prop, "Muted", "Disable NLA Track evaluation");
1194 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
1195
1196 prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
1197 RNA_def_property_boolean_sdna(prop, nullptr, "flag", NLATRACK_PROTECTED);
1198 RNA_def_property_ui_text(prop, "Locked", "NLA Track is locked");
1199 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, nullptr); /* this will do? */
1200
1202}
1203
1204/* --------- */
1205
1207{
1208 rna_def_nlatrack(brna);
1209 rna_def_nlastrip(brna);
1210}
1211
1212#endif
Functions and classes to work with Actions.
AnimData * BKE_animdata_from_id(const ID *id)
Definition anim_data.cc:89
FCurve * BKE_fcurve_find(ListBase *list, const char rna_path[], int array_index)
void BKE_nlastrip_free(NlaStrip *strip, bool do_id_user)
void BKE_nlameta_flush_transforms(NlaStrip *mstrip)
void BKE_nlastrip_remove_and_free(ListBase *strips, NlaStrip *strip, const bool do_id_user)
float BKE_nlastrip_compute_frame_to_next_strip(NlaStrip *strip)
void BKE_nla_validate_state(AnimData *adt)
NlaStrip * BKE_nlastrip_new(bAction *act, ID &animated_id)
void BKE_nlastrip_recalculate_bounds(NlaStrip *strip)
bool BKE_nlastrips_add_strip(ListBase *strips, NlaStrip *strip)
void BKE_nlastrip_recalculate_blend(NlaStrip *strip)
#define NLASTRIP_MIN_LEN_THRESH
Definition BKE_nla.hh:12
float BKE_nla_clip_length_get_nonzero(const NlaStrip *strip)
float BKE_nlastrip_compute_frame_from_previous_strip(NlaStrip *strip)
void BKE_nlastrip_validate_name(AnimData *adt, NlaStrip *strip)
void BKE_nlastrip_validate_fcurves(NlaStrip *strip)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:125
#define BLI_assert(a)
Definition BLI_assert.h:50
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define STRNCPY_UTF8(dst, src)
#define CLAMP(a, b, c)
#define IS_EQF(a, b)
void DEG_id_tag_update_ex(Main *bmain, ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
@ ID_RECALC_SYNC_TO_EVAL
Definition DNA_ID.h:1085
@ ID_RECALC_ANIMATION
Definition DNA_ID.h:1044
@ NLASTRIP_FLAG_ACTIVE
@ NLASTRIP_FLAG_USR_INFLUENCE
@ NLASTRIP_FLAG_USR_TIME
@ NLASTRIP_FLAG_AUTO_BLENDS
@ NLASTRIP_FLAG_REVERSE
@ NLASTRIP_FLAG_MUTED
@ NLASTRIP_FLAG_USR_TIME_CYCLIC
@ NLASTRIP_FLAG_SELECT
@ NLASTRIP_FLAG_TWEAKUSER
@ NLASTRIP_FLAG_SYNC_LENGTH
@ ADT_NLA_SOLO_TRACK
@ ADT_NLA_EDIT_ON
@ NLASTRIP_EXTEND_HOLD_FORWARD
@ NLASTRIP_EXTEND_NOTHING
@ NLASTRIP_EXTEND_HOLD
@ NLASTRIP_MODE_REPLACE
@ NLASTRIP_MODE_ADD
@ NLASTRIP_MODE_SUBTRACT
@ NLASTRIP_MODE_COMBINE
@ NLASTRIP_MODE_MULTIPLY
@ NLASTRIP_TYPE_SOUND
@ NLASTRIP_TYPE_META
@ NLASTRIP_TYPE_TRANSITION
@ NLASTRIP_TYPE_CLIP
@ NLATRACK_SOLO
@ NLATRACK_ACTIVE
@ NLATRACK_MUTED
@ NLATRACK_SELECTED
@ NLATRACK_PROTECTED
@ NLATRACK_OVERRIDELIBRARY_LOCAL
Object is a sort of wrapper for general info.
#define MINAFRAME
#define MAXFRAME
Read Guarded memory(de)allocation.
#define RNA_POINTER_INVALIDATE(ptr)
ParameterFlag
Definition RNA_types.hh:396
@ PARM_RNAPTR
Definition RNA_types.hh:399
@ PARM_REQUIRED
Definition RNA_types.hh:397
@ FUNC_USE_REPORTS
Definition RNA_types.hh:680
@ FUNC_USE_MAIN
Definition RNA_types.hh:678
@ FUNC_USE_CONTEXT
Definition RNA_types.hh:679
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:667
@ PROP_FLOAT
Definition RNA_types.hh:67
@ PROP_BOOLEAN
Definition RNA_types.hh:65
@ PROP_ENUM
Definition RNA_types.hh:69
@ PROP_INT
Definition RNA_types.hh:66
@ PROP_STRING
Definition RNA_types.hh:68
@ PROP_POINTER
Definition RNA_types.hh:70
@ PROP_COLLECTION
Definition RNA_types.hh:71
#define RNA_ENUM_ITEM_SEPR
Definition RNA_types.hh:528
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:355
@ PROPOVERRIDE_NO_COMPARISON
Definition RNA_types.hh:363
@ PROPOVERRIDE_IGNORE
Definition RNA_types.hh:375
PropertyFlag
Definition RNA_types.hh:201
@ PROP_THICK_WRAP
Definition RNA_types.hh:312
@ PROP_ANIMATABLE
Definition RNA_types.hh:220
@ PROP_EDITABLE
Definition RNA_types.hh:207
@ PROP_NEVER_NULL
Definition RNA_types.hh:266
@ PROP_ID_REFCOUNT
Definition RNA_types.hh:253
@ PROP_TIME
Definition RNA_types.hh:156
@ PROP_NONE
Definition RNA_types.hh:136
@ PROP_FACTOR
Definition RNA_types.hh:154
#define ND_NLA_ACTCHANGE
Definition WM_types.hh:465
#define NC_ANIMATION
Definition WM_types.hh:355
#define NA_ADDED
Definition WM_types.hh:552
#define NA_EDITED
Definition WM_types.hh:550
#define NA_REMOVED
Definition WM_types.hh:553
#define ND_NLA
Definition WM_types.hh:464
void ANIM_id_update(Main *bmain, ID *id)
Definition anim_deps.cc:102
int len
decltype(::ActionSlot::handle) slot_handle_t
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop)
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_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_define_lib_overridable(const bool make_overridable)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void RNA_def_property_float_default(PropertyRNA *prop, float value)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
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_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
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 RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_def_function_flag(FunctionRNA *func, int flag)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
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_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
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 RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_nla(BlenderRNA *brna)
Definition rna_nla.cc:1206
static void rna_def_nlastrip(BlenderRNA *brna)
Definition rna_nla.cc:719
static void rna_def_nlatrack(BlenderRNA *brna)
Definition rna_nla.cc:1131
const EnumPropertyItem rna_enum_nla_mode_blend_items[]
Definition rna_nla.cc:36
static void rna_api_nlatrack_strips(BlenderRNA *brna, PropertyRNA *cprop)
Definition rna_nla.cc:1089
static void rna_def_strip_fcurves(BlenderRNA *brna, PropertyRNA *cprop)
Definition rna_nla.cc:691
const EnumPropertyItem rna_enum_nla_mode_extend_items[]
Definition rna_nla.cc:67
NlaStrip * actstrip
bAction * tmpact
ListBase nla_tracks
Definition DNA_ID.h:413
void * last
void * first
struct NlaStrip * next
ListBase fcurves
char name[64]
ListBase strips
struct NlaTrack * next
char name[64]
struct NlaTrack * prev
ID * owner_id
Definition RNA_types.hh:40
void * data
Definition RNA_types.hh:42
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4126