Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2018-12-15 16:09:27 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2019-01-05 10:52:43 +0300
commit57d4b869be387767be51fe1f9d819904c342d692 (patch)
treec065219056d1575e69292d9bc997856ab92dc530 /source/blender/blenkernel/nla_private.h
parenta77b63c56943ebd0046f738e6abbea4c85dc65b6 (diff)
NLA: rewrite evaluation channel data structures.
Implementing a new intelligent mixing mode that combines quaternions via multiplication requires rewriting the NLA code to recombine array properties from separate scalar channels during evaluation. In addition, stable evaluation of NLA stack requires that any channel that is touched by any of the actions in the stack should always be set to a definite value by evaluation, even if no strip affects it at this point of the timeline. The obvious choice for the fallback is the default value of the property. To make scanning all actions reasonably efficient, mapping paths to channels should be done using hash tables. Differential Revision: https://developer.blender.org/D4120
Diffstat (limited to 'source/blender/blenkernel/nla_private.h')
-rw-r--r--source/blender/blenkernel/nla_private.h79
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__ */