[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38230] branches/soc-2011-pepper/source/ blender/editors: Deleting Grease Pencil layers from Action-Editor works again

Joshua Leung aligorith at gmail.com
Fri Jul 8 13:57:25 CEST 2011


Revision: 38230
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38230
Author:   aligorith
Date:     2011-07-08 11:57:25 +0000 (Fri, 08 Jul 2011)
Log Message:
-----------
Deleting Grease Pencil layers from Action-Editor works again

Modified Paths:
--------------
    branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_edit.c
    branches/soc-2011-pepper/source/blender/editors/gpencil/editaction_gpencil.c

Modified: branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_edit.c
===================================================================
--- branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_edit.c	2011-07-08 11:43:35 UTC (rev 38229)
+++ branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_edit.c	2011-07-08 11:57:25 UTC (rev 38230)
@@ -1171,28 +1171,41 @@
 		BLI_freelistN(&anim_data);
 	}
 	
-	/* now do F-Curves */
-	if (ac.datatype != ANIMCONT_GPENCIL) {
-		/* filter data */
-		filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
-		ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-		
-		/* delete selected F-Curves */
-		for (ale= anim_data.first; ale; ale= ale->next) {
-			/* only F-Curves, and only if we can identify its parent */
-			if (ale->type == ANIMTYPE_FCURVE) {
+	/* filter data */
+	filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
+	ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+	
+	/* delete selected data channels */
+	for (ale= anim_data.first; ale; ale= ale->next) {
+		switch (ale->type) {
+			case ANIMTYPE_FCURVE: 
+			{
+				/* F-Curves if we can identify its parent */
 				AnimData *adt= ale->adt;
 				FCurve *fcu= (FCurve *)ale->data;
 				
 				/* try to free F-Curve */
 				ANIM_fcurve_delete_from_animdata(&ac, adt, fcu);
 			}
+				break;
+				
+			case ANIMTYPE_GPLAYER:
+			{
+				/* Grease Pencil layer */
+				bGPdata *gpd= (bGPdata *)ale->id;
+				bGPDlayer *gpl= (bGPDlayer *)ale->data;
+				
+				/* try to delete the layer's data and the layer itself */
+				free_gpencil_frames(gpl);
+				BLI_freelinkN(&gpd->layers, gpl);
+			}
+				break;
 		}
-		
-		/* cleanup */
-		BLI_freelistN(&anim_data);
 	}
 	
+	/* cleanup */
+	BLI_freelistN(&anim_data);
+	
 	/* send notifier that things have changed */
 	WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
 	

Modified: branches/soc-2011-pepper/source/blender/editors/gpencil/editaction_gpencil.c
===================================================================
--- branches/soc-2011-pepper/source/blender/editors/gpencil/editaction_gpencil.c	2011-07-08 11:43:35 UTC (rev 38229)
+++ branches/soc-2011-pepper/source/blender/editors/gpencil/editaction_gpencil.c	2011-07-08 11:57:25 UTC (rev 38230)
@@ -260,45 +260,6 @@
 /* ***************************************** */
 /* Frame Editing Tools */
 
-#if 0 // XXX disabled until grease pencil code stabilises again
-/* Delete selected grease-pencil layers */
-void delete_gpencil_layers (void)
-{
-	ListBase act_data = {NULL, NULL};
-	bActListElem *ale, *next;
-	void *data;
-	short datatype;
-	int filter;
-	
-	/* determine what type of data we are operating on */
-	data = get_action_context(&datatype);
-	if (data == NULL) return;
-	if (datatype != ACTCONT_GPENCIL) return;
-	
-	/* filter data */
-	filter= (ACTFILTER_VISIBLE | ACTFILTER_FOREDIT | ACTFILTER_CHANNELS | ACTFILTER_SEL);
-	actdata_filter(&act_data, filter, data, datatype);
-	
-	/* clean up grease-pencil layers */
-	for (ale= act_data.first; ale; ale= next) {
-		bGPdata *gpd= (bGPdata *)ale->owner;
-		bGPDlayer *gpl= (bGPDlayer *)ale->data;
-		next= ale->next;
-		
-		/* free layer and its data */
-		if (SEL_GPL(gpl)) {
-			free_gpencil_frames(gpl);
-			BLI_freelinkN(&gpd->layers, gpl);
-		}
-		
-		/* free temp memory */
-		BLI_freelinkN(&act_data, ale);
-	}
-	
-	BIF_undo_push("Delete GPencil Layers");
-}
-#endif // XXX disabled until Grease Pencil code stabilises again...
-
 /* Delete selected frames */
 void delete_gplayer_frames (bGPDlayer *gpl)
 {




More information about the Bf-blender-cvs mailing list