diff options
author | Antonioya <blendergit@gmail.com> | 2018-10-25 17:50:42 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2018-10-25 17:50:42 +0300 |
commit | 4c2561a87777d821dfb5f44463b4629a2206a9f2 (patch) | |
tree | 98f29a1fb3a73eba92ed3000277f278d09aed1f4 /source | |
parent | 2b6253175ea63e787cde8bb3c6b7fa16c17e9247 (diff) |
GP: Include option to render layers by view layer
This allows to make composition getting each grease pencil layer in a different render output.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/engines/gpencil/gpencil_draw_utils.c | 10 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_gpencil_types.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_gpencil.c | 5 |
3 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c index 641229446b9..c980e1791db 100644 --- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c +++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c @@ -1244,6 +1244,8 @@ void DRW_gpencil_populate_datablock( { GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl; const DRWContextState *draw_ctx = DRW_context_state_get(); + const ViewLayer *view_layer = DEG_get_evaluated_view_layer(draw_ctx->depsgraph); + bGPdata *gpd_eval = (bGPdata *)ob->data; bGPdata *gpd = (bGPdata *)DEG_get_original_id(&gpd_eval->id); @@ -1278,6 +1280,14 @@ void DRW_gpencil_populate_datablock( /* don't draw layer if hidden */ if (gpl->flag & GP_LAYER_HIDE) continue; + + /* filter view layer to gp layers in the same view layer (for compo) */ + if ((stl->storage->is_render) && (gpl->viewlayername[0] != '\0')) { + if (!STREQ(view_layer->name, gpl->viewlayername)) { + continue; + } + } + if ((!time_remap) || (stl->storage->simplify_modif)) { gpf = BKE_gpencil_layer_getframe(gpl, cfra_eval, GP_GETFRAME_USE_PREV); } diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h index 54559ce89f7..2c59dd899a9 100644 --- a/source/blender/makesdna/DNA_gpencil_types.h +++ b/source/blender/makesdna/DNA_gpencil_types.h @@ -270,6 +270,7 @@ typedef struct bGPDlayer { short line_change; /* Thickness adjustment */ float tintcolor[4]; /* Color used to tint layer, alpha value is used as factor */ float opacity; /* Opacity of the layer */ + char viewlayername[64]; /* Name of the layer used to filter render output */ bGPDlayer_Runtime runtime; } bGPDlayer; diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index de31c884b6b..33100c21180 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -1100,6 +1100,11 @@ static void rna_def_gpencil_layer(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Pass Index", "Index number for the \"Layer Index\" pass"); RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); + prop = RNA_def_property(srna, "viewlayer_render", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "viewlayername"); + RNA_def_property_ui_text(prop, "ViewLayer", + "Only include Layer in this View Layer render output (leave blank to include always)"); + /* Flags */ prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_HIDE); |