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:
authorCampbell Barton <ideasman42@gmail.com>2012-05-13 01:29:25 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-05-13 01:29:25 +0400
commite7612ffd244a71bb363c7afe7db480c60c03767f (patch)
treed8eccba737d2157f11e405b76eeaeee3ea44fad6 /source/blender/editors
parent613f464c51fbaa759e45b8b22ede47c8aea9382f (diff)
replace GP_PAINTFLAG_STROKEADDED with a NULL check, saves worrying about keeping the flag correct after undo.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 628f3aefa77..3e49e2c5cd5 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -128,8 +128,7 @@ enum {
/* Runtime flags */
enum {
- GP_PAINTFLAG_FIRSTRUN = (1 << 0), /* operator just started */
- GP_PAINTFLAG_STROKEADDED = (1 << 1) /* stroke was already added during draw session */
+ GP_PAINTFLAG_FIRSTRUN = (1 << 0) /* operator just started */
};
/* ------ */
@@ -143,6 +142,11 @@ enum {
/* minimum length of new segment before new point can be added */
#define MIN_EUCLIDEAN_PX (U.gp_euclideandist)
+static int gp_stroke_is_added(tGPsdata *p)
+{
+ return (p->gpf && p->gpf->strokes.last);
+}
+
/* ------ */
/* Forward defines for some functions... */
@@ -322,11 +326,6 @@ static short gp_stroke_addpoint(tGPsdata *p, const int mval[2], float pressure)
bGPdata *gpd = p->gpd;
tGPspoint *pt;
- /* sanity check, can happen after undo [#31427] */
- if (p->flags & GP_PAINTFLAG_STROKEADDED && p->gpf->strokes.last == NULL) {
- p->flags &= ~GP_PAINTFLAG_STROKEADDED;
- }
-
/* check painting mode */
if (p->paintmode == GP_PAINTMODE_DRAW_STRAIGHT) {
/* straight lines only - i.e. only store start and end point in buffer */
@@ -395,7 +394,7 @@ static short gp_stroke_addpoint(tGPsdata *p, const int mval[2], float pressure)
* to stroke. This allows to draw lines more interactively (see new segment
* during mouse slide, i.e.)
*/
- if (p->flags & GP_PAINTFLAG_STROKEADDED) {
+ if (gp_stroke_is_added(p)) {
bGPDstroke *gps = p->gpf->strokes.last;
bGPDspoint *pts;
@@ -583,8 +582,9 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
* coordinates are getting added to stroke immediately to allow more
* interactive behavior */
if (p->paintmode == GP_PAINTMODE_DRAW_POLY) {
- if (p->flags & GP_PAINTFLAG_STROKEADDED)
+ if (gp_stroke_is_added(p)) {
return;
+ }
}
/* allocate memory for a new stroke */
@@ -715,8 +715,6 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
if (depth_arr)
MEM_freeN(depth_arr);
}
-
- p->flags |= GP_PAINTFLAG_STROKEADDED;
/* add stroke to frame */
BLI_addtail(&p->gpf->strokes, gps);