Blender V5.3
DNA_anim_types.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009 Blender Authors, Joshua Leung. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "DNA_ID.h"
12#include "DNA_action_types.h"
13#include "DNA_curve_types.h"
14#include "DNA_listBase.h"
15
16#include <type_traits>
17#include <variant>
18
19namespace blender {
20
21#ifdef __cplusplus
22namespace bke {
23struct FCurveRuntime;
24struct NlaStripRuntime;
25} // namespace bke
28template<typename T> class Span;
29namespace rna_path {
30struct Member;
31struct LookupIndex;
32struct LookupKey;
33using Item = std::variant<Member, LookupIndex, LookupKey>;
34} // namespace rna_path
36#else
39#endif
40
41/* ************************************************ */
42/* F-Curve DataTypes */
43
44/* Modifiers -------------------------------------- */
45
52struct FModifier {
53 struct FModifier *next = nullptr, *prev = nullptr;
54
56 struct FCurve *curve = nullptr;
58 void *data = nullptr;
59
61 char name[/*MAX_NAME*/ 64] = "";
70 short ui_expand_flag = 0;
71
72 char _pad[6] = {};
73
75 float influence = 0;
76
78 float sfra = 0;
80 float efra = 0;
82 float blendin = 0;
84 float blendout = 0;
85};
86
87/* --- */
88
89/* Generator modifier data */
91 /* general generator information */
93 float *coefficients = nullptr;
95 unsigned int arraysize = 0;
96
98 int poly_order = 0;
101
104};
105
125
126/* envelope modifier - envelope data */
129 float min = 0, max = 0;
131 float time = 0;
132
134 short f1 = 0;
136 short f2 = 0;
137};
138
139/* envelope-like adjustment to values (for fade in/out) */
144 int totvert = 0;
145
147 float midval = 0;
149 float min = 0, max = 0;
150};
151
152/* cycling/repetition modifier data */
153/* TODO: we can only do complete cycles. */
164
165/* limits modifier data */
168 rctf rect = {};
171 char _pad[4] = {};
172};
173
174/* noise modifier data */
176 float size = 0;
177 float strength = 0;
178 float phase = 0;
179 float offset = 0;
180 float roughness = 0;
181 float lacunarity = 0;
182
183 short depth = 0;
185 char legacy_noise = 0;
186 char _pad[3] = {};
187};
188
189/* stepped modifier data */
192 float step_size = 0;
194 float offset = 0;
195
197 float start_frame = 0;
199 float end_frame = 0;
200
203};
204
205/* stepped modifier data */
206typedef struct FMod_Smooth {
211 float sigma;
212
216
217/* Drivers -------------------------------------- */
218
226 ID *id = nullptr;
227
229 char *rna_path = nullptr;
230
235 char pchan_name[/*MAX_NAME*/ 64] = "";
238
241 char _pad[5] = {};
242
251 int idtype = 0;
252
253 /* Context-dependent property of a "Context Property" type target.
254 * The `rna_path` of this property is used as a target. */
256
257 /* Fall back value to use with DTAR_OPTION_USE_FALLBACK. */
258 float fallback_value = 0;
259};
260
261/* --- */
262
271struct DriverVar {
272 struct DriverVar *next = nullptr, *prev = nullptr;
273
278 char name[/*MAX_NAME*/ 64] = "";
279
282
284 char num_targets = 0;
287
291 float curval = 0;
292};
293
294/* --- */
295
310 ListBaseT<DriverVar> variables = {nullptr, nullptr};
311
312 /* python expression to execute (may call functions defined in an accessory file)
313 * which relates the target 'variables' in some way to yield a single usable value
314 */
316 char expression[256] = "";
318 void *expr_comp = nullptr;
319
322
324 float curval = 0;
325 /* XXX to be implemented... this is like the constraint influence setting. */
327 float influence = 0;
328
329 /* general settings */
334};
335
336/* F-Curves -------------------------------------- */
337
344struct FPoint {
346 float vec[2];
348 int flag;
349 char _pad[4];
350};
351
353struct FCurve {
354 struct FCurve *next = nullptr, *prev = nullptr;
355
356 /* group */
358 bActionGroup *grp = nullptr;
359
360 /* driver settings */
363 /* evaluation settings */
365 ListBaseT<FModifier> modifiers = {nullptr, nullptr};
366
367 /* motion data */
369 BezTriple *bezt = nullptr;
371 FPoint *fpt = nullptr;
373 unsigned int totvert = 0;
374
383
390
391 char _pad[5] = {};
392
394
395 /* RNA - data link */
402 int array_index = 0;
408 char *rna_path_ptr = nullptr;
409
410 /* curve coloring (for editor) */
414 float color[3] = {};
415
417
419
420#ifdef __cplusplus
426 StringRefNull rna_path() const;
427
437 ParsedRNAPathRef rna_path_parsed() const;
438
440 void rna_path_set(StringRef path);
441
446 void rna_path_set_move(char *path);
447#endif
448};
449
450/* ************************************************ */
451/* 'Action' Data-types */
452
453/* NOTE: Although these are part of the Animation System,
454 * they are not stored here, see `DNA_action_types.h` instead. */
455
456/* ************************************************ */
457/* NLA - Non-Linear Animation */
458
459/* NLA Strips ------------------------------------- */
460
467struct NlaStrip {
468 struct NlaStrip *next = nullptr, *prev = nullptr;
469
471 ListBaseT<NlaStrip> strips = {nullptr, nullptr};
478 bAction *act = nullptr;
479
498 char last_slot_identifier[/*MAX_ID_NAME*/ 258] = "";
499 char _pad0[2] = {};
500 /* TODO: move out? */
502 ListBaseT<FCurve> fcurves = {nullptr, nullptr};
504 ListBaseT<FModifier> modifiers = {nullptr, nullptr};
505
507 char name[/*MAX_NAME*/ 64] = "";
508
510 float influence = 0;
512 float strip_time = 0;
513
515 float start = 0, end = 0;
517 float actstart = 0, actend = 0;
518
520 float repeat = 0;
522 float scale = 0;
523
525 float blendin = 0, blendout = 0;
528
531 char _pad1[2] = {};
532
535
538 char _pad2[4] = {};
539
540 /* Pointer to an original NLA strip. */
541 struct NlaStrip *orig_strip = nullptr;
542
544
545#ifdef __cplusplus
546 NlaStripRuntime &runtime_get();
547#endif
548};
549
550#ifdef __cplusplus
551/* Some static assertions that things that should have the same type actually do. */
552static_assert(
553 std::is_same_v<decltype(ActionSlot::handle), decltype(NlaStrip::action_slot_handle)>);
554#endif
555
556/* NLA Tracks ------------------------------------- */
557
566struct NlaTrack {
567 struct NlaTrack *next = nullptr, *prev = nullptr;
568
570 ListBaseT<NlaStrip> strips = {nullptr, nullptr};
571
576 int index = 0;
577
579 char name[/*MAX_NAME*/ 64] = "";
580};
581
582/* ************************************ */
583/* KeyingSet Data-types */
584
594struct KS_Path {
595 struct KS_Path *next = nullptr, *prev = nullptr;
596
598 ID *id = nullptr;
600 char group[/*MAX_NAME*/ 64] = "";
601
603 int idtype = 0;
604
609
611 char *rna_path = nullptr;
613 int array_index = 0;
614
619};
620
621/* ---------------- */
622
634struct KeyingSet {
635 struct KeyingSet *next = nullptr, *prev = nullptr;
636
638 ListBaseT<KS_Path> paths = {nullptr, nullptr};
639
641 char idname[/*MAX_NAME*/ 64] = "";
643 char name[/*MAX_NAME*/ 64] = "";
645 char description[1024] = "";
647 char typeinfo[/*MAX_NAME*/ 64] = "";
648
650 int active_path = 0;
651
654
659
660 char _pad[6] = {};
661};
662
663/* ************************************************ */
664/* Animation Data */
665
666/* AnimOverride ------------------------------------- */
667
679 struct AnimOverride *next = nullptr, *prev = nullptr;
680
682 char *rna_path = nullptr;
684 int array_index = 0;
685
687 float value = 0;
688};
689
690/* AnimData ------------------------------------- */
691
706struct AnimData {
713 bAction *action = nullptr;
714
732 char last_slot_identifier[/*MAX_ID_NAME*/ 258] = "";
733 uint8_t _pad0[2] = {};
734
739 bAction *tmpact = nullptr;
741 char tmp_last_slot_identifier[/*MAX_ID_NAME*/ 258] = "";
742 uint8_t _pad1[2] = {};
743
744 /* nla-tracks */
745 ListBaseT<NlaTrack> nla_tracks = {nullptr, nullptr};
750 NlaTrack *act_track = nullptr;
755 NlaStrip *actstrip = nullptr;
756
757 /* 'drivers' for this ID-block's settings - FCurves, but are completely
758 * separate from those for animation data
759 */
761 ListBaseT<FCurve> drivers = {nullptr, nullptr};
764 ListBaseT<AnimOverride> overrides = {nullptr, nullptr};
765
767 FCurve **driver_array = nullptr;
768
769 /* settings for animation evaluation */
772
773 /* settings for active action evaluation (based on NLA strip settings) */
779 float act_influence = 0;
780
781 uint8_t _pad2[4] = {};
782};
783
784#ifdef __cplusplus
785/* Some static assertions that things that should have the same type actually do. */
786static_assert(std::is_same_v<decltype(ActionSlot::handle), decltype(AnimData::slot_handle)>);
787static_assert(
788 std::is_same_v<decltype(ActionSlot::identifier), decltype(AnimData::last_slot_identifier)>);
789#endif
790
791/* Base Struct for Anim ------------------------------------- */
792
800 AnimData *adt = nullptr;
801};
802
803} // namespace blender
ID and Library types, which are fundamental for SDNA.
These structs are the foundation for all linked lists in the library system.
std::variant< Member, LookupIndex, LookupKey > Item
Definition RNA_path.hh:106
BMesh Iterators.
eNlaStrip_Extrapolate_Mode
eDriverTarget_RotationMode
Span< rna_path::Item > ParsedRNAPathRef
Definition RNA_path.hh:113
eFMod_Noise_Modifications
unsigned short uint16_t
Definition BKE_text.h:80
eDriverTarget_ContextProperty
unsigned char uint8_t
Definition BKE_text.h:79
eFMod_Generator_Functions
eDriverTarget_TransformChannels
signed int int32_t
Definition BKE_text.h:78
struct blender::FMod_Smooth FMod_Smooth
char tmp_last_slot_identifier[258]
eNlaStrip_Blend_Mode act_blendmode
char last_slot_identifier[258]
eNlaStrip_Extrapolate_Mode act_extendmode
eAnimData_Flag flag
ListBaseT< AnimOverride > overrides
ListBaseT< FCurve > drivers
ListBaseT< NlaTrack > nla_tracks
struct AnimOverride * next
struct AnimOverride * prev
ListBaseT< DriverVar > variables
struct ExprPyLike_Parsed * expr_simple
eDriverTarget_Options options
eDriverTarget_ContextProperty context_property
eDriverTarget_Flag flag
eDriverTarget_RotationMode rotation_mode
eDriverTarget_TransformChannels transChan
struct DriverVar * next
struct DriverVar * prev
eDriverVar_Flags flag
eDriverVar_Types type
DriverTarget targets[8]
bActionGroup * grp
eFCurve_Flags flag
eFCurve_Extend extend
eFCurve_Smoothing auto_smoothing
uint16_t local_view_bits
struct FCurve * prev
struct FCurve * next
ListBaseT< FModifier > modifiers
ChannelDriver * driver
bke::FCurveRuntime * runtime
eFCurve_Coloring color_mode
unsigned int totvert
eFMod_Cycling_Modes after_mode
eFMod_Cycling_Modes before_mode
FCM_EnvelopeData * data
eFMod_Generator_Functions type
eFMod_Generator_Modes mode
eFMod_Generator_Flags flag
eFMod_Limit_Flags flag
eFMod_Noise_Modifications modification
eFMod_Stepped_Flags flag
struct FModifier * prev
eFModifier_Flags flag
struct FModifier * next
eFModifier_Types type
struct FCurve * curve
eKSP_Grouping groupmode
eInsertKeyFlags keyingflag
struct KS_Path * next
struct KS_Path * prev
eInsertKeyFlags keyingoverride
eKSP_Settings flag
struct KeyingSet * next
eInsertKeyFlags keyingoverride
ListBaseT< KS_Path > paths
struct KeyingSet * prev
eInsertKeyFlags keyingflag
struct NlaStrip * next
NlaStripRuntime * runtime
eNlaStrip_Blend_Mode blendmode
char last_slot_identifier[258]
ListBaseT< FCurve > fcurves
ListBaseT< FModifier > modifiers
eNlaStrip_Extrapolate_Mode extendmode
struct NlaStrip * orig_strip
eNlaStrip_Flag flag
ListBaseT< NlaStrip > strips
eNlaStrip_Type type
struct NlaStrip * prev
struct NlaTrack * prev
eNlaTrack_Flag flag
ListBaseT< NlaStrip > strips
struct NlaTrack * next