{
old_version=false;
only_for_positive_duration=false;
+ symmetrical=true;
link_time=0;
local_time=0;
duration=1;
IMPORT(link_time);
IMPORT(duration);
IMPORT(only_for_positive_duration);
+ IMPORT(symmetrical);
}
return Layer::set_param(param,value);
EXPORT(local_time);
EXPORT(duration);
EXPORT(only_for_positive_duration);
+ EXPORT(symmetrical);
EXPORT_NAME();
EXPORT_VERSION();
.set_local_name(_("Only For Positive Duration"))
);
+ ret.push_back(ParamDesc("symmetrical")
+ .set_local_name(_("Symmetrical"))
+ );
+
return ret;
}
local_time = start_time;
duration = end_time - start_time;
only_for_positive_duration = true;
+ symmetrical = false;
//! \todo layer version 0.1 acted differently before start_time was reached - possibly due to a bug
link_time = 0;
void
Layer_TimeLoop::set_time(Context context, Time t)const
{
- if (only_for_positive_duration && duration <= 0)
- ; // don't change the time
- else if (duration == 0)
- t = link_time;
- else if (duration > 0)
- {
- t -= local_time;
- t -= floor(t / duration) * duration;
- t = link_time + t;
- }
- else
+ Time time = t;
+
+ if (!only_for_positive_duration || duration > 0)
{
- t -= local_time;
- t -= floor(t / -duration) * -duration;
- t = link_time - t;
+ if (duration == 0)
+ t = link_time;
+ else if (duration > 0)
+ {
+ t -= local_time;
+ t -= floor(t / duration) * duration;
+ t = link_time + t;
+ }
+ else
+ {
+ t -= local_time;
+ t -= floor(t / -duration) * -duration;
+ t = link_time - t;
+ }
+
+ // for compatibility with v0.1 layers; before local_time is reached, take a step back
+ if (!symmetrical && time < local_time)
+ t -= duration;
}
context.set_time(t);