diff options
author | Aleš Jelovčan <frogstomp> | 2022-09-27 18:47:01 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2022-09-27 18:55:43 +0300 |
commit | b0d70a9c80402e8b7af173a76e9a8b6050598825 (patch) | |
tree | cc2d98fe527473e16052ab09adf6ed5615a07f61 /source/blender/makesdna | |
parent | 12fdf9069abe3cd2250a9efec6e059eb85ec59d8 (diff) |
Gpencil: Time Offset modifier new Chain mode
This patch adds 5th mode to Time offset modifier, which should allow
to create time segments list.
This will allow users to chain together multiple time ranges in 4 modes:
- Forward
- Backwards
- Pingpong
- Reverse Pingpong
It also comes with additional Repeat parameter which specifies number
of times particular segment should run.
The mechanic of it is transforming initial parameters into array of frames which
are mapped to existing cfra (current frame) value.
Prototype : https://jsfiddle.net/ha2sjw8p/3/
This is also closely aligned to community request:
https://blender.community/c/rightclickselect/Txhbbc/
This should allow creation of complex animations like dancing,
which consists of repeating loops and transitions to the next.
One important side effect of this is dramatically reduced
file sizes, as user no longer needs to copy paste keyframes.
Reviewed By: antoniov, mendio, pepeland
Differential Revision: https://developer.blender.org/D15052
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_gpencil_modifier_defaults.h | 12 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_gpencil_modifier_types.h | 23 | ||||
-rw-r--r-- | source/blender/makesdna/intern/dna_defaults.c | 2 |
3 files changed, 37 insertions, 0 deletions
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_defaults.h b/source/blender/makesdna/DNA_gpencil_modifier_defaults.h index 56e317adca5..8078283df7a 100644 --- a/source/blender/makesdna/DNA_gpencil_modifier_defaults.h +++ b/source/blender/makesdna/DNA_gpencil_modifier_defaults.h @@ -262,6 +262,18 @@ .mode = 0, \ .sfra = 1, \ .efra = 250, \ + .segments = NULL, \ + .segments_len = 1, \ + .segment_active_index = 0, \ + } + + #define _DNA_DEFAULT_TimeGpencilModifierSegment \ + { \ + .name = "", \ + .seg_start = 1, \ + .seg_end = 2, \ + .seg_mode = 0, \ + .seg_repeat = 1, \ } #define _DNA_DEFAULT_TintGpencilModifierData \ diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h index 629be51893a..0932b7107bb 100644 --- a/source/blender/makesdna/DNA_gpencil_modifier_types.h +++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h @@ -202,8 +202,18 @@ typedef enum eThickGpencil_Flag { GP_THICK_WEIGHT_FACTOR = (1 << 7), } eThickGpencil_Flag; +typedef struct TimeGpencilModifierSegment { + char name[64]; + /* For path reference. */ + struct TimeGpencilModifierData *gpmd; + int seg_start; + int seg_end; + int seg_mode; + int seg_repeat; +} TimeGpencilModifierSegment; typedef struct TimeGpencilModifierData { GpencilModifierData modifier; + struct Material *material; /** Layer name. */ char layername[64]; /** Custom index for passes. */ @@ -216,7 +226,13 @@ typedef struct TimeGpencilModifierData { int mode; /** Start and end frame for custom range. */ int sfra, efra; + char _pad[4]; + + TimeGpencilModifierSegment *segments; + int segments_len; + int segment_active_index; + } TimeGpencilModifierData; typedef enum eTimeGpencil_Flag { @@ -231,8 +247,15 @@ typedef enum eTimeGpencil_Mode { GP_TIME_MODE_REVERSE = 1, GP_TIME_MODE_FIX = 2, GP_TIME_MODE_PINGPONG = 3, + GP_TIME_MODE_CHAIN = 4, } eTimeGpencil_Mode; +typedef enum eTimeGpencil_Seg_Mode { + GP_TIME_SEG_MODE_NORMAL = 0, + GP_TIME_SEG_MODE_REVERSE = 1, + GP_TIME_SEG_MODE_PINGPONG = 2, +} eTimeGpencil_Seg_Mode; + typedef enum eModifyColorGpencil_Flag { GP_MODIFY_COLOR_BOTH = 0, GP_MODIFY_COLOR_STROKE = 1, diff --git a/source/blender/makesdna/intern/dna_defaults.c b/source/blender/makesdna/intern/dna_defaults.c index 3cd0cbcc3d6..309756ff2da 100644 --- a/source/blender/makesdna/intern/dna_defaults.c +++ b/source/blender/makesdna/intern/dna_defaults.c @@ -309,6 +309,7 @@ SDNA_DEFAULT_DECL_STRUCT(SubdivGpencilModifierData); SDNA_DEFAULT_DECL_STRUCT(TextureGpencilModifierData); SDNA_DEFAULT_DECL_STRUCT(ThickGpencilModifierData); SDNA_DEFAULT_DECL_STRUCT(TimeGpencilModifierData); +SDNA_DEFAULT_DECL_STRUCT(TimeGpencilModifierSegment); SDNA_DEFAULT_DECL_STRUCT(TintGpencilModifierData); SDNA_DEFAULT_DECL_STRUCT(WeightProxGpencilModifierData); SDNA_DEFAULT_DECL_STRUCT(WeightAngleGpencilModifierData); @@ -551,6 +552,7 @@ const void *DNA_default_table[SDNA_TYPE_MAX] = { SDNA_DEFAULT_DECL(ThickGpencilModifierData), SDNA_DEFAULT_DECL(TimeGpencilModifierData), SDNA_DEFAULT_DECL(TintGpencilModifierData), + SDNA_DEFAULT_DECL(TimeGpencilModifierSegment), SDNA_DEFAULT_DECL(WeightAngleGpencilModifierData), SDNA_DEFAULT_DECL(WeightProxGpencilModifierData), SDNA_DEFAULT_DECL(LineartGpencilModifierData), |