diff options
author | YimingWu <NicksBest> | 2021-04-28 17:46:46 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2021-04-28 17:53:19 +0300 |
commit | f8f7c0ca6db87e5f2613896156e595d2bea5fdde (patch) | |
tree | 369d08a6f78d4de271e7e1aaf35f0475fb6d7a74 /source/blender/makesdna | |
parent | 67a52c8a4065f32a57d946524a4fab1d2ba92512 (diff) |
GPencil: Fading based on distance to reference object in Opacity and Thickness modifiers
This patch allows you to dynamically control stroke's opacity and thickness using an object for distance reference in the modifier. Fading range is adjustable, and it is compatible with current curve/vertex group selection.
Reviewed By: #grease_pencil, antoniov, mendio
Maniphest Tasks: T82177, T80194
Differential Revision: https://developer.blender.org/D9091
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_gpencil_modifier_defaults.h | 4 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_gpencil_modifier_types.h | 18 |
2 files changed, 20 insertions, 2 deletions
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_defaults.h b/source/blender/makesdna/DNA_gpencil_modifier_defaults.h index ea03789ddab..b816a45426b 100644 --- a/source/blender/makesdna/DNA_gpencil_modifier_defaults.h +++ b/source/blender/makesdna/DNA_gpencil_modifier_defaults.h @@ -184,6 +184,8 @@ .layer_pass = 0, \ .hardeness = 1.0f, \ .curve_intensity = NULL, \ + .fading_end = 10.0f, \ + .fading_end_factor = 0.2f, \ } #define _DNA_DEFAULT_SimplifyGpencilModifierData \ @@ -251,6 +253,8 @@ .thickness_fac = 1.0f, \ .thickness = 30, \ .layer_pass = 0, \ + .fading_end = 10.0f, \ + .fading_end_factor = 0.2f, \ } #define _DNA_DEFAULT_TimeGpencilModifierData \ diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h index 8d7b3896ef9..668ddae098a 100644 --- a/source/blender/makesdna/DNA_gpencil_modifier_types.h +++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h @@ -187,7 +187,12 @@ typedef struct ThickGpencilModifierData { int thickness; /** Custom index for passes. */ int layer_pass; - char _pad[4]; + /** Start/end distances of the fading effect. */ + float fading_start; + float fading_end; + float fading_end_factor; + /** Fading reference object */ + struct Object *object; struct CurveMapping *curve_thickness; } ThickGpencilModifierData; @@ -199,6 +204,7 @@ typedef enum eThickGpencil_Flag { GP_THICK_NORMALIZE = (1 << 4), GP_THICK_INVERT_LAYERPASS = (1 << 5), GP_THICK_INVERT_MATERIAL = (1 << 6), + GP_THICK_FADING = (1 << 7), } eThickGpencil_Flag; typedef struct TimeGpencilModifierData { @@ -291,9 +297,16 @@ typedef struct OpacityGpencilModifierData { int flag; /** Main Opacity factor. */ float factor; + /** Fading controlling object */ + int _pad0; + struct Object *object; + /** Start/end distances of the fading effect. */ + float fading_start; + float fading_end; + float fading_end_factor; /** Modify stroke, fill or both. */ char modify_color; - char _pad[3]; + char _pad1[3]; /** Custom index for passes. */ int layer_pass; @@ -309,6 +322,7 @@ typedef enum eOpacityGpencil_Flag { GP_OPACITY_INVERT_MATERIAL = (1 << 5), GP_OPACITY_CUSTOM_CURVE = (1 << 6), GP_OPACITY_NORMALIZE = (1 << 7), + GP_OPACITY_FADING = (1 << 8), } eOpacityGpencil_Flag; typedef struct ArrayGpencilModifierData { |