Fix 1883030: Version 0.1 of the timeloop layer acted as if it wasn't there whenever...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Wed, 30 Jan 2008 23:53:34 +0000 (23:53 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Wed, 30 Jan 2008 23:53:34 +0000 (23:53 +0000)
git-svn-id: http://svn.voria.com/code@1528 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-core/trunk/src/modules/lyr_std/timeloop.cpp
synfig-core/trunk/src/modules/lyr_std/timeloop.h

index d7a6c57..6ec7db4 100644 (file)
@@ -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)
        {
index e1c9afa..8ecb6ee 100644 (file)
@@ -50,6 +50,7 @@ private:
        synfig::Time    start_time;
        synfig::Time    end_time;
        bool                    old_version;
+       bool                    only_for_positive_duration;
 
 protected:
        Layer_TimeLoop();