From 090a7e54cb07e69b128dfe79f71bb3ed42b4392c Mon Sep 17 00:00:00 2001 From: dooglus Date: Wed, 30 Jan 2008 23:53:34 +0000 Subject: [PATCH] Fix 1883030: Version 0.1 of the timeloop layer acted as if it wasn't there whenever its start_time wasn't strictly less than its end_time, whereas the current version works with both positive and negative values for 'duration'. This was causing problems with old .sif files which use animated valuenodes for start_time and/or end_time, since we couldn't easily convert them to produce the same results with the new layer type. This commit adds a new parameter to the timeloop layer to cause the layer to disable itself for non-positive durations, allowing compatibility with old .sif files. git-svn-id: http://svn.voria.com/code@1528 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/src/modules/lyr_std/timeloop.cpp | 14 ++++++++++++-- synfig-core/trunk/src/modules/lyr_std/timeloop.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/synfig-core/trunk/src/modules/lyr_std/timeloop.cpp b/synfig-core/trunk/src/modules/lyr_std/timeloop.cpp index d7a6c57..6ec7db4 100644 --- a/synfig-core/trunk/src/modules/lyr_std/timeloop.cpp +++ b/synfig-core/trunk/src/modules/lyr_std/timeloop.cpp @@ -66,6 +66,7 @@ SYNFIG_LAYER_SET_CVS_ID(Layer_TimeLoop,"$Id$"); Layer_TimeLoop::Layer_TimeLoop() { old_version=false; + only_for_positive_duration=false; link_time=0; local_time=0; duration=1; @@ -88,6 +89,7 @@ Layer_TimeLoop::set_param(const String & param, const ValueBase &value) IMPORT(local_time); IMPORT(link_time); IMPORT(duration); + IMPORT(only_for_positive_duration); } return Layer::set_param(param,value); @@ -99,6 +101,7 @@ Layer_TimeLoop::get_param(const String & param)const EXPORT(link_time); EXPORT(local_time); EXPORT(duration); + EXPORT(only_for_positive_duration); EXPORT_NAME(); EXPORT_VERSION(); @@ -122,6 +125,10 @@ Layer_TimeLoop::get_param_vocab()const .set_local_name(_("Duration")) ); + ret.push_back(ParamDesc("only_for_positive_duration") + .set_local_name(_("Only For Positive Duration")) + ); + return ret; } @@ -155,6 +162,8 @@ Layer_TimeLoop::reset_version() // convert the static parameters local_time = start_time; duration = end_time - start_time; + only_for_positive_duration = true; + //! \todo layer version 0.1 acted differently before start_time was reached - possibly due to a bug link_time = 0; @@ -190,13 +199,14 @@ Layer_TimeLoop::reset_version() connect_dynamic_param("local_time", start_time_value_node); connect_dynamic_param("duration", duration_value_node); - connect_dynamic_param("link_time", ValueNode_Const::create(Time(0))); } void Layer_TimeLoop::set_time(Context context, Time t)const { - if (duration == 0) + if (only_for_positive_duration && duration <= 0) + ; // don't change the time + else if (duration == 0) t = link_time; else if (duration > 0) { diff --git a/synfig-core/trunk/src/modules/lyr_std/timeloop.h b/synfig-core/trunk/src/modules/lyr_std/timeloop.h index e1c9afa..8ecb6ee 100644 --- a/synfig-core/trunk/src/modules/lyr_std/timeloop.h +++ b/synfig-core/trunk/src/modules/lyr_std/timeloop.h @@ -50,6 +50,7 @@ private: synfig::Time start_time; synfig::Time end_time; bool old_version; + bool only_for_positive_duration; protected: Layer_TimeLoop(); -- 2.7.4