From 7f4cb0237b076e89801603a1cef25ec87f5be673 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 6 Jul 2014 20:55:10 +1200 Subject: Outliner: Added option to RMB menu for "Animation" entries to remove these and their data --- source/blender/editors/space_outliner/outliner_tools.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'source') 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); -- cgit v1.2.3