diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2014-05-19 00:05:21 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2014-05-19 00:05:21 +0400 |
commit | 875aff2a9a832d162141e1f6a39f9d08c46912b7 (patch) | |
tree | c3774a4884d3ea34c15054f83733c5d7f7cdda57 /source/blender/makesrna | |
parent | d1dde3c98136294b62f142f69d1cf61cd5bbc62f (diff) |
Fix T39897: shape keys created while the Relative checkbox is unchecked start out with frame=0
So! First, frame for absolute shape keys: never allow a new key to have the same pos as an
existing one (this does not make sense). This way, the two workflows are possible (create
all keys and then animate ctime, or animate ctime and then create keys where you need them).
Also, fixed UIList for shapekeys, the "absolute" test was wrong, and better to show frame
value, even though not editable, than nothing in case of absolute keys.
And finally, add getter to RNA 'frame' readonly value, so that we output real frame values,
and not dummy internal ones (which are /100) in our API.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_key.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index a72e207178b..7d10511d1c4 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -92,6 +92,12 @@ static void rna_ShapeKey_name_set(PointerRNA *ptr, const char *value) BKE_all_animdata_fix_paths_rename(NULL, "key_blocks", oldname, kb->name); } +static float rna_ShapeKey_frame_get(PointerRNA *ptr) +{ + KeyBlock *kb = (KeyBlock *)ptr->data; + return kb->pos * 100.0f; /* Because pos is ctime/100... */ +} + static void rna_ShapeKey_value_set(PointerRNA *ptr, float value) { KeyBlock *data = (KeyBlock *)ptr->data; @@ -571,6 +577,7 @@ static void rna_def_keyblock(BlenderRNA *brna) prop = RNA_def_property(srna, "frame", PROP_FLOAT, PROP_TIME); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_float_sdna(prop, NULL, "pos"); + RNA_def_property_float_funcs(prop, "rna_ShapeKey_frame_get", NULL, NULL); RNA_def_property_ui_text(prop, "Frame", "Frame for absolute keys"); RNA_def_property_update(prop, 0, "rna_Key_update_data"); |