Module: synfig/synfig Branch: genete_width_outline Commit: b391a6f844ca8e1a5066ffe7e25ea819afce8c8f URL: http://synfig.git.sourceforge.net/git/gitweb.cgi?p=synfig/synfig;a=commit;h=b391a6f844ca8e1a5066ffe7e25ea819afce8c8f
Author: Carlos Lopez <genet...@gmail.com> Date: Sun Jan 9 12:47:36 2011 +0100 Let Composite Value Node handle WidthPoint value type --- synfig-core/src/synfig/valuenode_composite.cpp | 66 +++++++++++++++++++++++- synfig-core/src/synfig/valuenode_wplist.cpp | 4 +- 2 files changed, 66 insertions(+), 4 deletions(-) diff --git a/synfig-core/src/synfig/valuenode_composite.cpp b/synfig-core/src/synfig/valuenode_composite.cpp index dfde2e9..5459ce8 100644 --- a/synfig-core/src/synfig/valuenode_composite.cpp +++ b/synfig-core/src/synfig/valuenode_composite.cpp @@ -89,6 +89,15 @@ synfig::ValueNode_Composite::ValueNode_Composite(const ValueBase &value): set_link("t2",ValueNode_RadialComposite::create(bline_point.get_tangent2())); break; } + case ValueBase::TYPE_WIDTHPOINT: + { + WidthPoint wpoint(value); + set_link("position",ValueNode_Const::create(wpoint.get_position())); + set_link("width",ValueNode_Const::create(wpoint.get_width())); + set_link("cup_before",ValueNode_Const::create(wpoint.get_cup_type_before())); + set_link("cup_after",ValueNode_Const::create(wpoint.get_cup_type_after())); + break; + } default: assert(0); throw Exception::BadType(ValueBase::type_local_name(get_type())); @@ -161,6 +170,16 @@ synfig::ValueNode_Composite::operator()(Time t)const ret.set_tangent2((*components[5])(t).get(Vector())); return ret; } + case ValueBase::TYPE_WIDTHPOINT: + { + WidthPoint ret; + assert(components[0] && components[1] && components[2] && components[3]); + ret.set_position((*components[0])(t).get(Real())); + ret.set_width((*components[1])(t).get(Real())); + ret.set_cup_type_before((*components[2])(t).get(int())); + ret.set_cup_type_after((*components[3])(t).get(int())); + return ret; + } default: synfig::error(string("ValueNode_Composite::operator():")+_("Bad type for composite")); assert(components[0]); @@ -181,6 +200,8 @@ ValueNode_Composite::link_count()const return 4; case ValueBase::TYPE_BLINEPOINT: return 6; + case ValueBase::TYPE_WIDTHPOINT: + return 4; default: synfig::warning(string("ValueNode_Composite::component_count():")+_("Bad type for composite")); return 1; @@ -242,6 +263,19 @@ ValueNode_Composite::set_link_vfunc(int i,ValueNode::Handle x) } break; + case ValueBase::TYPE_WIDTHPOINT: + if((i==0 || i==1) && x->get_type()==ValueBase(Real()).get_type()) + { + components[i]=x; + return true; + } + if((i==2 || i==3) && x->get_type()==ValueBase(int()).get_type()) + { + components[i]=x; + return true; + } + break; + default: break; } @@ -300,6 +334,16 @@ ValueNode_Composite::link_local_name(int i)const else if(i==5) return _("Tangent 2"); + case ValueBase::TYPE_WIDTHPOINT: + if(i==0) + return _("Position"); + else if(i==1) + return _("Width"); + else if(i==2) + return _("Cup Type Before"); + else if(i==3) + return _("Cup Type After"); + default: assert(0); // notice that Composite counts from 1 and Radial Composite counts @@ -356,6 +400,16 @@ ValueNode_Composite::link_name(int i)const case 5: return "t2"; } break; + case ValueBase::TYPE_WIDTHPOINT: + switch(i) + { + case 0: return "position"; + case 1: return "width"; + case 2: return "cup_before"; + case 3: return "cup_after"; + } + break; + default: break; } @@ -416,6 +470,15 @@ ValueNode_Composite::get_link_index_from_name(const String &name)const return 4; if(name=="t2") return 5; + case ValueBase::TYPE_WIDTHPOINT: + if(name=="position") + return 0; + if(name=="width") + return 1; + if(name=="cup_before") + return 2; + if(name=="cup_after") + return 3; default: break; } @@ -442,5 +505,6 @@ ValueNode_Composite::check_type(ValueBase::Type type) type==ValueBase::TYPE_SEGMENT || type==ValueBase::TYPE_VECTOR || type==ValueBase::TYPE_COLOR || - type==ValueBase::TYPE_BLINEPOINT; + type==ValueBase::TYPE_BLINEPOINT|| + type==ValueBase::TYPE_WIDTHPOINT; } diff --git a/synfig-core/src/synfig/valuenode_wplist.cpp b/synfig-core/src/synfig/valuenode_wplist.cpp index c6ae1d7..96169e0 100644 --- a/synfig-core/src/synfig/valuenode_wplist.cpp +++ b/synfig-core/src/synfig/valuenode_wplist.cpp @@ -127,7 +127,6 @@ ValueNode_WPList::create(const ValueBase &value) for(iter=list.begin();iter!=list.end();iter++) { - //TODO: Composite should handle WidthPoints ************ value_node->add(ValueNode::Handle(ValueNode_Composite::create(*iter))); } value_node->set_loop(value.get_loop()); @@ -164,8 +163,7 @@ ValueNode_WPList::create_list_entry(Real position, Time time) ret.index=0; ret.set_parent_value_node(this); // Note: before and after interpolations are INTERPOLATE by default. - // not need to set up here. - //TODO: Composite should accept WidthPoints + // not need to set it up here. ret.value_node=ValueNode_Composite::create(wpoint); return ret; } ------------------------------------------------------------------------------ Gaining the trust of online customers is vital for the success of any company that requires sensitive data to be transmitted over the Web. Learn how to best implement a security strategy that keeps consumers' information secure and instills the confidence they need to proceed with transactions. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Synfig-devl mailing list Synfig-devl@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/synfig-devl