diff options
Diffstat (limited to 'source/blender/blenkernel/nla_private.h')
-rw-r--r-- | source/blender/blenkernel/nla_private.h | 79 |
1 files changed, 69 insertions, 10 deletions
diff --git a/source/blender/blenkernel/nla_private.h b/source/blender/blenkernel/nla_private.h index 0ab48b5ef2c..d995eb5dd39 100644 --- a/source/blender/blenkernel/nla_private.h +++ b/source/blender/blenkernel/nla_private.h @@ -36,6 +36,8 @@ struct Depsgraph; #include "RNA_types.h" +#include "BLI_bitmap.h" +#include "BLI_ghash.h" /* --------------- NLA Evaluation DataTypes ----------------------- */ @@ -64,21 +66,78 @@ enum eNlaEvalStrip_StripMode { NES_TIME_TRANSITION_END, }; +struct NlaEvalChannel; +struct NlaEvalData; -/* temp channel for accumulating data from NLA (avoids needing to clear all values first) */ -// TODO: maybe this will be used as the 'cache' stuff needed for editable values too? +/* Unique channel key for GHash. */ +typedef struct NlaEvalChannelKey { + struct PointerRNA ptr; + struct PropertyRNA *prop; +} NlaEvalChannelKey; + +/* Bitmask of array indices touched by actions. */ +typedef struct NlaValidMask { + BLI_bitmap *ptr; + BLI_bitmap buffer[sizeof(uint64_t) / sizeof(BLI_bitmap)]; +} NlaValidMask; + +/* Set of property values for blending. */ +typedef struct NlaEvalChannelSnapshot { + struct NlaEvalChannel *channel; + + int length; /* Number of values in the property. */ + bool is_base; /* Base snapshot of the channel. */ + + float values[]; /* Item values. */ + /* Memory over-allocated to provide space for values. */ +} NlaEvalChannelSnapshot; + +/* Temp channel for accumulating data from NLA for a single property. + * Handles array properties as a unit to allow intelligent blending. */ typedef struct NlaEvalChannel { struct NlaEvalChannel *next, *prev; + struct NlaEvalData *owner; - /* RNA reference to use with pointer and index */ - PathResolvedRNA rna; - - /* Original parameters used to look up the reference for write_orig_anim_rna */ + /* Original RNA path string and property key. */ const char *rna_path; + NlaEvalChannelKey key; + + int index; + bool is_array; - float value; /* value of this channel */ + /* Mask of array items controlled by NLA. */ + NlaValidMask valid; + + /* Base set of values. */ + NlaEvalChannelSnapshot base_snapshot; + /* Memory over-allocated to provide space for base_snapshot.values. */ } NlaEvalChannel; +/* Set of values for all channels. */ +typedef struct NlaEvalSnapshot { + /* Snapshot this one defaults to. */ + struct NlaEvalSnapshot *base; + + int size; + NlaEvalChannelSnapshot **channels; +} NlaEvalSnapshot; + +/* Set of all channels covered by NLA. */ +typedef struct NlaEvalData { + ListBase channels; + + /* Mapping of paths and NlaEvalChannelKeys to channels. */ + GHash *path_hash; + GHash *key_hash; + + /* Base snapshot. */ + int num_channels; + NlaEvalSnapshot base_snapshot; + + /* Evaluation result shapshot. */ + NlaEvalSnapshot eval_snapshot; +} NlaEvalData; + /* Information about the currently edited strip and ones below it for keyframing. */ typedef struct NlaKeyframingContext { struct NlaKeyframingContext *next, *prev; @@ -91,7 +150,7 @@ typedef struct NlaKeyframingContext { NlaEvalStrip *eval_strip; /* Evaluated NLA stack below the current strip. */ - ListBase nla_channels; + NlaEvalData nla_channels; } NlaKeyframingContext; /* --------------- NLA Functions (not to be used as a proper API) ----------------------- */ @@ -103,7 +162,7 @@ float nlastrip_get_frame(NlaStrip *strip, float cframe, short mode); /* these functions are only defined here to avoid problems with the order in which they get defined... */ NlaEvalStrip *nlastrips_ctime_get_strip(struct Depsgraph *depsgraph, ListBase *list, ListBase *strips, short index, float ctime); -void nlastrip_evaluate(struct Depsgraph *depsgraph, PointerRNA *ptr, ListBase *channels, ListBase *modifiers, NlaEvalStrip *nes); -void nladata_flush_channels(struct Depsgraph *depsgraph, PointerRNA *ptr, ListBase *channels); +void nlastrip_evaluate(struct Depsgraph *depsgraph, PointerRNA *ptr, NlaEvalData *channels, ListBase *modifiers, NlaEvalStrip *nes, NlaEvalSnapshot *snapshot); +void nladata_flush_channels(struct Depsgraph *depsgraph, PointerRNA *ptr, NlaEvalData *channels, NlaEvalSnapshot *snapshot); #endif /* __NLA_PRIVATE_H__ */ |