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:
authorAntonioya <blendergit@gmail.com>2016-08-06 00:03:51 +0300
committerAntonioya <blendergit@gmail.com>2016-08-07 17:45:02 +0300
commit97b0d23357b1f48f30d45f2f328707a7bdc40695 (patch)
tree64d1a96677b844881616a4fa132a0ae5ecd50f07 /source/blender/editors/gpencil
parent0e25dc4acc08e7c48588ec7dc27f3deea3a165ec (diff)
GPencil: Add option to draw new strokes on back of layer
For artist point of view is very useful to have an option to draw by default the new strokes on back of all strokes in the layer.
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index d637affe79d..cebcbfe9317 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -692,6 +692,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
bGPDspoint *pt;
tGPspoint *ptc;
bGPDbrush *brush = p->brush;
+ ToolSettings *ts = p->scene->toolsettings;
int i, totelem;
/* since strokes are so fine, when using their depth we need a margin otherwise they might get missed */
@@ -925,8 +926,16 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
gps->palcolor = palcolor;
strcpy(gps->colorname, palcolor->info);
- /* add stroke to frame */
- BLI_addtail(&p->gpf->strokes, gps);
+ /* add stroke to frame, usually on tail of the listbase, but if on back is enabled the stroke is added on listbase head
+ * because the drawing order is inverse and the head stroke is the first to draw. This is very useful for artist
+ * when drawing the background
+ */
+ if (ts->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) {
+ BLI_addhead(&p->gpf->strokes, gps);
+ }
+ else {
+ BLI_addtail(&p->gpf->strokes, gps);
+ }
gp_stroke_added_enable(p);
}