diff options
author | Antonioya <blendergit@gmail.com> | 2018-10-24 11:31:48 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2018-10-24 11:32:03 +0300 |
commit | 5af716620ad362dbb119dd1682b19ed230ba7201 (patch) | |
tree | a0235e0a247eb54fdec02e9d33ebdf21cd00e24a /source/blender/gpencil_modifiers | |
parent | 058936861591d16703f67e5c4b1dd8cb593630ed (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.c | 17 |
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, |