diff options
-rw-r--r-- | intern/cycles/kernel/svm/displace.h | 1 | ||||
-rw-r--r-- | source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c | 68 |
2 files changed, 21 insertions, 48 deletions
diff --git a/intern/cycles/kernel/svm/displace.h b/intern/cycles/kernel/svm/displace.h index 56fb5c3f9b0..128023263fd 100644 --- a/intern/cycles/kernel/svm/displace.h +++ b/intern/cycles/kernel/svm/displace.h @@ -188,6 +188,7 @@ ccl_device_noinline int svm_node_vector_displacement( else { stack_store_float3(stack, displacement_offset, zero_float3()); + (void)data_node; } return offset; diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c index bf2e9a86817..c576cfbe525 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c @@ -58,18 +58,19 @@ static int remapTime(struct GpencilModifierData *md, const bool invpass = mmd->flag & GP_TIME_INVERT_LAYERPASS; int sfra = custom ? mmd->sfra : scene->r.sfra; int efra = custom ? mmd->efra : scene->r.efra; + int offset = mmd->offset; + int nfra = 0; CLAMP_MIN(sfra, 0); CLAMP_MIN(efra, 0); + if (offset < 0) { + offset = abs(efra - sfra + offset + 1); + } /* Avoid inverse ranges. */ - if (efra < sfra) { + if (efra <= sfra) { return cfra; } - const int time_range = efra - sfra + 1; - int offset = mmd->offset; - int segments = 0; - /* omit if filter by layer */ if (mmd->layername[0] != '\0') { if (invgpl == false) { @@ -97,60 +98,31 @@ static int remapTime(struct GpencilModifierData *md, } } - /* if fix mode, return predefined frame number */ - if (mmd->mode == GP_TIME_MODE_FIX) { - return offset; - } - - /* invert current frame number */ - if (mmd->mode == GP_TIME_MODE_REVERSE) { - cfra = efra - cfra + sfra; - } - /* apply frame scale */ cfra *= mmd->frame_scale; - /* verify offset never is greater than frame range */ - if (abs(offset) > time_range) { - offset = offset - ((offset / time_range) * time_range); + /* if fix mode, return predefined frame number */ + if (mmd->mode == GP_TIME_MODE_FIX) { + return offset; } - /* verify not outside range if loop is disabled */ - if ((mmd->flag & GP_TIME_KEEP_LOOP) == 0) { - if (cfra + offset < sfra) { - return sfra; + if (mmd->mode == GP_TIME_MODE_NORMAL) { + if ((mmd->flag & GP_TIME_KEEP_LOOP) == 0) { + nfra = cfra + sfra + offset - 1 < efra ? cfra + sfra + offset - 1 : efra; } - if (cfra + offset > efra) { - return efra; + else { + nfra = (offset + cfra - 1) % (efra - sfra + 1) + sfra; } } - - /* check frames before start */ - if (cfra < sfra) { - segments = ((cfra + sfra) / time_range); - cfra = cfra + (segments * time_range); - } - - /* check frames after end */ - if (cfra > efra) { - segments = ((cfra - sfra) / time_range); - cfra = cfra - (segments * time_range); - } - - if (mmd->flag & GP_TIME_KEEP_LOOP) { - const int nfra = cfra + offset; - - /* if the sum of the cfra is out scene frame range, recalc */ - if (cfra + offset < sfra) { - const int delta = abs(sfra - nfra); - return efra - delta + 1; + if (mmd->mode == GP_TIME_MODE_REVERSE) { + if ((mmd->flag & GP_TIME_KEEP_LOOP) == 0) { + nfra = efra - cfra - offset > sfra ? efra - cfra - offset + 1 : sfra; } - if (cfra + offset > efra) { - return nfra - efra + sfra - 1; + else { + nfra = (efra + 1 - (cfra + offset - 1) % (efra - sfra + 1)) - 1; } } - - return cfra + offset; + return nfra; } static void panel_draw(const bContext *UNUSED(C), Panel *panel) |