/* === S Y N F I G ========================================================= */
/*! \file valuenode_timedswap.cpp
-** \brief Template File
+** \brief Implementation of the "Timed Swap" valuenode conversion.
**
** $Id$
**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+** Copyright (c) 2007 Chris Moore
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
#include "valuenode_const.h"
#include <stdexcept>
#include "color.h"
+#include <ETL/misc>
#endif
set_link("after",ValueNode_Const::create(value.get(Vector())));
break;
default:
- throw Exception::BadType(ValueBase::type_name(get_type()));
+ throw Exception::BadType(ValueBase::type_local_name(get_type()));
}
set_link("time",ValueNode_Const::create(Time(2)));
{
float a=(float)(*after)(t).get(int());
float b=(float)(*before)(t).get(int());
- return static_cast<int>((b-a)*amount+a+0.5f);
+ return round_to_int((b-a)*amount+a);
}
case ValueBase::TYPE_REAL:
{
bool
ValueNode_TimedSwap::set_link_vfunc(int i,ValueNode::Handle x)
{
- assert(i>=0 && i<4);
+ assert(i>=0 && i<link_count());
+
switch(i)
{
case 0: return set_before(x);
ValueNode::LooseHandle
ValueNode_TimedSwap::get_link_vfunc(int i)const
{
- assert(i>=0 && i<4);
+ assert(i>=0 && i<link_count());
+
switch(i)
{
case 0: return get_before();
String
ValueNode_TimedSwap::link_local_name(int i)const
{
- assert(i>=0 && i<4);
+ assert(i>=0 && i<link_count());
+
switch(i)
{
case 0: return _("Before");
String
ValueNode_TimedSwap::link_name(int i)const
{
- assert(i>=0 && i<4);
+ assert(i>=0 && i<link_count());
+
switch(i)
{
case 0: return "before";