diff --git a/synfig-core/src/synfig/valuenode_blinecalctangent.cpp b/synfig-core/src/synfig/valuenode_blinecalctangent.cpp index ca10f3e..13fe639 100644 --- a/synfig-core/src/synfig/valuenode_blinecalctangent.cpp +++ b/synfig-core/src/synfig/valuenode_blinecalctangent.cpp @@ -71,6 +71,7 @@ ValueNode_BLineCalcTangent::ValueNode_BLineCalcTangent(const ValueBase::Type &x) set_link("offset",ValueNode_Const::create(Angle::deg(0))); set_link("scale",ValueNode_Const::create(Real(1.0))); set_link("fixed_length",ValueNode_Const::create(bool(false))); + set_link("homogeneous",ValueNode_Const::create(bool(false))); } LinkableValueNode* @@ -101,9 +102,14 @@ ValueNode_BLineCalcTangent::operator()(Time t, Real amount)const const bool looped(bline_value_node->get_loop()); int size = bline.size(), from_vertex; bool loop((*loop_)(t).get(bool())); + bool homogeneous((*homogeneous_)(t).get(bool())); Angle offset((*offset_)(t).get(Angle())); Real scale((*scale_)(t).get(Real())); bool fixed_length((*fixed_length_)(t).get(bool())); + if(homogeneous) + { + amount=hom_to_std(bline, amount, loop, looped); + } BLinePoint blinepoint0, blinepoint1; if (!looped) size--; @@ -191,6 +197,7 @@ ValueNode_BLineCalcTangent::set_link_vfunc(int i,ValueNode::Handle value) case 3: CHECK_TYPE_AND_SET_VALUE(offset_, ValueBase::TYPE_ANGLE); case 4: CHECK_TYPE_AND_SET_VALUE(scale_, ValueBase::TYPE_REAL); case 5: CHECK_TYPE_AND_SET_VALUE(fixed_length_, ValueBase::TYPE_BOOL); + case 6: CHECK_TYPE_AND_SET_VALUE(homogeneous_, ValueBase::TYPE_BOOL); } return false; } @@ -208,6 +215,7 @@ ValueNode_BLineCalcTangent::get_link_vfunc(int i)const case 3: return offset_; case 4: return scale_; case 5: return fixed_length_; + case 6: return homogeneous_; } return 0; @@ -258,5 +266,10 @@ ValueNode_BLineCalcTangent::get_children_vocab_vfunc()const .set_local_name(_("Fixed Length")) .set_description(_("When checked, the tangent's length is fixed")) ); + + ret.push_back(ParamDesc(ValueBase(),"homogeneous") + .set_local_name(_("Homogeneous")) + .set_description(_("When checked, the tangent is BLine length based")) + ); return ret; } diff --git a/synfig-core/src/synfig/valuenode_blinecalctangent.h b/synfig-core/src/synfig/valuenode_blinecalctangent.h index 84d4bf9..31fa8ff 100644 --- a/synfig-core/src/synfig/valuenode_blinecalctangent.h +++ b/synfig-core/src/synfig/valuenode_blinecalctangent.h @@ -45,6 +45,7 @@ class ValueNode_BLineCalcTangent : public LinkableValueNode ValueNode::RHandle offset_; ValueNode::RHandle scale_; ValueNode::RHandle fixed_length_; + ValueNode::RHandle homogeneous_; ValueNode_BLineCalcTangent(const ValueBase::Type &x=ValueBase::TYPE_VECTOR); diff --git a/synfig-core/src/synfig/valuenode_blinecalcvertex.cpp b/synfig-core/src/synfig/valuenode_blinecalcvertex.cpp index e74959f..a36457a 100644 --- a/synfig-core/src/synfig/valuenode_blinecalcvertex.cpp +++ b/synfig-core/src/synfig/valuenode_blinecalcvertex.cpp @@ -68,6 +68,7 @@ ValueNode_BLineCalcVertex::ValueNode_BLineCalcVertex(const ValueBase::Type &x): set_link("bline",value_node); set_link("loop",ValueNode_Const::create(bool(false))); set_link("amount",ValueNode_Const::create(Real(0.5))); + set_link("homogeneous", ValueNode_Const::create(bool(false))); } LinkableValueNode* @@ -98,7 +99,12 @@ ValueNode_BLineCalcVertex::operator()(Time t)const const bool looped(bline_value_node->get_loop()); int size = bline.size(), from_vertex; bool loop((*loop_)(t).get(bool())); + bool homogeneous((*homogeneous_)(t).get(bool())); Real amount((*amount_)(t).get(Real())); + if(homogeneous) + { + amount=hom_to_std(bline, amount, loop, looped); + } BLinePoint blinepoint0, blinepoint1; if (!looped) size--; @@ -156,6 +162,7 @@ ValueNode_BLineCalcVertex::set_link_vfunc(int i,ValueNode::Handle value) case 0: CHECK_TYPE_AND_SET_VALUE(bline_, ValueBase::TYPE_LIST); case 1: CHECK_TYPE_AND_SET_VALUE(loop_, ValueBase::TYPE_BOOL); case 2: CHECK_TYPE_AND_SET_VALUE(amount_, ValueBase::TYPE_REAL); + case 3: CHECK_TYPE_AND_SET_VALUE(homogeneous_, ValueBase::TYPE_BOOL); } return false; } @@ -170,6 +177,7 @@ ValueNode_BLineCalcVertex::get_link_vfunc(int i)const case 0: return bline_; case 1: return loop_; case 2: return amount_; + case 3: return homogeneous_; } return 0; @@ -204,5 +212,9 @@ ValueNode_BLineCalcVertex::get_children_vocab_vfunc()const .set_description(_("The position of the linked vertex on the BLine (0,1]")) ); + ret.push_back(ParamDesc(ValueBase(),"homogeneous") + .set_local_name(_("Homogeneous")) + .set_description(_("When checked, the position is BLine length based")) + ); return ret; } diff --git a/synfig-core/src/synfig/valuenode_blinecalcvertex.h b/synfig-core/src/synfig/valuenode_blinecalcvertex.h index 3f9a92b..4b0e103 100644 --- a/synfig-core/src/synfig/valuenode_blinecalcvertex.h +++ b/synfig-core/src/synfig/valuenode_blinecalcvertex.h @@ -41,6 +41,7 @@ class ValueNode_BLineCalcVertex : public LinkableValueNode ValueNode::RHandle bline_; ValueNode::RHandle loop_; ValueNode::RHandle amount_; + ValueNode::RHandle homogeneous_; ValueNode_BLineCalcVertex(const ValueBase::Type &x=ValueBase::TYPE_VECTOR); diff --git a/synfig-core/src/synfig/valuenode_blinecalcwidth.cpp b/synfig-core/src/synfig/valuenode_blinecalcwidth.cpp index 1b96ee5..cb1c036 100644 --- a/synfig-core/src/synfig/valuenode_blinecalcwidth.cpp +++ b/synfig-core/src/synfig/valuenode_blinecalcwidth.cpp @@ -69,6 +69,7 @@ ValueNode_BLineCalcWidth::ValueNode_BLineCalcWidth(const ValueBase::Type &x): set_link("loop",ValueNode_Const::create(bool(false))); set_link("amount",ValueNode_Const::create(Real(0.5))); set_link("scale",ValueNode_Const::create(Real(1.0))); + set_link("homogeneous",ValueNode_Const::create(bool(false))); } LinkableValueNode* @@ -99,7 +100,12 @@ ValueNode_BLineCalcWidth::operator()(Time t, Real amount)const const bool looped(bline_value_node->get_loop()); int size = bline.size(), from_vertex; bool loop((*loop_)(t).get(bool())); + bool homogeneous((*homogeneous_)(t).get(bool())); Real scale((*scale_)(t).get(Real())); + if(homogeneous) + { + amount=hom_to_std(bline, amount, loop, looped); + } BLinePoint blinepoint0, blinepoint1; if (!looped) size--; @@ -160,6 +166,7 @@ ValueNode_BLineCalcWidth::set_link_vfunc(int i,ValueNode::Handle value) case 1: CHECK_TYPE_AND_SET_VALUE(loop_, ValueBase::TYPE_BOOL); case 2: CHECK_TYPE_AND_SET_VALUE(amount_, ValueBase::TYPE_REAL); case 3: CHECK_TYPE_AND_SET_VALUE(scale_, ValueBase::TYPE_REAL); + case 4: CHECK_TYPE_AND_SET_VALUE(scale_, ValueBase::TYPE_BOOL); } return false; } @@ -175,6 +182,7 @@ ValueNode_BLineCalcWidth::get_link_vfunc(int i)const case 1: return loop_; case 2: return amount_; case 3: return scale_; + case 4: return homogeneous_; } return 0; @@ -214,6 +222,10 @@ ValueNode_BLineCalcWidth::get_children_vocab_vfunc()const .set_description(_("Scale of the width")) ); + ret.push_back(ParamDesc(ValueBase(),"homogeneous") + .set_local_name(_("Scale")) + .set_description(_("When checked, the width is BLine length based")) + ); return ret; } diff --git a/synfig-core/src/synfig/valuenode_blinecalcwidth.h b/synfig-core/src/synfig/valuenode_blinecalcwidth.h index 35ab02e..a010d53 100644 --- a/synfig-core/src/synfig/valuenode_blinecalcwidth.h +++ b/synfig-core/src/synfig/valuenode_blinecalcwidth.h @@ -43,6 +43,7 @@ class ValueNode_BLineCalcWidth : public LinkableValueNode ValueNode::RHandle loop_; ValueNode::RHandle amount_; ValueNode::RHandle scale_; + ValueNode::RHandle homogeneous_; ValueNode_BLineCalcWidth(const ValueBase::Type &x=ValueBase::TYPE_REAL);