Commit: 8f1f3a0d46df360f0715df5fa6d487f676940e89
Author: Joshua Leung
Date:   Mon Jan 2 23:31:35 2017 +1300
Branches: master
https://developer.blender.org/rB8f1f3a0d46df360f0715df5fa6d487f676940e89

GPencil: Per-layer option to always show onion skinning

Sometimes it can be useful to be able to keep onion skins visible in the
OpenGL renders and/or when doing animation playback. In particular, there
are two use cases where this is quite useful:
 1) For creating a cheap motion-blur effect, especially when the before/after
    values are also animated.
 2) If you've animated a shot with onion skinning enabled, the poses may end
    up looking odd if the ghosts are not shown (as you may have been accounting
    for the ghosts when making the compositions).

This option can be found as the small "camera" toggle between the "Use Onion 
Skinning"
and "Use Custom Colors" options.

===================================================================

M       release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M       source/blender/editors/gpencil/drawgpencil.c
M       source/blender/makesdna/DNA_gpencil_types.h
M       source/blender/makesrna/intern/rna_gpencil.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 08e07b8..f8ee7c9 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -946,7 +946,10 @@ class GreasePencilDataPanel:
 
         row = col.row()
         row.prop(gpl, "use_onion_skinning")
-        row.prop(gpl, "use_ghost_custom_colors", text="", icon='COLOR')
+        sub = row.row(align=True)
+        icon = 'RESTRICT_RENDER_OFF' if gpl.use_ghosts_always else 
'RESTRICT_RENDER_ON'
+        sub.prop(gpl, "use_ghosts_always", text="", icon=icon)
+        sub.prop(gpl, "use_ghost_custom_colors", text="", icon='COLOR')
 
         split = col.split(percentage=0.5)
         split.active = gpl.use_onion_skinning
diff --git a/source/blender/editors/gpencil/drawgpencil.c 
b/source/blender/editors/gpencil/drawgpencil.c
index 9da3c3e..2fd574d 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -1419,8 +1419,16 @@ static void gp_draw_data_layers(
 
 #undef GP_DRAWFLAG_APPLY
                
-               /* draw 'onionskins' (frame left + right) */
-               if ((gpl->flag & GP_LAYER_ONIONSKIN) && !(dflag & 
GP_DRAWDATA_NO_ONIONS)) {
+               /* Draw 'onionskins' (frame left + right)
+                *   - It is only possible to show these if the option is 
enabled
+                *   - The "no onions" flag prevents ghosts from appearing 
during animation playback/scrubbing
+                *     and in renders
+                *   - The per-layer "always show" flag however overrides the 
playback/render restriction,
+                *     allowing artists to selectively turn onionskins on/off 
during playback
+                */
+               if ((gpl->flag & GP_LAYER_ONIONSKIN) && 
+                   ((dflag & GP_DRAWDATA_NO_ONIONS) == 0 || (gpl->flag & 
GP_LAYER_GHOST_ALWAYS))) 
+               {
                        /* Drawing method - only immediately surrounding (gstep 
= 0),
                         * or within a frame range on either side (gstep > 0)
                         */
diff --git a/source/blender/makesdna/DNA_gpencil_types.h 
b/source/blender/makesdna/DNA_gpencil_types.h
index 23b7342..0364d85 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -244,6 +244,7 @@ typedef struct bGPDlayer {
        float inverse[4][4];    /* inverse matrix (only used if parented) */
        char parsubstr[64];     /* String describing subobject info, 
MAX_ID_NAME-2 */
        short partype, pad;
+       
        float tintcolor[4];     /* Color used to tint layer, alpha value is 
used as factor */
        float opacity;          /* Opacity of the layer */
 } bGPDlayer;
@@ -275,7 +276,9 @@ typedef enum eGPDlayer_Flag {
        /* Use high quality fill (instead of buggy legacy OpenGL Fill) */
        GP_LAYER_HQ_FILL        = (1 << 11),
        /* Unlock color */
-       GP_LAYER_UNLOCK_COLOR = (1 << 12)
+       GP_LAYER_UNLOCK_COLOR   = (1 << 12),
+       /* always show onion skins (i.e. even during renders/animation 
playback) */
+       GP_LAYER_GHOST_ALWAYS   = (1 << 13),
 } eGPDlayer_Flag;
 
 /* Grease-Pencil Annotations - 'DataBlock' */
diff --git a/source/blender/makesrna/intern/rna_gpencil.c 
b/source/blender/makesrna/intern/rna_gpencil.c
index 41a73cf..14da990 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1242,6 +1242,13 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "After Color", "Base color for ghosts 
after the active frame");
        RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, 
"rna_GPencil_update");
        
+       prop = RNA_def_property(srna, "use_ghosts_always", PROP_BOOLEAN, 
PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", 
GP_LAYER_GHOST_ALWAYS);
+       RNA_def_property_ui_text(prop, "Always Show Ghosts",
+                                "Ghosts are shown in renders and animation 
playback. Useful for special effects (e.g. motion blur)");
+       RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, 
"rna_GPencil_update");
+       
+       
        /* Flags */
        prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_HIDE);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to