Use the current value of a parameter when converting it, rather than its value at...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Wed, 26 Dec 2007 16:36:28 +0000 (16:36 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Wed, 26 Dec 2007 16:36:28 +0000 (16:36 +0000)
git-svn-id: http://svn.voria.com/code@1230 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-studio/trunk/src/synfigapp/actions/valuedescconvert.cpp
synfig-studio/trunk/src/synfigapp/actions/valuedescconvert.h
synfig-studio/trunk/src/synfigapp/canvasinterface.cpp

index 3911d7d..2d894a3 100644 (file)
@@ -71,6 +71,7 @@ ACTION_SET_CVS_ID(Action::ValueDescConvert,"$Id$");
 
 Action::ValueDescConvert::ValueDescConvert()
 {
+       time=(Time::begin()-1);
 }
 
 Action::ParamVocab
@@ -87,6 +88,10 @@ Action::ValueDescConvert::get_param_vocab()
                .set_desc(_("The type of ValueNode that you want to be converted to"))
        );
 
+       ret.push_back(ParamDesc("time",Param::TYPE_TIME)
+               .set_local_name(_("Time"))
+       );
+
        return ret;
 }
 
@@ -113,6 +118,13 @@ Action::ValueDescConvert::set_param(const synfig::String& name, const Action::Pa
                return true;
        }
 
+       if(name=="time" && param.get_type()==Param::TYPE_TIME)
+       {
+               time=param.get_time();
+
+               return true;
+       }
+
        return Action::CanvasSpecific::set_param(name,param);
 }
 
@@ -121,6 +133,11 @@ Action::ValueDescConvert::is_ready()const
 {
        if(!value_desc || type.empty())
                return false;
+       if(time==(Time::begin()-1))
+       {
+               synfig::error("Missing time");
+               return false;
+       }
        return Action::CanvasSpecific::is_ready();
 }
 
@@ -134,7 +151,7 @@ Action::ValueDescConvert::prepare()
        if(value_desc.is_const())
                value=value_desc.get_value();
        else if(value_desc.is_value_node())
-               value=(*value_desc.get_value_node())(0);
+               value=(*value_desc.get_value_node())(time);
        else
                throw Error(_("Unable to decipher ValueDesc (Bug?)"));
 
index 5c5da78..5761333 100644 (file)
@@ -48,6 +48,7 @@ private:
 
        ValueDesc value_desc;
        synfig::String type;
+       synfig::Time time;
 
 public:
 
index 87971c0..bc2f180 100644 (file)
@@ -296,6 +296,7 @@ CanvasInterface::convert(ValueDesc value_desc, synfig::String type)
        action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
        action->set_param("value_desc",value_desc);
        action->set_param("type",type);
+       action->set_param("time",get_time());
 
        if(!action->is_ready())
        {