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:
authorAntonioya <blendergit@gmail.com>2018-10-24 11:31:48 +0300
committerAntonioya <blendergit@gmail.com>2018-10-24 11:32:03 +0300
commit5af716620ad362dbb119dd1682b19ed230ba7201 (patch)
treea0235e0a247eb54fdec02e9d33ebdf21cd00e24a /source/blender/gpencil_modifiers
parent058936861591d16703f67e5c4b1dd8cb593630ed (diff)
GP: Add new modes to Time Offset modifier
Diffstat (limited to 'source/blender/gpencil_modifiers')
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
index c72a20cc0e9..0096c6c00d5 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
@@ -71,8 +71,6 @@ static int remapTime(
TimeGpencilModifierData *mmd = (TimeGpencilModifierData *)md;
const int sfra = scene->r.sfra;
const int efra = scene->r.efra;
- const int nfra = cfra + mmd->offset;
-
const bool invgpl = mmd->flag & GP_SIMPLIFY_INVERT_LAYER;
/* omit if filter by layer */
@@ -89,6 +87,16 @@ static int remapTime(
}
}
+ /* if fix mode, return predefined frame number */
+ if (mmd->mode == GP_TIME_MODE_FIX) {
+ return mmd->offset;
+ }
+
+ /* invert current frame number */
+ if (mmd->mode == GP_TIME_MODE_REVERSE) {
+ cfra = efra - cfra + sfra;
+ }
+
/* apply frame scale */
cfra *= mmd->frame_scale;
if (cfra > efra) {
@@ -96,6 +104,8 @@ static int remapTime(
}
if (mmd->flag & GP_TIME_KEEP_LOOP) {
+ const int nfra = cfra + mmd->offset;
+
/* if the sum of the cfra is out scene frame range, recalc */
if (cfra + mmd->offset < sfra) {
const int delta = abs(sfra - nfra);
@@ -114,8 +124,7 @@ GpencilModifierTypeInfo modifierType_Gpencil_Time = {
/* structName */ "TimeGpencilModifierData",
/* structSize */ sizeof(TimeGpencilModifierData),
/* type */ eGpencilModifierTypeType_Gpencil,
- /* flags */ eGpencilModifierTypeFlag_Single |
- eGpencilModifierTypeFlag_NoApply,
+ /* flags */ eGpencilModifierTypeFlag_NoApply,
/* copyData */ copyData,