[Bf-blender-cvs] [7f4cb02] master: Outliner: Added option to RMB menu for "Animation" entries to remove these and their data

Joshua Leung noreply at git.blender.org
Sun Jul 6 11:00:13 CEST 2014


Commit: 7f4cb0237b076e89801603a1cef25ec87f5be673
Author: Joshua Leung
Date:   Sun Jul 6 20:55:10 2014 +1200
https://developer.blender.org/rB7f4cb0237b076e89801603a1cef25ec87f5be673

Outliner: Added option to RMB menu for "Animation" entries to remove these and their data

===================================================================

M	source/blender/editors/space_outliner/outliner_tools.c

===================================================================

diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 8f5e2ad..d1e9b3d 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);




More information about the Bf-blender-cvs mailing list