}
ValueBase
-ValueNode_BLineCalcWidth::operator()(Time t)const
+ValueNode_BLineCalcWidth::operator()(Time t, Real amount)const
{
const std::vector<ValueBase> bline((*bline_)(t));
handle<ValueNode_BLine> bline_value_node(bline_);
const bool looped(bline_value_node->get_loop());
int size = bline.size(), from_vertex;
bool loop((*loop_)(t).get(bool()));
- Real amount((*amount_)(t).get(Real()));
Real scale((*scale_)(t).get(Real()));
BLinePoint blinepoint0, blinepoint1;
return Real((width0 + (amount-from_vertex) * (width1-width0)) * scale);
}
+ValueBase
+ValueNode_BLineCalcWidth::operator()(Time t)const
+{
+ Real amount((*amount_)(t).get(Real()));
+ return (*this)(t, amount);
+}
+
String
ValueNode_BLineCalcWidth::get_name()const
{
typedef etl::handle<ValueNode_BLineCalcWidth> Handle;
typedef etl::handle<const ValueNode_BLineCalcWidth> ConstHandle;
+ virtual ValueBase operator()(Time t, Real amount)const;
virtual ValueBase operator()(Time t)const;
virtual ~ValueNode_BLineCalcWidth();
#include <synfig/valuenode_stripes.h>
#include <synfig/valuenode_blinecalctangent.h>
#include <synfig/valuenode_blinecalcvertex.h>
+#include <synfig/valuenode_blinecalcwidth.h>
#include <synfig/valuenode_bline.h>
#include <synfig/layer.h>
switch(value_desc.get_value_type())
{
case ValueBase::TYPE_REAL:
+ if (ValueNode_BLineCalcWidth::Handle bline_width = ValueNode_BLineCalcWidth::Handle::cast_dynamic(value_desc.get_value_node()))
+ {
+ Real old_width((*bline_width)(get_time()).get(Real()));
+ Real new_width(value.mag());
+ int scale_index(bline_width->get_link_index_from_name("scale"));
+ Real scale((*(bline_width->get_link(scale_index)))(get_time()).get(Real()));
+ if (!(canvas_interface()->change_value(synfigapp::ValueDesc(bline_width,scale_index),
+ new_width * scale / old_width)))
+ return false;
+ }
return canvas_interface()->change_value(value_desc,value.mag());
break;
case ValueBase::TYPE_ANGLE:
#include <synfig/valuenode_bline.h>
#include <synfig/valuenode_blinecalctangent.h>
#include <synfig/valuenode_blinecalcvertex.h>
+#include <synfig/valuenode_blinecalcwidth.h>
#include <synfig/curve_helper.h>
{
int t1_index(value_node_composite->get_link_index_from_name("t1"));
int t2_index(value_node_composite->get_link_index_from_name("t2"));
+ int width_index(value_node_composite->get_link_index_from_name("width"));
+
ValueNode::Handle t1_value_node(value_node_composite->get_link(t1_index));
ValueNode::Handle t2_value_node(value_node_composite->get_link(t2_index));
+ ValueNode::Handle width_value_node(value_node_composite->get_link(width_index));
+
ValueNode_BLineCalcTangent::Handle bline_tangent_1(ValueNode_BLineCalcTangent::Handle::cast_dynamic(t1_value_node));
ValueNode_BLineCalcTangent::Handle bline_tangent_2(ValueNode_BLineCalcTangent::Handle::cast_dynamic(t2_value_node));
+ ValueNode_BLineCalcWidth::Handle bline_width(ValueNode_BLineCalcWidth::Handle::cast_dynamic(width_value_node));
- if (bline_tangent_1 || bline_tangent_2)
+ if (bline_tangent_1 || bline_tangent_2 || bline_width)
{
synfig::Real radius = 0.0;
ValueNode_BLine::Handle bline(ValueNode_BLine::Handle::cast_dynamic(bline_vertex->get_link(bline_vertex->get_link_index_from_name("bline"))));
if ((*iter)->get_value_desc().get_value_node() == t2_value_node)
(*iter)->set_point(tangent);
}
+
+ if (bline_width)
+ {
+ Real width = (*bline_width)(time, amount).get(Real());
+ DuckList::iterator iter;
+ for (iter=duck_list.begin(); iter!=duck_list.end(); iter++)
+ if ((*iter)->get_value_desc().get_value_node() == width_value_node)
+ (*iter)->set_point(Point(width, 0));
+ }
}
}
}
#include <synfig/valuenode_composite.h>
#include <synfig/valuenode_radialcomposite.h>
#include <synfig/valuenode_reference.h>
-#include <synfig/valuenode_blinecalcvertex.h>
#include <synfig/valuenode_blinecalctangent.h>
+#include <synfig/valuenode_blinecalcvertex.h>
+#include <synfig/valuenode_blinecalcwidth.h>
#include <map>
#include "general.h"
|| ValueNode_Reference::Handle::cast_dynamic(value_node)
|| ValueNode_BLineCalcVertex::Handle::cast_dynamic(value_node)
|| ValueNode_BLineCalcTangent::Handle::cast_dynamic(value_node)
+ || ValueNode_BLineCalcWidth::Handle::cast_dynamic(value_node)
)
return true;
return false;