1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
|
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
*
* Contributor(s): Joshua Leung (full recode)
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file DNA_anim_types.h
* \ingroup DNA
*/
#ifndef __DNA_ANIM_TYPES_H__
#define __DNA_ANIM_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "DNA_ID.h"
#include "DNA_listBase.h"
#include "DNA_action_types.h"
#include "DNA_curve_types.h"
/* ************************************************ */
/* F-Curve DataTypes */
/* Modifiers -------------------------------------- */
/**
* F-Curve Modifiers (fcm)
*
* These alter the way F-Curves behave, by altering the value that is returned
* when evaluating the curve's data at some time (t).
*/
typedef struct FModifier {
struct FModifier *next, *prev;
/** Containing curve, only used for updates to CYCLES. */
struct FCurve *curve;
/** Pointer to modifier data. */
void *data;
/** User-defined description for the modifier - MAX_ID_NAME-2. */
char name[64];
/** Type of f-curve modifier. */
short type;
/** Settings for the modifier. */
short flag;
/** The amount that the modifier should influence the value. */
float influence;
/** Start frame of restricted frame-range. */
float sfra;
/** End frame of restricted frame-range. */
float efra;
/** Number of frames from sfra before modifier takes full influence. */
float blendin;
/** Number of frames from efra before modifier fades out. */
float blendout;
} FModifier;
/**
* Types of F-Curve modifier
* WARNING: order here is important!
*/
typedef enum eFModifier_Types {
FMODIFIER_TYPE_NULL = 0,
FMODIFIER_TYPE_GENERATOR = 1,
FMODIFIER_TYPE_FN_GENERATOR = 2,
FMODIFIER_TYPE_ENVELOPE = 3,
FMODIFIER_TYPE_CYCLES = 4,
FMODIFIER_TYPE_NOISE = 5,
FMODIFIER_TYPE_FILTER = 6, /* unimplemented - for applying: fft, high/low pass filters, etc. */
FMODIFIER_TYPE_PYTHON = 7,
FMODIFIER_TYPE_LIMITS = 8,
FMODIFIER_TYPE_STEPPED = 9,
/* NOTE: all new modifiers must be added above this line */
FMODIFIER_NUM_TYPES
} eFModifier_Types;
/* F-Curve Modifier Settings */
typedef enum eFModifier_Flags {
/* modifier is not able to be evaluated for some reason, and should be skipped (internal) */
FMODIFIER_FLAG_DISABLED = (1<<0),
/* modifier's data is expanded (in UI) */
FMODIFIER_FLAG_EXPANDED = (1<<1),
/* modifier is active one (in UI) for editing purposes */
FMODIFIER_FLAG_ACTIVE = (1<<2),
/* user wants modifier to be skipped */
FMODIFIER_FLAG_MUTED = (1<<3),
/* restrict range that F-Modifier can be considered over */
FMODIFIER_FLAG_RANGERESTRICT = (1<<4),
/* use influence control */
FMODIFIER_FLAG_USEINFLUENCE = (1<<5)
} eFModifier_Flags;
/* --- */
/* Generator modifier data */
typedef struct FMod_Generator {
/* general generator information */
/** Coefficients array. */
float *coefficients;
/** Size of the coefficients array. */
unsigned int arraysize;
/** Order of polynomial generated (i.e. 1 for linear, 2 for quadratic). */
int poly_order;
/** Which 'generator' to use eFMod_Generator_Modes. */
int mode;
/* settings */
/** Settings. */
int flag;
} FMod_Generator;
/* generator modes */
typedef enum eFMod_Generator_Modes {
FCM_GENERATOR_POLYNOMIAL = 0,
FCM_GENERATOR_POLYNOMIAL_FACTORISED = 1
} eFMod_Generator_Modes;
/* generator flags
* - shared by Generator and Function Generator
*/
typedef enum eFMod_Generator_Flags {
/* generator works in conjunction with other modifiers (i.e. doesn't replace those before it) */
FCM_GENERATOR_ADDITIVE = (1<<0)
} eFMod_Generator_Flags;
/**
* 'Built-In Function' Generator modifier data
*
* This uses the general equation for equations:
* y = amplitude * fn(phase_multiplier*x + phase_offset) + y_offset
*
* where amplitude, phase_multiplier/offset, y_offset are user-defined coefficients,
* x is the evaluation 'time', and 'y' is the resultant value
*/
typedef struct FMod_FunctionGenerator {
/** Coefficients for general equation (as above). */
float amplitude;
float phase_multiplier;
float phase_offset;
float value_offset;
/* flags */
/** #eFMod_Generator_Functions. */
int type;
/** #eFMod_Generator_flags. */
int flag;
} FMod_FunctionGenerator;
/* 'function' generator types */
typedef enum eFMod_Generator_Functions {
FCM_GENERATOR_FN_SIN = 0,
FCM_GENERATOR_FN_COS = 1,
FCM_GENERATOR_FN_TAN = 2,
FCM_GENERATOR_FN_SQRT = 3,
FCM_GENERATOR_FN_LN = 4,
FCM_GENERATOR_FN_SINC = 5
} eFMod_Generator_Functions;
/* envelope modifier - envelope data */
typedef struct FCM_EnvelopeData {
/** Min/max values for envelope at this point (absolute values) . */
float min, max;
/** Time for that this sample-point occurs. */
float time;
/** Settings for 'min' control point. */
short f1;
/** Settings for 'max' control point. */
short f2;
} FCM_EnvelopeData;
/* envelope-like adjustment to values (for fade in/out) */
typedef struct FMod_Envelope {
/** Data-points defining envelope to apply (array) . */
FCM_EnvelopeData *data;
/** Number of envelope points. */
int totvert;
/** Value that envelope's influence is centered around / based on. */
float midval;
/** Distances from 'middle-value' for 1:1 envelope influence. */
float min, max;
} FMod_Envelope;
/* cycling/repetition modifier data */
// TODO: we can only do complete cycles...
typedef struct FMod_Cycles {
/** Extrapolation mode to use before first keyframe. */
short before_mode;
/** Extrapolation mode to use after last keyframe. */
short after_mode;
/** Number of 'cycles' before first keyframe to do. */
short before_cycles;
/** Number of 'cycles' after last keyframe to do. */
short after_cycles;
} FMod_Cycles;
/* cycling modes */
typedef enum eFMod_Cycling_Modes {
FCM_EXTRAPOLATE_NONE = 0, /* don't do anything */
FCM_EXTRAPOLATE_CYCLIC, /* repeat keyframe range as-is */
FCM_EXTRAPOLATE_CYCLIC_OFFSET, /* repeat keyframe range, but with offset based on gradient between values */
FCM_EXTRAPOLATE_MIRROR /* alternate between forward and reverse playback of keyframe range */
} eFMod_Cycling_Modes;
/* Python-script modifier data */
typedef struct FMod_Python {
/** Text buffer containing script to execute. */
struct Text *script;
/** ID-properties to provide 'custom' settings. */
IDProperty *prop;
} FMod_Python;
/* limits modifier data */
typedef struct FMod_Limits {
/** Rect defining the min/max values. */
rctf rect;
/** Settings for limiting. */
int flag;
int pad;
} FMod_Limits;
/* limiting flags */
typedef enum eFMod_Limit_Flags {
FCM_LIMIT_XMIN = (1<<0),
FCM_LIMIT_XMAX = (1<<1),
FCM_LIMIT_YMIN = (1<<2),
FCM_LIMIT_YMAX = (1<<3)
} eFMod_Limit_Flags;
/* noise modifier data */
typedef struct FMod_Noise {
float size;
float strength;
float phase;
float offset;
short depth;
short modification;
} FMod_Noise;
/* modification modes */
typedef enum eFMod_Noise_Modifications {
FCM_NOISE_MODIF_REPLACE = 0, /* Modify existing curve, matching it's shape */
FCM_NOISE_MODIF_ADD, /* Add noise to the curve */
FCM_NOISE_MODIF_SUBTRACT, /* Subtract noise from the curve */
FCM_NOISE_MODIF_MULTIPLY /* Multiply the curve by noise */
} eFMod_Noise_Modifications;
/* stepped modifier data */
typedef struct FMod_Stepped {
/** Number of frames each interpolated value should be held. */
float step_size;
/** Reference frame number that stepping starts from. */
float offset;
/** Start frame of the frame range that modifier works in. */
float start_frame;
/** End frame of the frame range that modifier works in. */
float end_frame;
/** Various settings. */
int flag;
} FMod_Stepped;
/* stepped modifier range flags */
typedef enum eFMod_Stepped_Flags {
FCM_STEPPED_NO_BEFORE = (1<<0), /* don't affect frames before the start frame */
FCM_STEPPED_NO_AFTER = (1<<1), /* don't affect frames after the end frame */
} eFMod_Stepped_Flags;
/* Drivers -------------------------------------- */
/* Driver Target (dtar)
*
* Defines how to access a dependency needed for a driver variable.
*/
typedef struct DriverTarget {
/** ID-block which owns the target, no user count. */
ID *id;
/** RNA path defining the setting to use (for DVAR_TYPE_SINGLE_PROP). */
char *rna_path;
/**
* Name of the posebone to use
* (for vars where DTAR_FLAG_STRUCT_REF is used) - MAX_ID_NAME-2.
*/
char pchan_name[64];
/** Transform channel index (for DVAR_TYPE_TRANSFORM_CHAN.)*/
short transChan;
/**
* Flags for the validity of the target
* (NOTE: these get reset every time the types change).
*/
short flag;
/** Type of ID-block that this target can use. */
int idtype;
} DriverTarget;
/* Driver Target flags */
typedef enum eDriverTarget_Flag {
/* used for targets that use the pchan_name instead of RNA path
* (i.e. rotation difference)
*/
DTAR_FLAG_STRUCT_REF = (1 << 0),
/* idtype can only be 'Object' */
DTAR_FLAG_ID_OB_ONLY = (1 << 1),
/* "localspace" flags */
/* base flag - basically "pre parent+constraints" */
DTAR_FLAG_LOCALSPACE = (1 << 2),
/* include constraints transformed to space including parents */
DTAR_FLAG_LOCAL_CONSTS = (1 << 3),
/* error flags */
DTAR_FLAG_INVALID = (1 << 4),
} eDriverTarget_Flag;
/* Transform Channels for Driver Targets */
typedef enum eDriverTarget_TransformChannels {
DTAR_TRANSCHAN_LOCX = 0,
DTAR_TRANSCHAN_LOCY,
DTAR_TRANSCHAN_LOCZ,
DTAR_TRANSCHAN_ROTX,
DTAR_TRANSCHAN_ROTY,
DTAR_TRANSCHAN_ROTZ,
DTAR_TRANSCHAN_SCALEX,
DTAR_TRANSCHAN_SCALEY,
DTAR_TRANSCHAN_SCALEZ,
MAX_DTAR_TRANSCHAN_TYPES
} eDriverTarget_TransformChannels;
/* --- */
/* maximum number of driver targets per variable */
#define MAX_DRIVER_TARGETS 8
/* Driver Variable (dvar)
*
* A 'variable' for use as an input for the driver evaluation.
* Defines a way of accessing some channel to use, that can be
* referred to in the expression as a variable, thus simplifying
* expressions and also Depsgraph building.
*/
typedef struct DriverVar {
struct DriverVar *next, *prev;
/**
* Name of the variable to use in py-expression
* (must be valid python identifier) - MAX_ID_NAME-2.
*/
char name[64];
/** MAX_DRIVER_TARGETS, target slots. */
DriverTarget targets[8];
/** Number of targets actually used by this variable. */
char num_targets;
/** Type of driver variable (eDriverVar_Types). */
char type;
/** Validation tags, etc. (eDriverVar_Flags). */
short flag;
/** Result of previous evaluation. */
float curval;
} DriverVar;
/* Driver Variable Types */
typedef enum eDriverVar_Types {
/* single RNA property */
DVAR_TYPE_SINGLE_PROP = 0,
/* rotation difference (between 2 bones) */
DVAR_TYPE_ROT_DIFF,
/* distance between objects/bones */
DVAR_TYPE_LOC_DIFF,
/* 'final' transform for object/bones */
DVAR_TYPE_TRANSFORM_CHAN,
/* maximum number of variable types
* NOTE: this must always be th last item in this list,
* so add new types above this line.
*/
MAX_DVAR_TYPES
} eDriverVar_Types;
/* Driver Variable Flags */
typedef enum eDriverVar_Flags {
/* variable is not set up correctly */
DVAR_FLAG_ERROR = (1 << 0),
/* variable name doesn't pass the validation tests */
DVAR_FLAG_INVALID_NAME = (1 << 1),
/* name starts with a number */
DVAR_FLAG_INVALID_START_NUM = (1 << 2),
/* name starts with a special character (!, $, @, #, _, etc.) */
DVAR_FLAG_INVALID_START_CHAR = (1 << 3),
/* name contains a space */
DVAR_FLAG_INVALID_HAS_SPACE = (1 << 4),
/* name contains a dot */
DVAR_FLAG_INVALID_HAS_DOT = (1 << 5),
/* name contains invalid chars */
DVAR_FLAG_INVALID_HAS_SPECIAL = (1 << 6),
/* name is a reserved keyword */
DVAR_FLAG_INVALID_PY_KEYWORD = (1 << 7),
/* name is zero-length */
DVAR_FLAG_INVALID_EMPTY = (1 << 8),
} eDriverVar_Flags;
/* All invalid dvar name flags */
#define DVAR_ALL_INVALID_FLAGS ( \
DVAR_FLAG_INVALID_NAME | \
DVAR_FLAG_INVALID_START_NUM | \
DVAR_FLAG_INVALID_START_CHAR | \
DVAR_FLAG_INVALID_HAS_SPACE | \
DVAR_FLAG_INVALID_HAS_DOT | \
DVAR_FLAG_INVALID_HAS_SPECIAL | \
DVAR_FLAG_INVALID_PY_KEYWORD | \
DVAR_FLAG_INVALID_EMPTY \
)
/* --- */
/* Channel Driver (i.e. Drivers / Expressions) (driver)
*
* Channel Drivers are part of the dependency system, and are executed in addition to
* normal user-defined animation. They take the animation result of some channel(s), and
* use that (optionally combined with its own F-Curve for modification of results) to define
* the value of some setting semi-procedurally.
*
* Drivers are stored as part of F-Curve data, so that the F-Curve's RNA-path settings (for storing
* what setting the driver will affect). The order in which they are stored defines the order that they're
* evaluated in. This order is set by the Depsgraph's sorting stuff.
*/
typedef struct ChannelDriver {
/** Targets for this driver (i.e. list of DriverVar). */
ListBase variables;
/* python expression to execute (may call functions defined in an accessory file)
* which relates the target 'variables' in some way to yield a single usable value
*/
/** Expression to compile for evaluation. */
char expression[256];
/** PyObject - compiled expression, don't save this. */
void *expr_comp;
/** Compiled simple arithmetic expression. */
struct ExprPyLike_Parsed *expr_simple;
/** Result of previous evaluation. */
float curval;
// XXX to be implemented... this is like the constraint influence setting
/** Influence of driver on result. */
float influence;
/* general settings */
/** Type of driver. */
int type;
/** Settings of driver. */
int flag;
} ChannelDriver;
/* driver type */
typedef enum eDriver_Types {
/* target values are averaged together */
DRIVER_TYPE_AVERAGE = 0,
/* python expression/function relates targets */
DRIVER_TYPE_PYTHON,
/* sum of all values */
DRIVER_TYPE_SUM,
/* smallest value */
DRIVER_TYPE_MIN,
/* largest value */
DRIVER_TYPE_MAX
} eDriver_Types;
/* driver flags */
/* note: (1<<5) is deprecated; was "DRIVER_FLAG_SHOWDEBUG" */
typedef enum eDriver_Flags {
/* driver has invalid settings (internal flag) */
DRIVER_FLAG_INVALID = (1<<0),
/* driver needs recalculation (set by depsgraph) */
DRIVER_FLAG_RECALC = (1<<1),
/* driver does replace value, but overrides (for layering of animation over driver) */
// TODO: this needs to be implemented at some stage or left out...
//DRIVER_FLAG_LAYERING = (1<<2),
/* use when the expression needs to be recompiled */
DRIVER_FLAG_RECOMPILE = (1<<3),
/* the names are cached so they don't need have python unicode versions created each time */
DRIVER_FLAG_RENAMEVAR = (1<<4),
/* include 'self' in the drivers namespace. */
DRIVER_FLAG_USE_SELF = (1<<6),
} eDriver_Flags;
/* F-Curves -------------------------------------- */
/* FPoint (fpt)
*
* This is the bare-minimum data required storing motion samples. Should be more efficient
* than using BPoints, which contain a lot of other unnecessary data...
*/
typedef struct FPoint {
/** Time + value. */
float vec[2];
/** Selection info. */
int flag;
int pad;
} FPoint;
/* 'Function-Curve' - defines values over time for a given setting (fcu) */
typedef struct FCurve {
struct FCurve *next, *prev;
/* group */
/** Group that F-Curve belongs to. */
bActionGroup *grp;
/* driver settings */
/** Only valid for drivers (i.e. stored in AnimData not Actions). */
ChannelDriver *driver;
/* evaluation settings */
/** FCurve Modifiers. */
ListBase modifiers;
/* motion data */
/** User-editable keyframes (array). */
BezTriple *bezt;
/** 'baked/imported' motion samples (array). */
FPoint *fpt;
/** Total number of points which define the curve (i.e. size of arrays in FPoints). */
unsigned int totvert;
/* value cache + settings */
/** Value stored from last time curve was evaluated (not threadsafe, debug display only!). */
float curval;
/* Value which comes from original DNA ddatablock at a time f-curve was evaluated. */
float orig_dna_val;
/** User-editable settings for this curve. */
short flag;
/** Value-extending mode for this curve (does not cover). */
short extend;
/** Auto-handle smoothing mode. */
char auto_smoothing;
char pad[3];
/* RNA - data link */
/** If applicable, the index of the RNA-array item to get. */
int array_index;
/** RNA-path to resolve data-access. */
char *rna_path;
/* curve coloring (for editor) */
/** Coloring method to use (eFCurve_Coloring). */
int color_mode;
/** The last-color this curve took. */
float color[3];
float prev_norm_factor, prev_offset;
} FCurve;
/* user-editable flags/settings */
typedef enum eFCurve_Flags {
/* curve/keyframes are visible in editor */
FCURVE_VISIBLE = (1<<0),
/* curve is selected for editing */
FCURVE_SELECTED = (1<<1),
/* curve is active one */
FCURVE_ACTIVE = (1<<2),
/* keyframes (beztriples) cannot be edited */
FCURVE_PROTECTED = (1<<3),
/* fcurve will not be evaluated for the next round */
FCURVE_MUTED = (1<<4),
/* fcurve uses 'auto-handles', which stay horizontal... */
// DEPRECATED
FCURVE_AUTO_HANDLES = (1<<5),
FCURVE_MOD_OFF = (1<<6),
/* skip evaluation, as RNA-path cannot be resolved (similar to muting, but cannot be set by user) */
FCURVE_DISABLED = (1<<10),
/* curve can only have whole-number values (integer types) */
FCURVE_INT_VALUES = (1<<11),
/* curve can only have certain discrete-number values (no interpolation at all, for enums/booleans) */
FCURVE_DISCRETE_VALUES = (1<<12),
/* temporary tag for editing */
FCURVE_TAGGED = (1<<15)
} eFCurve_Flags;
/* extrapolation modes (only simple value 'extending') */
typedef enum eFCurve_Extend {
FCURVE_EXTRAPOLATE_CONSTANT = 0, /* just extend min/max keyframe value */
FCURVE_EXTRAPOLATE_LINEAR /* just extend gradient of segment between first segment keyframes */
} eFCurve_Extend;
/* curve coloring modes */
typedef enum eFCurve_Coloring {
FCURVE_COLOR_AUTO_RAINBOW = 0, /* automatically determine color using rainbow (calculated at drawtime) */
FCURVE_COLOR_AUTO_RGB = 1, /* automatically determine color using XYZ (array index) <-> RGB */
FCURVE_COLOR_AUTO_YRGB = 3, /* automatically determine color where XYZ <-> RGB, but index(X) != 0 */
FCURVE_COLOR_CUSTOM = 2, /* custom color */
} eFCurve_Coloring;
/* curve smoothing modes */
typedef enum eFCurve_Smoothing {
FCURVE_SMOOTH_NONE = 0, /* legacy mode: auto handles only consider adjacent points */
FCURVE_SMOOTH_CONT_ACCEL = 1, /* maintain continuity of the acceleration */
} eFCurve_Smoothing;
/* ************************************************ */
/* 'Action' Datatypes */
/* NOTE: Although these are part of the Animation System,
* they are not stored here... see DNA_action_types.h instead
*/
/* ************************************************ */
/* NLA - Non-Linear Animation */
/* NLA Strips ------------------------------------- */
/* NLA Strip (strip)
*
* A NLA Strip is a container for the reuse of Action data, defining parameters
* to control the remapping of the Action data to some destination.
*/
typedef struct NlaStrip {
struct NlaStrip *next, *prev;
/** 'Child' strips (used for 'meta' strips). */
ListBase strips;
/** Action that is referenced by this strip (strip is 'user' of the action). */
bAction *act;
/** F-Curves for controlling this strip's influence and timing */ // TODO: move o.ut?
ListBase fcurves;
/** F-Curve modifiers to be applied to the entire strip's referenced F-Curves. */
ListBase modifiers;
/** User-Visible Identifier for Strip - MAX_ID_NAME-2. */
char name[64];
/** Influence of strip. */
float influence;
/** Current 'time' within action being used (automatically evaluated, but can be overridden). */
float strip_time;
/** Extents of the strip. */
float start, end;
/** Range of the action to use. */
float actstart, actend;
/** The number of times to repeat the action range (only when no F-Curves). */
float repeat;
/** The amount the action range is scaled by (only when no F-Curves). */
float scale;
/** Strip blending length (only used when there are no F-Curves). */
float blendin, blendout;
/** Strip blending mode (layer-based mixing). */
short blendmode;
/** Strip extrapolation mode (time-based mixing). */
short extendmode;
short pad1;
/** Type of NLA strip. */
short type;
/** Handle for speaker objects. */
void *speaker_handle;
/** Settings. */
int flag;
int pad2;
} NlaStrip;
/* NLA Strip Blending Mode */
typedef enum eNlaStrip_Blend_Mode {
NLASTRIP_MODE_REPLACE = 0,
NLASTRIP_MODE_ADD,
NLASTRIP_MODE_SUBTRACT,
NLASTRIP_MODE_MULTIPLY
} eNlaStrip_Blend_Mode;
/* NLA Strip Extrpolation Mode */
typedef enum eNlaStrip_Extrapolate_Mode {
/* extend before first frame if no previous strips in track, and always hold+extend last frame */
NLASTRIP_EXTEND_HOLD = 0,
/* only hold+extend last frame */
NLASTRIP_EXTEND_HOLD_FORWARD = 1,
/* don't contribute at all */
NLASTRIP_EXTEND_NOTHING = 2
} eNlaStrip_Extrapolate_Mode;
/* NLA Strip Settings */
typedef enum eNlaStrip_Flag {
/* UI selection flags */
/* NLA strip is the active one in the track (also indicates if strip is being tweaked) */
NLASTRIP_FLAG_ACTIVE = (1<<0),
/* NLA strip is selected for editing */
NLASTRIP_FLAG_SELECT = (1<<1),
// NLASTRIP_FLAG_SELECT_L = (1<<2), // left handle selected
// NLASTRIP_FLAG_SELECT_R = (1<<3), // right handle selected
/* NLA strip uses the same action that the action being tweaked uses (not set for the twaking one though) */
NLASTRIP_FLAG_TWEAKUSER = (1<<4),
/* controls driven by local F-Curves */
/* strip influence is controlled by local F-Curve */
NLASTRIP_FLAG_USR_INFLUENCE = (1<<5),
NLASTRIP_FLAG_USR_TIME = (1<<6),
NLASTRIP_FLAG_USR_TIME_CYCLIC = (1<<7),
/* NLA strip length is synced to the length of the referenced action */
NLASTRIP_FLAG_SYNC_LENGTH = (1<<9),
/* playback flags (may be overridden by F-Curves) */
/* NLA strip blendin/out values are set automatically based on overlaps */
NLASTRIP_FLAG_AUTO_BLENDS = (1<<10),
/* NLA strip is played back in reverse order */
NLASTRIP_FLAG_REVERSE = (1<<11),
/* NLA strip is muted (i.e. doesn't contribute in any way) */
NLASTRIP_FLAG_MUTED = (1<<12),
/* NLA Strip is played back in 'ping-pong' style */
NLASTRIP_FLAG_MIRROR = (1<<13),
/* temporary editing flags */
/* NLA strip should ignore frame range and hold settings, and evaluate at global time. */
NLASTRIP_FLAG_NO_TIME_MAP = (1<<29),
/* NLA-Strip is really just a temporary meta used to facilitate easier transform code */
NLASTRIP_FLAG_TEMP_META = (1<<30),
NLASTRIP_FLAG_EDIT_TOUCHED = (1u << 31)
} eNlaStrip_Flag;
/* NLA Strip Type */
typedef enum eNlaStrip_Type {
/* 'clip' - references an Action */
NLASTRIP_TYPE_CLIP = 0,
/* 'transition' - blends between the adjacent strips */
NLASTRIP_TYPE_TRANSITION,
/* 'meta' - a strip which acts as a container for a few others */
NLASTRIP_TYPE_META,
/* 'emit sound' - a strip which is used for timing when speaker emits sounds */
NLASTRIP_TYPE_SOUND
} eNlaStrip_Type;
/* NLA Tracks ------------------------------------- */
/* NLA Track (nlt)
*
* A track groups a bunch of 'strips', which should form a continuous set of
* motion, on top of which other such groups can be layered. This should allow
* for animators to work in a non-destructive manner, layering tweaks, etc. over
* 'rough' blocks of their work.
*/
typedef struct NlaTrack {
struct NlaTrack *next, *prev;
/** BActionStrips in this track. */
ListBase strips;
/** Settings for this track. */
int flag;
/** Index of the track in the stack (NOTE: not really useful, but we need a pad var anyways!). */
int index;
/** Short user-description of this track - MAX_ID_NAME-2. */
char name[64];
} NlaTrack;
/* settings for track */
typedef enum eNlaTrack_Flag {
/* track is the one that settings can be modified on, also indicates if track is being 'tweaked' */
NLATRACK_ACTIVE = (1<<0),
/* track is selected in UI for relevant editing operations */
NLATRACK_SELECTED = (1<<1),
/* track is not evaluated */
NLATRACK_MUTED = (1<<2),
/* track is the only one evaluated (must be used in conjunction with adt->flag) */
NLATRACK_SOLO = (1<<3),
/* track's settings (and strips) cannot be edited (to guard against unwanted changes) */
NLATRACK_PROTECTED = (1<<4),
/* track is not allowed to execute, usually as result of tweaking being enabled (internal flag) */
NLATRACK_DISABLED = (1<<10)
} eNlaTrack_Flag;
/* ************************************ */
/* KeyingSet Datatypes */
/* Path for use in KeyingSet definitions (ksp)
*
* Paths may be either specific (specifying the exact sub-ID
* dynamic data-block - such as PoseChannels - to act upon, ala
* Maya's 'Character Sets' and XSI's 'Marking Sets'), or they may
* be generic (using various placeholder template tags that will be
* replaced with appropriate information from the context).
*/
typedef struct KS_Path {
struct KS_Path *next, *prev;
/** ID block that keyframes are for. */
ID *id;
/** Name of the group to add to - MAX_ID_NAME-2. */
char group[64];
/** ID-type that path can be used on. */
int idtype;
/** Group naming (eKSP_Grouping). */
short groupmode;
/** Various settings, etc. */
short flag;
/** Dynamically (or statically in the case of predefined sets) path. */
char *rna_path;
/** Index that path affects. */
int array_index;
/** (eInsertKeyFlags) settings to supply insertkey() with. */
short keyingflag;
/** (eInsertKeyFlags) for each flag set, the relevant keyingflag bit overrides the default. */
short keyingoverride;
} KS_Path;
/* KS_Path->flag */
typedef enum eKSP_Settings {
/* entire array (not just the specified index) gets keyframed */
KSP_FLAG_WHOLE_ARRAY = (1<<0)
} eKSP_Settings;
/* KS_Path->groupmode */
typedef enum eKSP_Grouping {
/* path should be grouped using group name stored in path */
KSP_GROUP_NAMED = 0,
/* path should not be grouped at all */
KSP_GROUP_NONE,
/* path should be grouped using KeyingSet's name */
KSP_GROUP_KSNAME,
/* path should be grouped using name of inner-most context item from templates
* - this is most useful for relative KeyingSets only
*/
KSP_GROUP_TEMPLATE_ITEM
} eKSP_Grouping;
/* ---------------- */
/* KeyingSet definition (ks)
*
* A KeyingSet defines a group of properties that should
* be keyframed together, providing a convenient way for animators
* to insert keyframes without resorting to Auto-Keyframing.
*
* A few 'generic' (non-absolute and dependent on templates) KeyingSets
* are defined 'built-in' to facilitate easy animating for the casual
* animator without the need to add extra steps to the rigging process.
*/
typedef struct KeyingSet {
struct KeyingSet *next, *prev;
/** (KS_Path) paths to keyframe to. */
ListBase paths;
/** Unique name (for search, etc.) - MAX_ID_NAME-2 . */
char idname[64];
/** User-viewable name for KeyingSet (for menus, etc.) - MAX_ID_NAME-2. */
char name[64];
/** (RNA_DYN_DESCR_MAX) short help text. */
char description[240];
/** Name of the typeinfo data used for the relative paths - MAX_ID_NAME-2. */
char typeinfo[64];
/** Index of the active path. */
int active_path;
/** Settings for KeyingSet. */
short flag;
/** (eInsertKeyFlags) settings to supply insertkey() with. */
short keyingflag;
/** (eInsertKeyFlags) for each flag set, the relevant keyingflag bit overrides the default. */
short keyingoverride;
char pad[6];
} KeyingSet;
/* KeyingSet settings */
typedef enum eKS_Settings {
/* keyingset cannot be removed (and doesn't need to be freed) */
KEYINGSET_BUILTIN = (1<<0),
/* keyingset does not depend on context info (i.e. paths are absolute) */
KEYINGSET_ABSOLUTE = (1<<1)
} eKS_Settings;
/* Flags for use by keyframe creation/deletion calls */
typedef enum eInsertKeyFlags {
INSERTKEY_NOFLAGS = 0,
INSERTKEY_NEEDED = (1<<0), /* only insert keyframes where they're needed */
INSERTKEY_MATRIX = (1<<1), /* insert 'visual' keyframes where possible/needed */
INSERTKEY_FAST = (1<<2), /* don't recalculate handles,etc. after adding key */
INSERTKEY_FASTR = (1<<3), /* don't realloc mem (or increase count, as array has already been set out) */
INSERTKEY_REPLACE = (1<<4), /* only replace an existing keyframe (this overrides INSERTKEY_NEEDED) */
INSERTKEY_XYZ2RGB = (1<<5), /* transform F-Curves should have XYZ->RGB color mode */
INSERTKEY_NO_USERPREF = (1<<6), /* ignore user-prefs (needed for predictable API use) */
/* Allow to make a full copy of new key into existing one, if any, instead of 'reusing' existing handles.
* Used by copy/paste code. */
INSERTKEY_OVERWRITE_FULL = (1<<7),
INSERTKEY_DRIVER = (1<<8), /* for driver FCurves, use driver's "input" value - for easier corrective driver setup */
INSERTKEY_CYCLE_AWARE = (1<<9), /* for cyclic FCurves, adjust key timing to preserve the cycle period and flow */
} eInsertKeyFlags;
/* ************************************************ */
/* Animation Data */
/* AnimOverride ------------------------------------- */
/* Animation Override (aor)
*
* This is used to as temporary storage of values which have been changed by the user, but not
* yet keyframed (thus, would get overwritten by the animation system before the user had a chance
* to see the changes that were made).
*
* It is probably not needed for overriding keyframed values in most cases, as those will only get evaluated
* on frame-change now. That situation may change in future.
*/
typedef struct AnimOverride {
struct AnimOverride *next, *prev;
/** RNA-path to use to resolve data-access. */
char *rna_path;
/** If applicable, the index of the RNA-array item to get. */
int array_index;
/** Value to override setting with. */
float value;
} AnimOverride;
/* AnimData ------------------------------------- */
/* Animation data for some ID block (adt)
*
* This block of data is used to provide all of the necessary animation data for a datablock.
* Currently, this data will not be reusable, as there shouldn't be any need to do so.
*
* This information should be made available for most if not all ID-blocks, which should
* enable all of its settings to be animatable locally. Animation from 'higher-up' ID-AnimData
* blocks may override local settings.
*
* This datablock should be placed immediately after the ID block where it is used, so that
* the code which retrieves this data can do so in an easier manner. See blenkernel/intern/anim_sys.c for details.
*/
typedef struct AnimData {
/* active action - acts as the 'tweaking track' for the NLA */
bAction *action;
/* temp-storage for the 'real' active action (i.e. the one used before the tweaking-action
* took over to be edited in the Animation Editors)
*/
bAction *tmpact;
/* nla-tracks */
ListBase nla_tracks;
/**
* Active NLA-track
* (only set/used during tweaking, so no need to worry about dangling pointers).
*/
NlaTrack *act_track;
/**
* Active NLA-strip
* (only set/used during tweaking, so no need to worry about dangling pointers).
*/
NlaStrip *actstrip;
/* 'drivers' for this ID-block's settings - FCurves, but are completely
* separate from those for animation data
*/
/** Standard user-created Drivers/Expressions (used as part of a rig). */
ListBase drivers;
/** Temp storage (AnimOverride) of values for settings that are animated (but the value hasn't been keyframed). */
ListBase overrides;
/** Runtime data, for depsgraph evaluation. */
FCurve **driver_array;
/* settings for animation evaluation */
/** User-defined settings. */
int flag;
/** Depsgraph recalculation flags. */
int recalc;
/* settings for active action evaluation (based on NLA strip settings) */
/** Accumulation mode for active action. */
short act_blendmode;
/** Extrapolation mode for active action. */
short act_extendmode;
/** Influence for active action. */
float act_influence;
} AnimData;
/* Animation Data settings (mostly for NLA) */
typedef enum eAnimData_Flag {
/* only evaluate a single track in the NLA */
ADT_NLA_SOLO_TRACK = (1<<0),
/* don't use NLA */
ADT_NLA_EVAL_OFF = (1<<1),
/* NLA is being 'tweaked' (i.e. in EditMode) */
ADT_NLA_EDIT_ON = (1<<2),
/* active Action for 'tweaking' does not have mapping applied for editing */
ADT_NLA_EDIT_NOMAP = (1<<3),
/* NLA-Strip F-Curves are expanded in UI */
ADT_NLA_SKEYS_COLLAPSED = (1<<4),
/* drivers expanded in UI */
ADT_DRIVERS_COLLAPSED = (1<<10),
/* don't execute drivers */
ADT_DRIVERS_DISABLED = (1<<11),
/* AnimData block is selected in UI */
ADT_UI_SELECTED = (1<<14),
/* AnimData block is active in UI */
ADT_UI_ACTIVE = (1<<15),
/* F-Curves from this AnimData block are not visible in the Graph Editor */
ADT_CURVES_NOT_VISIBLE = (1<<16),
/* F-Curves from this AnimData block are always visible */
ADT_CURVES_ALWAYS_VISIBLE = (1<<17),
} eAnimData_Flag;
/* Animation Data recalculation settings (to be set by depsgraph) */
typedef enum eAnimData_Recalc {
ADT_RECALC_DRIVERS = (1 << 0),
ADT_RECALC_ANIM = (1 << 1),
ADT_RECALC_ALL = (ADT_RECALC_DRIVERS | ADT_RECALC_ANIM)
} eAnimData_Recalc;
/* Base Struct for Anim ------------------------------------- */
/* Used for BKE_animdata_from_id()
* All ID-datablocks which have their own 'local' AnimData
* should have the same arrangement in their structs.
*/
typedef struct IdAdtTemplate {
ID id;
AnimData *adt;
} IdAdtTemplate;
/* ************************************************ */
#ifdef __cplusplus
};
#endif
#endif /* __DNA_ANIM_TYPES_H__ */
|