diff options
author | Joshua Leung <aligorith@gmail.com> | 2015-08-25 17:13:17 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2015-08-25 17:30:09 +0300 |
commit | 79af9b1260710f6c8eb680c1f0aea03d7b6b98f5 (patch) | |
tree | 10fc69ce4ef14940265496f89f9f1c44cdf8d749 /source/blender/editors/space_nla | |
parent | 27bdc1a984aca8b8dbe6f5390ca9e38ad2e58bfc (diff) |
Action Management Feature Request/Regression T45535
By popular request, restored the ability to shift-click on the X (unlink) button
to unlink the action (from the active action slot), clear the Fake User, and
also remove the NLA-stashed copy (only works for the current object/NLA stack though).
Diffstat (limited to 'source/blender/editors/space_nla')
-rw-r--r-- | source/blender/editors/space_nla/nla_channels.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index 32a8e660f66..a0ea12b8aa0 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -534,22 +534,38 @@ static int nla_action_unlink_exec(bContext *C, wmOperator *op) /* do unlinking */ if (adt && adt->action) { - ED_animedit_unlink_action(C, adt_ptr.id.data, adt, adt->action, op->reports); + bool force_delete = RNA_boolean_get(op->ptr, "force_delete"); + ED_animedit_unlink_action(C, adt_ptr.id.data, adt, adt->action, op->reports, force_delete); } return OPERATOR_FINISHED; } +static int nla_action_unlink_invoke(bContext *C, wmOperator *op, const wmEvent *evt) +{ + /* NOTE: this is hardcoded to match the behaviour for the unlink button (in interface_templates.c) */ + RNA_boolean_set(op->ptr, "force_delete", evt->shift != 0); + return nla_action_unlink_exec(C, op); +} + void NLA_OT_action_unlink(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name = "Unlink Action"; ot->idname = "NLA_OT_action_unlink"; ot->description = "Unlink this action from the active action slot (and/or exit Tweak Mode)"; /* callbacks */ + ot->invoke = nla_action_unlink_invoke; ot->exec = nla_action_unlink_exec; ot->poll = nla_action_unlink_poll; + + /* properties */ + prop = RNA_def_boolean(ot->srna, "force_delete", false, "Force Delete", + "Clear Fake User and remove copy stashed in this datablock's NLA stack"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); } /* ******************** Add Tracks Operator ***************************** */ |