GP: Add Simplify Shader FX option

This option was missing when old VFX modifers were backported as Shader FX.
This commit is contained in:
2018-08-06 17:01:47 +02:00
parent d07a408a40
commit 563e17091d
5 changed files with 18 additions and 4 deletions

View File

@@ -589,6 +589,7 @@ class SCENE_PT_simplify_greasepencil(SceneButtonsPanel, Panel):
col = layout.column()
col.prop(rd, "simplify_gpencil_onplay", text="Playback Only")
col.prop(rd, "simplify_gpencil_view_modifier", text="Modifiers")
col.prop(rd, "simplify_gpencil_shader_fx", text="ShaderFX")
col = layout.column(align=True)
col.prop(rd, "simplify_gpencil_view_fill")

View File

@@ -353,6 +353,7 @@ void GPENCIL_cache_init(void *vedata)
/* save simplify flags (can change while drawing, so it's better to save) */
stl->storage->simplify_fill = GP_SIMPLIFY_FILL(scene, stl->storage->playing);
stl->storage->simplify_modif = GP_SIMPLIFY_MODIF(scene, stl->storage->playing);
stl->storage->simplify_fx = GP_SIMPLIFY_FX(scene, stl->storage->playing);
/* save pixsize */
stl->storage->pixsize = DRW_viewport_pixelsize_get();
@@ -465,7 +466,9 @@ void GPENCIL_cache_init(void *vedata)
}
/* create effects passes */
GPENCIL_create_fx_passes(psl);
if (!stl->storage->simplify_fx) {
GPENCIL_create_fx_passes(psl);
}
}
}
@@ -559,7 +562,7 @@ void GPENCIL_cache_finish(void *vedata)
}
/* FX passses */
tGPencilObjectCache *cache = &stl->g_data->gp_object_cache[i];
if (!is_multiedit) {
if ((!stl->storage->simplify_fx) && (!is_multiedit)) {
DRW_gpencil_fx_prepare(&e_data, vedata, cache);
}
}
@@ -720,7 +723,9 @@ void GPENCIL_draw_scene(void *ved)
DRW_draw_pass(psl->drawing_pass);
}
/* fx passes */
if (BKE_shaderfx_has_gpencil(ob)) {
if ((!stl->storage->simplify_fx) &&
(BKE_shaderfx_has_gpencil(ob)))
{
stl->storage->tonemapping = 0;
DRW_gpencil_fx_draw(&e_data, vedata, cache);
}

View File

@@ -53,6 +53,7 @@ struct RenderLayer;
#define GP_SIMPLIFY_ONPLAY(playing) (((playing == true) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ON_PLAY)) || ((scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ON_PLAY) == 0))
#define GP_SIMPLIFY_FILL(scene, playing) ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(scene)) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_FILL)))
#define GP_SIMPLIFY_MODIF(scene, playing) ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(scene)) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_MODIFIER)))
#define GP_SIMPLIFY_FX(scene, playing) ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(scene)) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_FX)))
#define GP_IS_CAMERAVIEW ((rv3d != NULL) && (rv3d->persp == RV3D_CAMOB && v3d->camera))

View File

@@ -2067,7 +2067,9 @@ typedef enum eGPencil_SimplifyFlags {
/* Simplify modifier on viewport */
SIMPLIFY_GPENCIL_MODIFIER = (1 << 3),
/* Remove fill external line */
SIMPLIFY_GPENCIL_REMOVE_FILL_LINE = (1 << 4)
SIMPLIFY_GPENCIL_REMOVE_FILL_LINE = (1 << 4),
/* Simplify Shader FX */
SIMPLIFY_GPENCIL_FX = (1 << 5)
} eGPencil_SimplifyFlags;
/* ToolSettings.gpencil_*_align - Stroke Placement mode flags */

View File

@@ -5211,6 +5211,11 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Disable Modifiers", "Do not apply modifiers in the viewport");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
prop = RNA_def_property(srna, "simplify_gpencil_shader_fx", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_FX);
RNA_def_property_ui_text(prop, "Simplify Shaders", "Do not apply shader fx");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
/* persistent data */
prop = RNA_def_property(srna, "use_persistent_data", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", R_PERSISTENT_DATA);