Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Eagar <joeedh@gmail.com>2009-04-03 07:16:31 +0400
committerJoseph Eagar <joeedh@gmail.com>2009-04-03 07:16:31 +0400
commit8ca30120a206c8b78645dd3d45c9891acaeebac1 (patch)
tree7d732e962b985e3857335bbef6dbd87bbc6b59d6
parentb22705f1694f83756f7ca785b6f20caf353f5998 (diff)
made grease pencil delete a frame if you delete all the strokes in it.
-rw-r--r--source/blender/include/BDR_gpencil.h2
-rw-r--r--source/blender/src/drawgpencil.c2
-rw-r--r--source/blender/src/gpencil.c10
3 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/include/BDR_gpencil.h b/source/blender/include/BDR_gpencil.h
index 6af156775be..6848be2a481 100644
--- a/source/blender/include/BDR_gpencil.h
+++ b/source/blender/include/BDR_gpencil.h
@@ -65,7 +65,7 @@ struct bGPdata *gpencil_data_getactive(struct ScrArea *sa);
short gpencil_data_setactive(struct ScrArea *sa, struct bGPdata *gpd);
struct ScrArea *gpencil_data_findowner(struct bGPdata *gpd);
-void gpencil_frame_delete_laststroke(struct bGPDframe *gpf);
+void gpencil_frame_delete_laststroke(struct bGPDframe *gpf, bGPDlayer *gpl);
struct bGPDframe *gpencil_layer_getframe(struct bGPDlayer *gpl, int cframe, short addnew);
void gpencil_layer_delframe(struct bGPDlayer *gpl, struct bGPDframe *gpf);
diff --git a/source/blender/src/drawgpencil.c b/source/blender/src/drawgpencil.c
index 1b3d869b2f8..914a604de44 100644
--- a/source/blender/src/drawgpencil.c
+++ b/source/blender/src/drawgpencil.c
@@ -140,7 +140,7 @@ void gp_ui_delstroke_cb (void *gpd, void *gpl)
bGPDframe *gpf= gpencil_layer_getframe(gpl, CFRA, 0);
gpencil_layer_setactive(gpd, gpl);
- gpencil_frame_delete_laststroke(gpf);
+ gpencil_frame_delete_laststroke(gpf, gpl);
scrarea_queue_winredraw(curarea);
}
diff --git a/source/blender/src/gpencil.c b/source/blender/src/gpencil.c
index f4cfc0c0dd6..fa502a1af59 100644
--- a/source/blender/src/gpencil.c
+++ b/source/blender/src/gpencil.c
@@ -484,7 +484,7 @@ ScrArea *gpencil_data_findowner (bGPdata *gpd)
/* -------- GP-Frame API ---------- */
/* delete the last stroke of the given frame */
-void gpencil_frame_delete_laststroke (bGPDframe *gpf)
+void gpencil_frame_delete_laststroke (bGPDframe *gpf, bGPDlayer *gpl)
{
bGPDstroke *gps= (gpf) ? gpf->strokes.last : NULL;
@@ -495,6 +495,11 @@ void gpencil_frame_delete_laststroke (bGPDframe *gpf)
/* free the stroke and its data */
MEM_freeN(gps->points);
BLI_freelinkN(&gpf->strokes, gps);
+
+ if (gpf->strokes.first == NULL) {
+ gpencil_layer_delframe(gpl, gpf);
+ gpencil_layer_getframe(gpl, CFRA, 0);
+ }
}
/* -------- GP-Layer API ---------- */
@@ -603,6 +608,7 @@ bGPDframe *gpencil_layer_getframe (bGPDlayer *gpl, int cframe, short addnew)
else if (found)
gpl->actframe= gpf;
else {
+ gpl->actframe = gpl->frames.first;
/* unresolved errogenous situation! */
printf("Error: cannot find appropriate gp-frame \n");
/* gpl->actframe should still be NULL */
@@ -696,7 +702,7 @@ void gpencil_delete_laststroke (bGPdata *gpd)
bGPDlayer *gpl= gpencil_layer_getactive(gpd);
bGPDframe *gpf= gpencil_layer_getframe(gpl, CFRA, 0);
- gpencil_frame_delete_laststroke(gpf);
+ gpencil_frame_delete_laststroke(gpf, gpl);
}
/* delete the active frame */