Fix T59548: Grease Pencil Primitives ignore the 'draw below' option
authorAntonioya <blendergit@gmail.com>
Tue, 18 Dec 2018 09:44:13 +0000 (10:44 +0100)
committerAntonioya <blendergit@gmail.com>
Tue, 18 Dec 2018 09:44:35 +0000 (10:44 +0100)
source/blender/editors/gpencil/gpencil_primitive.c

index 7faf399747b78bdc470eba57510d686dc285e4fd..c88d0a346ddee1675fa8682fd826dcc73f3136e6 100644 (file)
@@ -1160,7 +1160,12 @@ static void gpencil_primitive_interaction_end(bContext *C, wmOperator *op, wmWin
        }
 
        /* transfer stroke from temporary buffer to the actual frame */
-       BLI_movelisttolist(&gpf->strokes, &tgpi->gpf->strokes);
+       if (ts->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) {
+               BLI_movelisttolist_reverse(&gpf->strokes, &tgpi->gpf->strokes);
+       }
+       else {
+               BLI_movelisttolist(&gpf->strokes, &tgpi->gpf->strokes);
+       }
        BLI_assert(BLI_listbase_is_empty(&tgpi->gpf->strokes));
 
        /* add weights if required */