From a36569b0f414c9964a8232f54820aee9f34b8379 Mon Sep 17 00:00:00 2001 From: dooglus Date: Wed, 26 Dec 2007 16:36:28 +0000 Subject: [PATCH] Use the current value of a parameter when converting it, rather than its value at time zero. git-svn-id: http://svn.voria.com/code@1230 1f10aa63-cdf2-0310-b900-c93c546f37ac --- .../trunk/src/synfigapp/actions/valuedescconvert.cpp | 19 ++++++++++++++++++- .../trunk/src/synfigapp/actions/valuedescconvert.h | 1 + synfig-studio/trunk/src/synfigapp/canvasinterface.cpp | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/synfig-studio/trunk/src/synfigapp/actions/valuedescconvert.cpp b/synfig-studio/trunk/src/synfigapp/actions/valuedescconvert.cpp index 3911d7d..2d894a3 100644 --- a/synfig-studio/trunk/src/synfigapp/actions/valuedescconvert.cpp +++ b/synfig-studio/trunk/src/synfigapp/actions/valuedescconvert.cpp @@ -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?)")); diff --git a/synfig-studio/trunk/src/synfigapp/actions/valuedescconvert.h b/synfig-studio/trunk/src/synfigapp/actions/valuedescconvert.h index 5c5da78..5761333 100644 --- a/synfig-studio/trunk/src/synfigapp/actions/valuedescconvert.h +++ b/synfig-studio/trunk/src/synfigapp/actions/valuedescconvert.h @@ -48,6 +48,7 @@ private: ValueDesc value_desc; synfig::String type; + synfig::Time time; public: diff --git a/synfig-studio/trunk/src/synfigapp/canvasinterface.cpp b/synfig-studio/trunk/src/synfigapp/canvasinterface.cpp index 87971c0..bc2f180 100644 --- a/synfig-studio/trunk/src/synfigapp/canvasinterface.cpp +++ b/synfig-studio/trunk/src/synfigapp/canvasinterface.cpp @@ -296,6 +296,7 @@ CanvasInterface::convert(ValueDesc value_desc, synfig::String type) action->set_param("canvas_interface",etl::loose_handle(this)); action->set_param("value_desc",value_desc); action->set_param("type",type); + action->set_param("time",get_time()); if(!action->is_ready()) { -- 2.7.4