[Bf-blender-cvs] [5fb8875] GPencil_Editing_Stage3: GP Sculpt: More robust checks for empty stroke buffer
Joshua Leung
noreply at git.blender.org
Fri Oct 16 16:23:18 CEST 2015
Commit: 5fb8875f9b0664a65412aae1a73dc16be4002997
Author: Joshua Leung
Date: Sat Oct 17 03:16:53 2015 +1300
Branches: GPencil_Editing_Stage3
https://developer.blender.org/rB5fb8875f9b0664a65412aae1a73dc16be4002997
GP Sculpt: More robust checks for empty stroke buffer
===================================================================
M source/blender/editors/gpencil/gpencil_brush.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index 31a10c1..ee68085 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -1459,10 +1459,21 @@ static int gpsculpt_brush_invoke(bContext *C, wmOperator *op, const wmEvent *eve
switch (gso->brush_type) {
/* Brushes requiring certain context info... */
case GP_EDITBRUSH_TYPE_CLONE:
- /* check if there's stuff in the copy buffer to use */
- if (BLI_listbase_is_empty(&gp_strokes_copypastebuf)) {
+ {
+ bGPDstroke *gps;
+ bool found = false;
+
+ /* check that there are some usable strokes in the buffer */
+ for (gps = gp_strokes_copypastebuf.first; gps; gps = gps->next) {
+ if (ED_gpencil_stroke_can_use(C, gps)) {
+ found = true;
+ break;
+ }
+ }
+
+ if (found == false) {
BKE_report(op->reports, RPT_ERROR,
- "Copy some strokes to the clipboard before using the Clone brush to paste copies of them");
+ "Copy some strokes to the clipboard before using the Clone brush to paste copies of them");
gpsculpt_brush_exit(C, op);
return OPERATOR_CANCELLED;
}
@@ -1470,7 +1481,9 @@ static int gpsculpt_brush_invoke(bContext *C, wmOperator *op, const wmEvent *eve
/* initialise customdata */
gp_brush_clone_init(C, gso);
}
+
break;
+ }
/* Brushes with custom data */
case GP_EDITBRUSH_TYPE_GRAB:
More information about the Bf-blender-cvs
mailing list