Blender  V3.3
nla_private.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2009 Blender Foundation, Joshua Leung. All rights reserved. */
3 
8 #pragma once
9 
10 #include "BLI_bitmap.h"
11 #include "BLI_ghash.h"
12 #include "RNA_types.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
19 
20 /* --------------- NLA Evaluation DataTypes ----------------------- */
21 
22 /* used for list of strips to accumulate at current time */
23 typedef struct NlaEvalStrip {
24  struct NlaEvalStrip *next, *prev;
25 
26  NlaTrack *track; /* Track that this strip belongs to. */
27  NlaStrip *strip; /* Strip that's being used. */
28 
29  short track_index; /* The index of the track within the list. */
30  short strip_mode; /* Which end of the strip are we looking at. */
31 
32  float strip_time; /* Time at which this strip is being evaluated. */
34 
35 /* NlaEvalStrip->strip_mode */
37  /* standard evaluation */
41 
42  /* transition-strip evaluations */
45 };
46 
47 struct NlaEvalChannel;
48 struct NlaEvalData;
49 
50 /* Unique channel key for GHash. */
51 typedef struct NlaEvalChannelKey {
52  struct PointerRNA ptr;
53  struct PropertyRNA *prop;
55 
56 /* Bitmask of array indices touched by actions. */
57 typedef struct NlaValidMask {
59  BLI_bitmap buffer[sizeof(uint64_t) / sizeof(BLI_bitmap)];
61 
62 /* Set of property values for blending. */
63 typedef struct NlaEvalChannelSnapshot {
65 
68 
72 
73  int length; /* Number of values in the property. */
74  bool is_base; /* Base snapshot of the channel. */
75 
76  float values[]; /* Item values. */
77  /* Memory over-allocated to provide space for values. */
79 
80 /* NlaEvalChannel->mix_mode */
86 };
87 
88 /* Temp channel for accumulating data from NLA for a single property.
89  * Handles array properties as a unit to allow intelligent blending. */
90 typedef struct NlaEvalChannel {
92  struct NlaEvalData *owner;
93 
94  /* Original RNA path string and property key. */
95  const char *rna_path;
97 
98  int index;
99  bool is_array;
100  char mix_mode;
101 
102  /* Associated with the RNA property's value(s), marks which elements are affected by NLA. */
104 
105  /* Base set of values. */
107  /* Memory over-allocated to provide space for base_snapshot.values. */
109 
110 /* Set of values for all channels. */
111 typedef struct NlaEvalSnapshot {
112  /* Snapshot this one defaults to. */
114 
115  int size;
118 
119 /* Set of all channels covered by NLA. */
120 typedef struct NlaEvalData {
122 
123  /* Mapping of paths and NlaEvalChannelKeys to channels. */
126 
127  /* Base snapshot. */
130 
131  /* Evaluation result shapshot. */
134 
135 /* Information about the currently edited strip and ones below it for keyframing. */
136 typedef struct NlaKeyframingContext {
138 
139  /* AnimData for which this context was built. */
140  struct AnimData *adt;
141 
142  /* Data of the currently edited strip (copy, or fake strip for the main action). */
145  /* Storage for the action track as a strip. */
147 
148  /* Strips above tweaked strip. */
150  /* Evaluated NLA stack below the tweak strip. */
153 
154 /* --------------- NLA Functions (not to be used as a proper API) ----------------------- */
155 
163 float nlastrip_get_frame(NlaStrip *strip, float cframe, short mode);
164 
165 /* --------------- NLA Evaluation (very-private stuff) ----------------------- */
166 /* these functions are only defined here to avoid problems with the order
167  * in which they get defined. */
168 
173  ListBase *strips,
174  short index,
175  const struct AnimationEvalContext *anim_eval_context,
176  bool flush_to_original);
182  /* Blend upper strip with lower stack. */
184  /* Given upper strip and blended snapshot, solve for lower stack. */
186  /* Store strip fcurve values in snapshot, properly marking blend_domain values.
187  *
188  * Currently only used for transitions to distinguish fcurve sampled values from default or lower
189  * stack values.
190  */
192 };
193 
194 void nlastrip_evaluate(const int evaluation_mode,
195  PointerRNA *ptr,
197  ListBase *modifiers,
198  NlaEvalStrip *nes,
199  NlaEvalSnapshot *snapshot,
200  const struct AnimationEvalContext *anim_eval_context,
201  bool flush_to_original);
207  NlaEvalSnapshot *snapshot,
208  bool flush_to_original);
209 
211 
212 void nlasnapshot_ensure_channels(NlaEvalData *eval_data, NlaEvalSnapshot *snapshot);
213 
222 void nlasnapshot_blend(NlaEvalData *eval_data,
223  NlaEvalSnapshot *lower_snapshot,
224  NlaEvalSnapshot *upper_snapshot,
225  short upper_blendmode,
226  float upper_influence,
227  NlaEvalSnapshot *r_blended_snapshot);
228 
238  NlaEvalSnapshot *lower_snapshot,
239  NlaEvalSnapshot *blended_snapshot,
240  short upper_blendmode,
241  float upper_influence,
242  NlaEvalSnapshot *r_upper_snapshot);
243 
245  NlaEvalSnapshot *blended_snapshot,
246  NlaEvalSnapshot *upper_snapshot,
247  const short upper_blendmode,
248  const float upper_influence,
249  NlaEvalSnapshot *r_lower_snapshot);
250 
253  ListBase *modifiers,
254  NlaEvalStrip *nes,
255  NlaEvalSnapshot *snapshot,
256  const struct AnimationEvalContext *anim_eval_context,
257  const bool flush_to_original);
258 
260  PointerRNA *ptr,
262  ListBase *modifiers,
263  NlaEvalStrip *nes,
264  NlaEvalSnapshot *snapshot,
265  const struct AnimationEvalContext *anim_eval_context);
266 
269  ListBase *modifiers,
270  NlaEvalStrip *nes,
271  NlaEvalSnapshot *snapshot,
272  const struct AnimationEvalContext *anim_eval_context);
273 
274 #ifdef __cplusplus
275 }
276 #endif
unsigned int BLI_bitmap
Definition: BLI_bitmap.h:16
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a producing a negative Combine Generate a color from its and blue channels(Deprecated)") DefNode(ShaderNode
float nlastrip_get_frame(NlaStrip *strip, float cframe, short mode)
Definition: nla.c:628
struct NlaKeyframingContext NlaKeyframingContext
eNlaStripEvaluate_Mode
Definition: nla_private.h:181
@ STRIP_EVAL_NOBLEND
Definition: nla_private.h:191
@ STRIP_EVAL_BLEND_GET_INVERTED_LOWER_SNAPSHOT
Definition: nla_private.h:185
@ STRIP_EVAL_BLEND
Definition: nla_private.h:183
void nlasnapshot_enable_all_blend_domain(NlaEvalSnapshot *snapshot)
Definition: anim_sys.c:3591
NlaEvalStrip * nlastrips_ctime_get_strip(ListBase *list, ListBase *strips, short index, const struct AnimationEvalContext *anim_eval_context, bool flush_to_original)
struct NlaEvalChannelSnapshot NlaEvalChannelSnapshot
struct NlaEvalData NlaEvalData
void nlasnapshot_ensure_channels(NlaEvalData *eval_data, NlaEvalSnapshot *snapshot)
Definition: anim_sys.c:3603
void nlasnapshot_blend_strip_get_inverted_lower_snapshot(PointerRNA *ptr, NlaEvalData *channels, ListBase *modifiers, NlaEvalStrip *nes, NlaEvalSnapshot *snapshot, const struct AnimationEvalContext *anim_eval_context)
Definition: anim_sys.c:3016
void nlasnapshot_blend(NlaEvalData *eval_data, NlaEvalSnapshot *lower_snapshot, NlaEvalSnapshot *upper_snapshot, short upper_blendmode, float upper_influence, NlaEvalSnapshot *r_blended_snapshot)
Definition: anim_sys.c:3610
void nlastrip_evaluate(const int evaluation_mode, PointerRNA *ptr, NlaEvalData *channels, ListBase *modifiers, NlaEvalStrip *nes, NlaEvalSnapshot *snapshot, const struct AnimationEvalContext *anim_eval_context, bool flush_to_original)
struct NlaEvalChannelKey NlaEvalChannelKey
struct NlaEvalStrip NlaEvalStrip
struct NlaValidMask NlaValidMask
eNlaEvalChannel_MixMode
Definition: nla_private.h:81
@ NEC_MIX_AXIS_ANGLE
Definition: nla_private.h:85
@ NEC_MIX_ADD
Definition: nla_private.h:82
@ NEC_MIX_MULTIPLY
Definition: nla_private.h:83
@ NEC_MIX_QUATERNION
Definition: nla_private.h:84
eNlaEvalStrip_StripMode
Definition: nla_private.h:36
@ NES_TIME_TRANSITION_END
Definition: nla_private.h:44
@ NES_TIME_TRANSITION_START
Definition: nla_private.h:43
@ NES_TIME_AFTER
Definition: nla_private.h:40
@ NES_TIME_BEFORE
Definition: nla_private.h:38
@ NES_TIME_WITHIN
Definition: nla_private.h:39
struct NlaEvalSnapshot NlaEvalSnapshot
void nlasnapshot_blend_get_inverted_lower_snapshot(NlaEvalData *eval_data, NlaEvalSnapshot *blended_snapshot, NlaEvalSnapshot *upper_snapshot, const short upper_blendmode, const float upper_influence, NlaEvalSnapshot *r_lower_snapshot)
Definition: anim_sys.c:3675
struct NlaEvalChannel NlaEvalChannel
void nladata_flush_channels(PointerRNA *ptr, NlaEvalData *channels, NlaEvalSnapshot *snapshot, bool flush_to_original)
Definition: anim_sys.c:3045
void nlasnapshot_blend_get_inverted_upper_snapshot(NlaEvalData *eval_data, NlaEvalSnapshot *lower_snapshot, NlaEvalSnapshot *blended_snapshot, short upper_blendmode, float upper_influence, NlaEvalSnapshot *r_upper_snapshot)
Definition: anim_sys.c:3637
void nlasnapshot_blend_strip_no_blend(PointerRNA *ptr, NlaEvalData *channels, ListBase *modifiers, NlaEvalStrip *nes, NlaEvalSnapshot *snapshot, const struct AnimationEvalContext *anim_eval_context)
Definition: anim_sys.c:3034
void nlasnapshot_blend_strip(PointerRNA *ptr, NlaEvalData *channels, ListBase *modifiers, NlaEvalStrip *nes, NlaEvalSnapshot *snapshot, const struct AnimationEvalContext *anim_eval_context, const bool flush_to_original)
Definition: anim_sys.c:2998
unsigned __int64 uint64_t
Definition: stdint.h:90
struct PropertyRNA * prop
Definition: nla_private.h:53
struct PointerRNA ptr
Definition: nla_private.h:52
NlaValidMask remap_domain
Definition: nla_private.h:71
NlaValidMask blend_domain
Definition: nla_private.h:67
struct NlaEvalChannel * channel
Definition: nla_private.h:64
struct NlaEvalData * owner
Definition: nla_private.h:92
struct NlaEvalChannel * next
Definition: nla_private.h:91
NlaEvalChannelSnapshot base_snapshot
Definition: nla_private.h:106
const char * rna_path
Definition: nla_private.h:95
NlaEvalChannelKey key
Definition: nla_private.h:96
struct NlaEvalChannel * prev
Definition: nla_private.h:91
NlaValidMask domain
Definition: nla_private.h:103
NlaEvalSnapshot eval_snapshot
Definition: nla_private.h:132
GHash * path_hash
Definition: nla_private.h:124
NlaEvalSnapshot base_snapshot
Definition: nla_private.h:129
ListBase channels
Definition: nla_private.h:121
GHash * key_hash
Definition: nla_private.h:125
int num_channels
Definition: nla_private.h:128
struct NlaEvalSnapshot * base
Definition: nla_private.h:113
NlaEvalChannelSnapshot ** channels
Definition: nla_private.h:116
struct NlaEvalStrip * next
Definition: nla_private.h:24
NlaStrip * strip
Definition: nla_private.h:27
short track_index
Definition: nla_private.h:29
NlaTrack * track
Definition: nla_private.h:26
short strip_mode
Definition: nla_private.h:30
float strip_time
Definition: nla_private.h:32
struct NlaEvalStrip * prev
Definition: nla_private.h:24
NlaStrip action_track_strip
Definition: nla_private.h:146
struct NlaKeyframingContext * next
Definition: nla_private.h:137
struct AnimData * adt
Definition: nla_private.h:140
NlaEvalData lower_eval_data
Definition: nla_private.h:151
struct NlaKeyframingContext * prev
Definition: nla_private.h:137
NlaEvalStrip * eval_strip
Definition: nla_private.h:144
BLI_bitmap * ptr
Definition: nla_private.h:58
BLI_bitmap buffer[sizeof(uint64_t)/sizeof(BLI_bitmap)]
Definition: nla_private.h:59
PointerRNA * ptr
Definition: wm_files.c:3480