[Bf-blender-cvs] [32ae05b] soc-2014-shapekey: Modifications to key DNA and RNA to have initial types for scratch and mix switching
Grigory Revzin
noreply at git.blender.org
Fri May 16 02:02:35 CEST 2014
Commit: 32ae05b96c19b065424e27b5dd255fa8b90e8080
Author: Grigory Revzin
Date: Wed May 7 22:50:49 2014 +0400
https://developer.blender.org/rB32ae05b96c19b065424e27b5dd255fa8b90e8080
Modifications to key DNA and RNA to have initial types for scratch and mix switching
===================================================================
M source/blender/makesdna/DNA_key_types.h
M source/blender/makesrna/intern/rna_key.c
===================================================================
diff --git a/source/blender/makesdna/DNA_key_types.h b/source/blender/makesdna/DNA_key_types.h
index f5ce3c8..86efdbe 100644
--- a/source/blender/makesdna/DNA_key_types.h
+++ b/source/blender/makesdna/DNA_key_types.h
@@ -62,13 +62,24 @@ typedef struct KeyBlock {
void *data; /* array of shape key values, size is (Key->elemsize * KeyBlock->totelem) */
char name[64]; /* MAX_NAME (unique name, user assigned) */
char vgroup[64]; /* MAX_VGROUP_NAME (optional vertex group), array gets allocated into 'weights' when set */
+
+ float mixval; /* animation-independent mix influence (Key->type == KEY_RELATIVE only) */
/* ranges, for RNA and UI only to clamp 'curval' */
float slidermin;
float slidermax;
+ char pad[4];
} KeyBlock;
+#
+#
+typedef struct ScratchKeyBlock {
+ /* array of values, size Key->elemsize * KeyBlock->totelem */
+ void *data;
+ /* where this scratch has come from, all other setting are read from there */
+ KeyBlock *origin;
+} ScratchKeyBlock;
typedef struct Key {
ID id;
@@ -78,13 +89,18 @@ typedef struct Key {
* Looks like this is _always_ 'key->block.first',
* perhaps later on it could be defined as some other KeyBlock - campbell */
KeyBlock *refkey;
+
+ /* Runtime KeyBlock where the 'real' data editing happens. Gets committed to its origin. */
+ ScratchKeyBlock *scratch;
/* this is not a regular string, although it is \0 terminated
* this is an array of (element_array_size, element_type) pairs
* (each one char) used for calculating shape key-blocks */
char elemstr[32];
int elemsize; /* size of each element in #KeyBlock.data, use for allocation and stride */
- int pad;
+ short pad;
+ short mix_mode; /* Key->type == KEY_RELATIVE only; defines whether the mix will be from the animation or
+ * from the temporary user values */
ListBase block; /* list of KeyBlock's */
struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */
@@ -115,6 +131,12 @@ enum {
KEY_RELATIVE = 1
};
+/* Key->mix_mode */
+enum {
+ KEY_MIX_FROM_ANIMDATA = 0,
+ KEY_MIX_FROM_TEMPVALUES = 1
+};
+
/* Key->flag */
enum {
KEY_DS_EXPAND = 1
diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c
index fe1e723..ebac8b4 100644
--- a/source/blender/makesrna/intern/rna_key.c
+++ b/source/blender/makesrna/intern/rna_key.c
@@ -665,6 +665,13 @@ static void rna_def_key(BlenderRNA *brna)
"otherwise play through shapes as a sequence using the evaluation time");
RNA_def_property_update(prop, 0, "rna_Key_update_data");
+ prop = RNA_def_property(srna, "mix_from_animation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mix_mode", KEY_MIX_FROM_TEMPVALUES);
+ RNA_def_property_ui_text(prop, "Mix From Animation", "Make animation curves define the shape mix, "
+ "or use an animation-independent mix");
+ RNA_def_property_update(prop, 0, "rna_Key_update_data");
+
+
prop = RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "ctime");
RNA_def_property_range(prop, MINFRAME, MAXFRAME);
More information about the Bf-blender-cvs
mailing list