Shape Keys: let Make Basis Key also update the "relative to" fields
When a shape key is made the new basis key, also update the "Relative To" setting on the old & new basis keys. Both are made relative to the new basis shape key. Without this, the old basis key would still be relative to itself, which effectively disables it. By making it relative to the new basis key, you can increase its blend value to invert the effect of the new basis key. Pull Request: https://projects.blender.org/blender/blender/pulls/143466
This commit is contained in:
@@ -867,6 +867,8 @@ static bool shape_key_make_basis_poll(bContext *C)
|
||||
static wmOperatorStatus shape_key_make_basis_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
KeyBlock *old_basis_key = static_cast<KeyBlock *>(key->block.first);
|
||||
|
||||
/* Make the new basis by moving the active key to index 0. */
|
||||
const int from_index = -1; /* Interpreted as "the active key". */
|
||||
@@ -880,6 +882,14 @@ static wmOperatorStatus shape_key_make_basis_exec(bContext *C, wmOperator * /*op
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
/* Make the old & new basis keys "Relative to" the new basis key. For the new key it doesn't
|
||||
* matter much, as it's treated as special anyway, but keeping it relative to another key makes
|
||||
* no sense. For the old basis key (which just became a normal key), it would otherwise still be
|
||||
* relative to itself, effectively disabling it. */
|
||||
KeyBlock *new_basis_key = static_cast<KeyBlock *>(key->block.first);
|
||||
new_basis_key->relative = 0;
|
||||
old_basis_key->relative = 0;
|
||||
|
||||
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user