[Bf-blender-cvs] [1829f693bbe] greasepencil-object: Add samples option to VFX Blur modifier
Antonio Vazquez
noreply at git.blender.org
Wed Aug 9 16:09:33 CEST 2017
Commit: 1829f693bbe6a667de09d5789ae93cfb725cc002
Author: Antonio Vazquez
Date: Wed Aug 9 16:09:16 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB1829f693bbe6a667de09d5789ae93cfb725cc002
Add samples option to VFX Blur modifier
===================================================================
M release/scripts/startup/bl_ui/properties_data_modifier.py
M source/blender/draw/engines/gpencil/gpencil_vfx.c
M source/blender/makesdna/DNA_modifier_types.h
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/modifiers/intern/MOD_gpencilblur.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 6d8d5341278..c3dca0089f7 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1789,6 +1789,11 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
col.label(text="Factor:")
col.prop(md, "factor", text="")
+ layout.separator()
+
+ row = col.row(align=True)
+ row.prop(md, "samples", text="Samples")
+
def GP_WAVE(self, layout, ob, md):
row = layout.row(align=True)
row.prop(md, "orientation", expand=True)
diff --git a/source/blender/draw/engines/gpencil/gpencil_vfx.c b/source/blender/draw/engines/gpencil/gpencil_vfx.c
index 868e6e8f471..1c181d649bc 100644
--- a/source/blender/draw/engines/gpencil/gpencil_vfx.c
+++ b/source/blender/draw/engines/gpencil/gpencil_vfx.c
@@ -137,32 +137,35 @@ static void DRW_gpencil_vfx_blur(ModifierData *md, int ob_idx, GPENCIL_e_data *e
stl->vfx[ob_idx].vfx_blur.x = mmd->radius[0];
stl->vfx[ob_idx].vfx_blur.y = mmd->radius[1] * (viewport_size[1] / viewport_size[0]);
- struct Gwn_Batch *vfxquad = DRW_cache_fullscreen_quad_get();
- /* horizontal blur */
- DRWShadingGroup *vfx_shgrp = DRW_shgroup_create(e_data->gpencil_vfx_blur_sh, psl->vfx_pass);
- DRW_shgroup_call_add(vfx_shgrp, vfxquad, NULL);
- DRW_shgroup_uniform_buffer(vfx_shgrp, "strokeColor", &e_data->vfx_fbcolor_color_tx);
- DRW_shgroup_uniform_buffer(vfx_shgrp, "strokeDepth", &e_data->vfx_fbcolor_depth_tx);
-
- DRW_shgroup_uniform_vec2(vfx_shgrp, "dir", stl->storage->blur1, 1);
- DRW_shgroup_uniform_float(vfx_shgrp, "blur", &stl->vfx[ob_idx].vfx_blur.x, 1);
-
- /* set first effect sh */
- if (cache->init_vfx_sh == NULL) {
- cache->init_vfx_sh = vfx_shgrp;
+ for (int i = 0; i < mmd->samples; ++i) {
+
+ struct Gwn_Batch *vfxquad = DRW_cache_fullscreen_quad_get();
+ /* horizontal blur */
+ DRWShadingGroup *vfx_shgrp = DRW_shgroup_create(e_data->gpencil_vfx_blur_sh, psl->vfx_pass);
+ DRW_shgroup_call_add(vfx_shgrp, vfxquad, NULL);
+ DRW_shgroup_uniform_buffer(vfx_shgrp, "strokeColor", &e_data->vfx_fbcolor_color_tx);
+ DRW_shgroup_uniform_buffer(vfx_shgrp, "strokeDepth", &e_data->vfx_fbcolor_depth_tx);
+
+ DRW_shgroup_uniform_vec2(vfx_shgrp, "dir", stl->storage->blur1, 1);
+ DRW_shgroup_uniform_float(vfx_shgrp, "blur", &stl->vfx[ob_idx].vfx_blur.x, 1);
+
+ /* set first effect sh */
+ if (cache->init_vfx_sh == NULL) {
+ cache->init_vfx_sh = vfx_shgrp;
+ }
+
+ /* vertical blur */
+ vfx_shgrp = DRW_shgroup_create(e_data->gpencil_vfx_blur_sh, psl->vfx_pass);
+ DRW_shgroup_call_add(vfx_shgrp, vfxquad, NULL);
+ DRW_shgroup_uniform_buffer(vfx_shgrp, "strokeColor", &e_data->vfx_fbcolor_color_tx);
+ DRW_shgroup_uniform_buffer(vfx_shgrp, "strokeDepth", &e_data->vfx_fbcolor_depth_tx);
+
+ DRW_shgroup_uniform_vec2(vfx_shgrp, "dir", stl->storage->blur2, 1);
+ DRW_shgroup_uniform_float(vfx_shgrp, "blur", &stl->vfx[ob_idx].vfx_blur.y, 1);
+
+ /* set last effect sh */
+ cache->end_vfx_sh = vfx_shgrp;
}
-
- /* vertical blur */
- vfx_shgrp = DRW_shgroup_create(e_data->gpencil_vfx_blur_sh, psl->vfx_pass);
- DRW_shgroup_call_add(vfx_shgrp, vfxquad, NULL);
- DRW_shgroup_uniform_buffer(vfx_shgrp, "strokeColor", &e_data->vfx_fbcolor_color_tx);
- DRW_shgroup_uniform_buffer(vfx_shgrp, "strokeDepth", &e_data->vfx_fbcolor_depth_tx);
-
- DRW_shgroup_uniform_vec2(vfx_shgrp, "dir", stl->storage->blur2, 1);
- DRW_shgroup_uniform_float(vfx_shgrp, "blur", &stl->vfx[ob_idx].vfx_blur.y, 1);
-
- /* set last effect sh */
- cache->end_vfx_sh = vfx_shgrp;
}
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 50b5dc936e8..2c2f936818c 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1806,7 +1806,7 @@ typedef struct GpencilBlurModifierData {
ModifierData modifier;
int radius[2];
int flag; /* flags */
- char pad[4];
+ int samples;
} GpencilBlurModifierData;
typedef struct GpencilWaveModifierData {
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 112388e6b9a..95e2ed78e30 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -5414,6 +5414,12 @@ static void rna_def_modifier_gpencilblur(BlenderRNA *brna)
RNA_def_property_range(prop, 0, INT_MAX);
RNA_def_property_ui_text(prop, "Factor", "Factor of Blur");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "samples");
+ RNA_def_property_range(prop, 1, 32);
+ RNA_def_property_ui_text(prop, "Samples", "Number of samples");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_gpencilwave(BlenderRNA *brna)
diff --git a/source/blender/modifiers/intern/MOD_gpencilblur.c b/source/blender/modifiers/intern/MOD_gpencilblur.c
index 9b70d122e36..a8719e1ebab 100644
--- a/source/blender/modifiers/intern/MOD_gpencilblur.c
+++ b/source/blender/modifiers/intern/MOD_gpencilblur.c
@@ -44,6 +44,7 @@ static void initData(ModifierData *md)
{
GpencilBlurModifierData *gpmd = (GpencilBlurModifierData *)md;
ARRAY_SET_ITEMS(gpmd->radius, 0.0f, 0.0f);
+ gpmd->samples = 2;
BKE_gpencil_batch_cache_alldirty();
}
More information about the Bf-blender-cvs
mailing list