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:
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c24
-rw-r--r--source/blender/makesdna/DNA_gpencil_modifier_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_gpencil_modifier.c1
3 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
index c576cfbe525..414231fcae5 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
@@ -122,6 +122,30 @@ static int remapTime(struct GpencilModifierData *md,
nfra = (efra + 1 - (cfra + offset - 1) % (efra - sfra + 1)) - 1;
}
}
+
+ if (mmd->mode == GP_TIME_MODE_PINGPONG) {
+ if ((mmd->flag & GP_TIME_KEEP_LOOP) == 0) {
+ if (((int)(cfra + offset - 1) / (efra - sfra)) % (2)) {
+ nfra = efra - (cfra + offset - 1) % (efra - sfra);
+ }
+ else {
+ nfra = sfra + (cfra + offset - 1) % (efra - sfra);
+ }
+ if (cfra > (efra - sfra) * 2) {
+ nfra = sfra + offset;
+ }
+ }
+ else {
+
+ if (((int)(cfra + offset - 1) / (efra - sfra)) % (2)) {
+ nfra = efra - (cfra + offset - 1) % (efra - sfra);
+ }
+ else {
+ nfra = sfra + (cfra + offset - 1) % (efra - sfra);
+ }
+ }
+ }
+
return nfra;
}
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h
index 535533565dd..c20fb180fcd 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_types.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h
@@ -229,6 +229,7 @@ typedef enum eTimeGpencil_Mode {
GP_TIME_MODE_NORMAL = 0,
GP_TIME_MODE_REVERSE = 1,
GP_TIME_MODE_FIX = 2,
+ GP_TIME_MODE_PINGPONG = 3,
} eTimeGpencil_Mode;
typedef enum eModifyColorGpencil_Flag {
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index 778f5647417..ea2bb9630fb 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -195,6 +195,7 @@ static const EnumPropertyItem rna_enum_time_mode_items[] = {
{GP_TIME_MODE_NORMAL, "NORMAL", 0, "Regular", "Apply offset in usual animation direction"},
{GP_TIME_MODE_REVERSE, "REVERSE", 0, "Reverse", "Apply offset in reverse animation direction"},
{GP_TIME_MODE_FIX, "FIX", 0, "Fixed Frame", "Keep frame and do not change with time"},
+ {GP_TIME_MODE_PINGPONG, "PINGPONG", 0, "Ping Pong", "Loop back and forth"},
{0, NULL, 0, NULL, NULL},
};