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:
authorYimingWu <xp8110@outlook.com>2021-09-15 09:24:28 +0300
committerYimingWu <xp8110@outlook.com>2021-09-15 09:38:32 +0300
commita2c5c2b4068d12e26a8c9d640a389b410c7507f3 (patch)
tree95cecf0a24aee13ffb6feb90892622b8841409cf /source/blender/makesdna
parentc1cf66bff3c0753512a2d1f2f8c03430bdd1f045 (diff)
GPencil: Dot dash modifier.
Create dot-dash effect for grease pencil strokes. User can manually edit the length, gap and styles for each segment of dashed lines. The values in each segment can all be key-framed to make animations. Reviewed By: Hans Goudey (HooglyBoogly), Antonio Vazquez (antoniov) Differential Revision: http://developer.blender.org/D11876
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.h34
-rw-r--r--source/blender/makesdna/intern/dna_defaults.c4
3 files changed, 56 insertions, 0 deletions
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_defaults.h b/source/blender/makesdna/DNA_gpencil_modifier_defaults.h
index 8ab15b97537..450527c7443 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_defaults.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_defaults.h
@@ -319,5 +319,23 @@
.material = NULL,\
}
+#define _DNA_DEFAULT_DashGpencilModifierData \
+ { \
+ .dash_offset = 0, \
+ .segments = NULL, \
+ .segments_len = 1, \
+ .segment_active_index = 0, \
+ }
+
+#define _DNA_DEFAULT_DashGpencilModifierSegment \
+ { \
+ .name = "", \
+ .dash = 2, \
+ .gap = 1, \
+ .radius = 1.0f, \
+ .opacity = 1.0f, \
+ .mat_nr = -1, \
+ }
+
/* clang-format off */
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h
index c91afa58cb1..d3429329ef6 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_types.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h
@@ -56,6 +56,7 @@ typedef enum GpencilModifierType {
eGpencilModifierType_Lineart = 19,
eGpencilModifierType_Length = 20,
eGpencilModifierType_Weight = 21,
+ eGpencilModifierType_Dash = 22,
/* Keep last. */
NUM_GREASEPENCIL_MODIFIER_TYPES,
} GpencilModifierType;
@@ -507,6 +508,39 @@ typedef enum eLengthGpencil_Type {
GP_LENGTH_ABSOLUTE = 1,
} eLengthGpencil_Type;
+typedef struct DashGpencilModifierSegment {
+ char name[64];
+ /* For path reference. */
+ struct DashGpencilModifierData *dmd;
+ int dash;
+ int gap;
+ float radius;
+ float opacity;
+ int mat_nr;
+ int _pad;
+} DashGpencilModifierSegment;
+
+typedef struct DashGpencilModifierData {
+ GpencilModifierData modifier;
+ /** Material for filtering. */
+ struct Material *material;
+ /** Layer name. */
+ char layername[64];
+ /** Custom index for passes. */
+ int pass_index;
+ /** Flags. */
+ int flag;
+ /** Custom index for passes. */
+ int layer_pass;
+
+ int dash_offset;
+
+ DashGpencilModifierSegment *segments;
+ int segments_len;
+ int segment_active_index;
+
+} DashGpencilModifierData;
+
typedef struct MirrorGpencilModifierData {
GpencilModifierData modifier;
struct Object *object;
diff --git a/source/blender/makesdna/intern/dna_defaults.c b/source/blender/makesdna/intern/dna_defaults.c
index 3570f5a6a6f..4cb8610f6ac 100644
--- a/source/blender/makesdna/intern/dna_defaults.c
+++ b/source/blender/makesdna/intern/dna_defaults.c
@@ -321,6 +321,8 @@ SDNA_DEFAULT_DECL_STRUCT(TintGpencilModifierData);
SDNA_DEFAULT_DECL_STRUCT(WeightGpencilModifierData);
SDNA_DEFAULT_DECL_STRUCT(LineartGpencilModifierData);
SDNA_DEFAULT_DECL_STRUCT(LengthGpencilModifierData);
+SDNA_DEFAULT_DECL_STRUCT(DashGpencilModifierData);
+SDNA_DEFAULT_DECL_STRUCT(DashGpencilModifierSegment);
#undef SDNA_DEFAULT_DECL_STRUCT
@@ -549,6 +551,8 @@ const void *DNA_default_table[SDNA_TYPE_MAX] = {
SDNA_DEFAULT_DECL(WeightGpencilModifierData),
SDNA_DEFAULT_DECL(LineartGpencilModifierData),
SDNA_DEFAULT_DECL(LengthGpencilModifierData),
+ SDNA_DEFAULT_DECL(DashGpencilModifierData),
+ SDNA_DEFAULT_DECL(DashGpencilModifierSegment),
};
#undef SDNA_DEFAULT_DECL
#undef SDNA_DEFAULT_DECL_EX