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/blenkernel/intern/key.c | |
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/blenkernel/intern/key.c')
-rw-r--r-- | source/blender/blenkernel/intern/key.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 0f04c03688c..2dc615c19f9 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1558,9 +1558,23 @@ KeyBlock *BKE_keyblock_add(Key *key, const char *name) KeyBlock *BKE_keyblock_add_ctime(Key *key, const char *name, const bool do_force) { KeyBlock *kb = BKE_keyblock_add(key, name); + const float cpos = key->ctime / 100.0f; + /* In case of absolute keys, there is no point in adding more than one key with the same pos. + * Hence only set new keybloc pos to current time if none previous one already use it. + * Now at least people just adding absolute keys without touching to ctime + * won't have to systematically use retiming func (and have ordering issues, too). See T39897. + */ + if (!do_force && (key->type != KEY_RELATIVE)) { + KeyBlock *it_kb; + for (it_kb = key->block.first; it_kb; it_kb = it_kb->next) { + if (it_kb->pos == cpos) { + return kb; + } + } + } if (do_force || (key->type != KEY_RELATIVE)) { - kb->pos = key->ctime / 100.0f; + kb->pos = cpos; BKE_key_sort(key); } |