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
path: root/source
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2018-08-24 18:04:00 +0300
committerAntonioya <blendergit@gmail.com>2018-08-24 18:05:01 +0300
commit3b2438192bdabc03030eb00a2fdb081aef18f962 (patch)
treec1d83bca7d47cc806a893c01c60c01918cd4bc7f /source
parentd162be62469a7a7ad341905fe9eeed63c14ed8d5 (diff)
GP: Fix unreported error drawing polygons
As the polygon drawing is handled using a buffer that is converted to stroke inmediately, the drawing engine was not drawing the buffer stroke because it was empty, and the stoke was not visible becaus eit was in fast drawing mode. Now there is a special flag to indicate the polygon mode is enabled and force the drawing engine to draw strokes and disable fast drawing.
Diffstat (limited to 'source')
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_engine.c3
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c4
-rw-r--r--source/blender/makesdna/DNA_gpencil_types.h2
3 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index bdca3a350cd..e401712828d 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -382,7 +382,8 @@ void GPENCIL_cache_init(void *vedata)
(stl->storage->is_playing == false))
{
if (((obact_gpd->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0) &&
- (obact_gpd->runtime.sbuffer_size > 0))
+ (obact_gpd->runtime.sbuffer_size > 0) &&
+ ((obact_gpd->flag & GP_DATA_STROKE_POLYGON) == 0))
{
stl->g_data->session_flag |= GP_DRW_PAINT_PAINTING;
}
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index d4371926eb4..b50624d07d2 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -733,6 +733,9 @@ static short gp_stroke_addpoint(
}
else if (p->paintmode == GP_PAINTMODE_DRAW_POLY) {
+ /* enable special flag for drawing engine */
+ gpd->flag |= GP_DATA_STROKE_POLYGON;
+
bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
/* get pointer to destination point */
pt = (tGPspoint *)(gpd->runtime.sbuffer);
@@ -2124,6 +2127,7 @@ static void gpencil_draw_exit(bContext *C, wmOperator *op)
/* drawing batch cache is dirty now */
bGPdata *gpd = CTX_data_gpencil_data(C);
if (gpd) {
+ gpd->flag &= ~GP_DATA_STROKE_POLYGON;
gp_update_cache(gpd);
}
}
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index f4a13801949..8462b615d2c 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -427,6 +427,8 @@ typedef enum eGPdata_Flag {
* not valid.
*/
GP_DATA_STROKE_FORCE_RECALC = (1 << 17),
+ /* Special mode drawing polygons */
+ GP_DATA_STROKE_POLYGON = (1 << 18),
} eGPdata_Flag;
/* gpd->onion_flag */