[Bf-blender-cvs] [68e60b3] soc-2014-shapekey: Fixed key->mix_mode having incorrect values
Grigory Revzin
noreply at git.blender.org
Fri May 30 22:51:42 CEST 2014
Commit: 68e60b3cbbdc6e3396aecab34e9b3bc8b3a8ac6d
Author: Grigory Revzin
Date: Sat May 31 00:48:14 2014 +0400
https://developer.blender.org/rB68e60b3cbbdc6e3396aecab34e9b3bc8b3a8ac6d
Fixed key->mix_mode having incorrect values
The values of mix_mode (KEY_MIX_FROM_ANIMDATA/KEY_MIX_FROM_TEMPVALUES)
were used the wrong way. Also, added a function to access the active value
of the keyblock.
===================================================================
M source/blender/blenkernel/BKE_key.h
M source/blender/blenkernel/intern/key.c
M source/blender/makesdna/DNA_key_types.h
===================================================================
diff --git a/source/blender/blenkernel/BKE_key.h b/source/blender/blenkernel/BKE_key.h
index c70c054..1232907 100644
--- a/source/blender/blenkernel/BKE_key.h
+++ b/source/blender/blenkernel/BKE_key.h
@@ -78,6 +78,9 @@ KeyBlock *BKE_keyblock_find_name(Key *key, const char name[]);
void BKE_keyblock_copy_settings(KeyBlock *kb_dst, const KeyBlock *kb_src);
char *BKE_keyblock_curval_rnapath_get(Key *key, KeyBlock *kb);
+/* returns a pointer to active shape value (mixval/anim-driven val) */
+float *BKE_keyblock_get_active_value(Key *key, KeyBlock *kb);
+
/* ==== scratch keyblock ==== */
/* performs a first-time setup of the scratch. if it's already inited
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 6b0b0b6..ca151f9 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -2073,6 +2073,13 @@ void BKE_key_convert_from_offset(Object *ob, KeyBlock *kb, float (*ofs)[3])
}
}
}
+
+float *BKE_keyblock_get_active_value(Key *key, KeyBlock *kb)
+{
+ return key->mix_mode == KEY_MIX_FROM_ANIMDATA ? &kb->curval : &kb->mixval;
+}
+
+
/* ================== Scratch stuff ====================== */
void BKE_key_init_scratch(Object *ob)
@@ -2188,7 +2195,7 @@ void key_block_mesh_eval_rel(Object *ob, Key *key, KeyBlock *kb, bool use_vgroup
int a;
float *per_vertex_weights = NULL;
- float influence = key->mix_mode == KEY_MIX_FROM_ANIMDATA ? kb->curval : kb->mixval;
+ float influence = *BKE_keyblock_get_active_value(key, kb);
if (use_vgroup)
per_vertex_weights = get_weights_array(ob, kb->vgroup, NULL);
diff --git a/source/blender/makesdna/DNA_key_types.h b/source/blender/makesdna/DNA_key_types.h
index a0de0b9..cd329bd 100644
--- a/source/blender/makesdna/DNA_key_types.h
+++ b/source/blender/makesdna/DNA_key_types.h
@@ -66,7 +66,7 @@ typedef struct KeyBlock {
float mixval; /* animation-independent mix influence (Key->type == KEY_RELATIVE only) */
- /* ranges, for RNA and UI only to clamp 'curval' */
+ /* ranges, for RNA and UI only to clamp 'curval' and 'mixval' */
float slidermin;
float slidermax;
@@ -132,8 +132,8 @@ enum {
/* Key->mix_mode */
enum {
- KEY_MIX_FROM_ANIMDATA = 0,
- KEY_MIX_FROM_TEMPVALUES = 1
+ KEY_MIX_FROM_TEMPVALUES = 0,
+ KEY_MIX_FROM_ANIMDATA = 1
};
/* Key->flag */
More information about the Bf-blender-cvs
mailing list