diff options
author | Joshua Leung <aligorith@gmail.com> | 2014-07-06 12:55:10 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2014-07-06 12:55:10 +0400 |
commit | 7f4cb0237b076e89801603a1cef25ec87f5be673 (patch) | |
tree | 21eb0cf9263ddba1312ade7826576dc4c53419f9 /source/blender/editors/space_outliner | |
parent | 89aee74c8161585d43bf6b72a4c2c9b05257d168 (diff) |
Outliner: Added option to RMB menu for "Animation" entries to remove these and their data
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_tools.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 8f5e2ad3693..d1e9b3d34b7 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -459,6 +459,13 @@ void outliner_do_object_operation(bContext *C, Scene *scene_act, SpaceOops *soop /* ******************************************** */ +static void clear_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te), + TreeStoreElem *tselem, void *UNUSED(arg)) +{ + BKE_free_animdata(tselem->id); +} + + static void unlinkact_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te), TreeStoreElem *tselem, void *UNUSED(arg)) { @@ -1076,6 +1083,8 @@ void OUTLINER_OT_action_set(wmOperatorType *ot) typedef enum eOutliner_AnimDataOps { OUTLINER_ANIMOP_INVALID = 0, + OUTLINER_ANIMOP_CLEAR_ADT, + OUTLINER_ANIMOP_SET_ACT, OUTLINER_ANIMOP_CLEAR_ACT, @@ -1087,6 +1096,7 @@ typedef enum eOutliner_AnimDataOps { } eOutliner_AnimDataOps; static EnumPropertyItem prop_animdata_op_types[] = { + {OUTLINER_ANIMOP_CLEAR_ADT, "CLEAR_ANIMDATA", 0, "Clear Animation Data", "Remove this animation data container"}, {OUTLINER_ANIMOP_SET_ACT, "SET_ACT", 0, "Set Action", ""}, {OUTLINER_ANIMOP_CLEAR_ACT, "CLEAR_ACT", 0, "Unlink Action", ""}, {OUTLINER_ANIMOP_REFRESH_DRV, "REFRESH_DRIVERS", 0, "Refresh Drivers", ""}, @@ -1115,6 +1125,14 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op) /* perform the core operation */ switch (event) { + case OUTLINER_ANIMOP_CLEAR_ADT: + /* Remove Animation Data - this may remove the active action, in some cases... */ + outliner_do_data_operation(soops, datalevel, event, &soops->tree, clear_animdata_cb, NULL); + + WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL); + ED_undo_push(C, "Clear Animation Data"); + break; + case OUTLINER_ANIMOP_SET_ACT: /* delegate once again... */ WM_operator_name_call(C, "OUTLINER_OT_action_set", WM_OP_INVOKE_REGION_WIN, NULL); |