/* === S Y N F I G ========================================================= */
/*! \file valuenode_animated.cpp
-** \brief Template File
+** \brief Implementation of the "Animated" valuenode conversion.
**
** $Id$
**
}
else
{
+ const Real& t(iter->get_tension()); // Tension
+ const Real& c(iter->get_continuity()); // Continuity
+ const Real& b(iter->get_bias()); // Bias
- const Real& t(iter->get_tension()); // Tension
- const Real& c(iter->get_continuity()); // Continuity
- const Real& b(iter->get_bias()); // Bias
+ // The following line works where the previous line fails.
+ value_type Pp; Pp=curve_list.back().second.p1(); // P_{i-1}
- // The following line works where the previous line fails.
- value_type Pp; Pp=curve_list.back().second.p1(); // P_{i-1}
+ const value_type& Pc(curve.second.p1()); // P_i
+ const value_type& Pn(curve.second.p2()); // P_{i+1}
- const value_type& Pc(curve.second.p1()); // P_i
- const value_type& Pn(curve.second.p2()); // P_{i+1}
+ // TCB
+ value_type vect(static_cast<value_type>
+ (subtract_func(Pc,Pp) *
+ (((1.0-t) * (1.0+c) * (1.0+b)) / 2.0) +
+ (Pn-Pc) * (((1.0-t) * (1.0-c) * (1.0-b)) / 2.0)));
- // TCB
- value_type vect(static_cast<value_type>(subtract_func(Pc,Pp)*(((1.0-t)*(1.0+c)*(1.0+b))/2.0)+(Pn-Pc)*(((1.0-t)*(1.0-c)*(1.0-b))/2.0)));
-
- // Tension Only
- //value_type vect=(value_type)((Pn-Pp)*(1.0-t));
+ // Tension Only
+ //value_type vect=(value_type)((Pn-Pp)*(1.0-t));
- // Linear
- //value_type vect=(value_type)(Pn-Pc);
+ // Linear
+ //value_type vect=(value_type)(Pn-Pc);
- // Debugging stuff
- //synfig::info("%d:t1: %s",i,tangent_info(Pp,Pn,vect).c_str());
+ // Debugging stuff
+ //synfig::info("%d:t1: %s",i,tangent_info(Pp,Pn,vect).c_str());
- // Adjust for time
- //vect=value_type(vect*(curve.second.get_dt()*2.0)/(curve.second.get_dt()+curve_list.back().second.get_dt()));
- //vect=value_type(vect*(curve.second.get_dt())/(curve_list.back().second.get_dt()));
+ // Adjust for time
+ //vect=value_type(vect*(curve.second.get_dt()*2.0)/(curve.second.get_dt()+curve_list.back().second.get_dt()));
+ //vect=value_type(vect*(curve.second.get_dt())/(curve_list.back().second.get_dt()));
- curve.second.t1()=vect;
+ curve.second.t1()=vect;
}
}
else if(
// if this isn't the first curve
else if(iter_get_after != INTERPOLATION_LINEAR && !curve_list.empty())
// adjust it for the curve that came before it
- curve.second.t1() *=
+ curve.second.t1() = static_cast<T>(curve.second.t1() * // cast to prevent warning
// (time span of this curve) * 1.5
// -----------------------------------------------------------------
// ((time span of this curve) * 0.5) + (time span of previous curve)
- (curve.second.get_dt()*(timeadjust+1)) /
- (curve.second.get_dt()*timeadjust + curve_list.back().second.get_dt());
+ (curve.second.get_dt()*(timeadjust+1)) /
+ (curve.second.get_dt()*timeadjust + curve_list.back().second.get_dt()));
if(next_get_before==INTERPOLATION_HALT)
curve.second.t2()*=0;
// if this isn't the last curve
else if(next_get_before != INTERPOLATION_LINEAR && after_next!=waypoint_list_.end())
// adjust it for the curve that came after it
- curve.second.t2() *=
+ curve.second.t2() = static_cast<T>(curve.second.t2() * // cast to prevent warning
// (time span of this curve) * 1.5
// -------------------------------------------------------------
// ((time span of this curve) * 0.5) + (time span of next curve)
- (curve.second.get_dt()*(timeadjust+1)) /
- (curve.second.get_dt()*timeadjust+(after_next->get_time()-next->get_time()));
+ (curve.second.get_dt()*(timeadjust+1)) /
+ (curve.second.get_dt()*timeadjust+(after_next->get_time()-next->get_time())));
} // not CONSTANT
}
default:
throw
Exception::BadType(strprintf(_("%s: You cannot use a %s in an animated ValueNode"),"synfig::ValueNode_Animated::create()",
- ValueBase::type_name(type).c_str())
+ ValueBase::type_local_name(type).c_str())
);
break;
}