Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2021-07-02 13:04:07 +0300
committerAntonio Vazquez <blendergit@gmail.com>2021-07-02 13:04:07 +0300
commit29b65f5345128ee035599aa7233315a74fe6afe6 (patch)
tree7ba21663688b5eca67c1884a8da5e0aa9a125c64 /source/blender/makesdna
parent9f5c0ffb5ec293af2e4f003c2178d21e20805b47 (diff)
GPencil: New modifier to generate weights dynamically
his new modifier allows to generate weights base on: * Angle of the stroke relative to object or world orientation. For example, if the value is 90, the maximum weights will be for vertical lines and minimum for horizontal lines. * Distance to Target object. The distance calculated is normalized to get valid weights between 0 and 1.0. The weights are created in an existing vertex group and the data can be replaced or mixed with the existing value to combine different weight effects. The minimum parameter, allows to define the minimum weight generated. This is useful to avoid very low weights. The generated weights can be used in any modifier. For example, the angle weight value can be used to mimic FreeStyle Caligraphy modifier using the weight with the thickness modifier. Also some modifier has been changed to inlude a new option to use the weights as factor of the effect. As result of this change, the fading option has been removed from Thickness and Opacity modifiers because this can be done using the new modifier, it's not logic to repeat the same. Reviewed By: mendio, filedescriptor Differential Revision: https://developer.blender.org/D11604
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r--source/blender/makesdna/DNA_gpencil_modifier_defaults.h18
-rw-r--r--source/blender/makesdna/DNA_gpencil_modifier_types.h77
-rw-r--r--source/blender/makesdna/intern/dna_defaults.c2
3 files changed, 77 insertions, 20 deletions
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_defaults.h b/source/blender/makesdna/DNA_gpencil_modifier_defaults.h
index a4ab38f6022..b9697beeea9 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_defaults.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_defaults.h
@@ -184,8 +184,6 @@
.layer_pass = 0, \
.hardeness = 1.0f, \
.curve_intensity = NULL, \
- .fading_end = 10.0f, \
- .fading_end_factor = 0.2f, \
}
#define _DNA_DEFAULT_SimplifyGpencilModifierData \
@@ -253,8 +251,6 @@
.thickness_fac = 1.0f, \
.thickness = 30, \
.layer_pass = 0, \
- .fading_end = 10.0f, \
- .fading_end_factor = 0.2f, \
}
#define _DNA_DEFAULT_TimeGpencilModifierData \
@@ -287,6 +283,20 @@
.colorband = NULL, \
}
+#define _DNA_DEFAULT_WeightGpencilModifierData \
+ { \
+ .target_vgname = "", \
+ .material = NULL, \
+ .layername = "", \
+ .vgname = "", \
+ .pass_index = 0, \
+ .flag = 0, \
+ .axis = 1, \
+ .layer_pass = 0, \
+ .dist_start = 0.0f, \
+ .dist_end = 20.0f, \
+ }
+
#define _DNA_DEFAULT_LineartGpencilModifierData \
{ \
.edge_types = LRT_EDGE_FLAG_ALL_TYPE, \
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h
index 40e4c65c4b8..fac5bd3d4f4 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_types.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h
@@ -55,6 +55,7 @@ typedef enum GpencilModifierType {
eGpencilModifierType_Texture = 18,
eGpencilModifierType_Lineart = 19,
eGpencilModifierType_Length = 20,
+ eGpencilModifierType_Weight = 21,
/* Keep last. */
NUM_GREASEPENCIL_MODIFIER_TYPES,
} GpencilModifierType;
@@ -188,12 +189,7 @@ typedef struct ThickGpencilModifierData {
int thickness;
/** Custom index for passes. */
int layer_pass;
- /** Start/end distances of the fading effect. */
- float fading_start;
- float fading_end;
- float fading_end_factor;
- /** Fading reference object */
- struct Object *object;
+ char _pad[4];
struct CurveMapping *curve_thickness;
} ThickGpencilModifierData;
@@ -205,7 +201,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),
+ GP_THICK_WEIGHT_FACTOR = (1 << 7),
} eThickGpencil_Flag;
typedef struct TimeGpencilModifierData {
@@ -298,16 +294,9 @@ 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 _pad1[3];
+ char _pad[3];
/** Custom index for passes. */
int layer_pass;
@@ -323,7 +312,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),
+ GP_OPACITY_WEIGHT_FACTOR = (1 << 8),
} eOpacityGpencil_Flag;
typedef struct ArrayGpencilModifierData {
@@ -814,6 +803,7 @@ typedef enum eTintGpencil_Flag {
GP_TINT_INVERT_LAYERPASS = (1 << 4),
GP_TINT_INVERT_MATERIAL = (1 << 5),
GP_TINT_CUSTOM_CURVE = (1 << 6),
+ GP_TINT_WEIGHT_FACTOR = (1 << 7),
} eTintGpencil_Flag;
typedef struct TextureGpencilModifierData {
@@ -867,6 +857,61 @@ typedef enum eTextureGpencil_Mode {
STROKE_AND_FILL = 2,
} eTextureGpencil_Mode;
+typedef struct WeightGpencilModifierData {
+ GpencilModifierData modifier;
+ /** Target vertexgroup name, MAX_VGROUP_NAME. */
+ char target_vgname[64];
+ /** Material for filtering. */
+ struct Material *material;
+ /** Layer name. */
+ char layername[64];
+ /** Optional vertexgroup filter name, MAX_VGROUP_NAME. */
+ char vgname[64];
+ /** Custom index for passes. */
+ int pass_index;
+ /** Flags. */
+ int flag;
+ /** Minimum valid weight (clamp value). */
+ float min_weight;
+ /** Custom index for passes. */
+ int layer_pass;
+ /** Calculation Mode. */
+ short mode;
+ /** Axis. */
+ short axis;
+ /** Angle */
+ float angle;
+ /** Start/end distances. */
+ float dist_start;
+ float dist_end;
+ /** Space (Local/World). */
+ short space;
+ char _pad[6];
+
+ /** Reference object */
+ struct Object *object;
+} WeightGpencilModifierData;
+
+typedef enum eWeightGpencil_Flag {
+ GP_WEIGHT_INVERT_LAYER = (1 << 0),
+ GP_WEIGHT_INVERT_PASS = (1 << 1),
+ GP_WEIGHT_INVERT_VGROUP = (1 << 2),
+ GP_WEIGHT_INVERT_LAYERPASS = (1 << 3),
+ GP_WEIGHT_INVERT_MATERIAL = (1 << 4),
+ GP_WEIGHT_BLEND_DATA = (1 << 5),
+ GP_WEIGHT_INVERT_OUTPUT = (1 << 6),
+} eWeightGpencil_Flag;
+
+typedef enum eWeightGpencilModifierMode {
+ GP_WEIGHT_MODE_DISTANCE = 0,
+ GP_WEIGHT_MODE_ANGLE = 1,
+} eWeightGpencilModifierMode;
+
+typedef enum eGpencilModifierSpace {
+ GP_SPACE_LOCAL = 0,
+ GP_SPACE_WORLD = 1,
+} eGpencilModifierSpace;
+
typedef enum eLineartGpencilModifierSource {
LRT_SOURCE_COLLECTION = 0,
LRT_SOURCE_OBJECT = 1,
diff --git a/source/blender/makesdna/intern/dna_defaults.c b/source/blender/makesdna/intern/dna_defaults.c
index 2d55ea05867..03f7dbf6489 100644
--- a/source/blender/makesdna/intern/dna_defaults.c
+++ b/source/blender/makesdna/intern/dna_defaults.c
@@ -315,6 +315,7 @@ SDNA_DEFAULT_DECL_STRUCT(TextureGpencilModifierData);
SDNA_DEFAULT_DECL_STRUCT(ThickGpencilModifierData);
SDNA_DEFAULT_DECL_STRUCT(TimeGpencilModifierData);
SDNA_DEFAULT_DECL_STRUCT(TintGpencilModifierData);
+SDNA_DEFAULT_DECL_STRUCT(WeightGpencilModifierData);
SDNA_DEFAULT_DECL_STRUCT(LineartGpencilModifierData);
SDNA_DEFAULT_DECL_STRUCT(LengthGpencilModifierData);
@@ -541,6 +542,7 @@ const void *DNA_default_table[SDNA_TYPE_MAX] = {
SDNA_DEFAULT_DECL(ThickGpencilModifierData),
SDNA_DEFAULT_DECL(TimeGpencilModifierData),
SDNA_DEFAULT_DECL(TintGpencilModifierData),
+ SDNA_DEFAULT_DECL(WeightGpencilModifierData),
SDNA_DEFAULT_DECL(LineartGpencilModifierData),
SDNA_DEFAULT_DECL(LengthGpencilModifierData),
};