Author: Carlos Lopez <[email protected]>
Date: Mon Oct 10 21:24:02 2011 +0200
Add a private member 'boundaries' to the wplist to store the boundaries of the
wplist. Add code to load and save it.
---
synfig-core/src/synfig/loadcanvas.cpp | 22 ++++++++++++++++++++++
synfig-core/src/synfig/savecanvas.cpp | 11 +++++++++++
synfig-core/src/synfig/valuenode_wplist.cpp | 15 ++++++++++++++-
synfig-core/src/synfig/valuenode_wplist.h | 5 +++++
4 files changed, 52 insertions(+), 1 deletions(-)
diff --git a/synfig-core/src/synfig/loadcanvas.cpp
b/synfig-core/src/synfig/loadcanvas.cpp
index 4136c4d..bb50a7b 100644
--- a/synfig-core/src/synfig/loadcanvas.cpp
+++ b/synfig-core/src/synfig/loadcanvas.cpp
@@ -1921,6 +1921,28 @@ CanvasParser::parse_dynamic_list(xmlpp::Element
*element,Canvas::Handle canvas)
value_node->add(list_entry);
value_node->set_link(value_node->link_count()-1,list_entry.value_node);
}
+ else if(child->get_name()=="boundaries")
+ {
+ if(wplist_value_node)
+ {
+ String str("boundaries");
+ xmlpp::Element::NodeList list =
child->get_children();
+ for(xmlpp::Element::NodeList::iterator iter =
list.begin(); iter != list.end(); ++iter)
+ {
+ xmlpp::Element
*ichild(dynamic_cast<xmlpp::Element*>(*iter));
+ if(!ichild)
+ continue;
+ else
+ if(ichild->get_name()[0]=='v')
+ {
+ Vector
bounds=parse_vector(dynamic_cast<xmlpp::Element*>(*iter));
+
wplist_value_node->set_bounds(bounds);
+ }
+ }
+ }
+ else
+
error_unexpected_element(child,child->get_name());
+ }
else
error_unexpected_element(child,child->get_name());
}
diff --git a/synfig-core/src/synfig/savecanvas.cpp
b/synfig-core/src/synfig/savecanvas.cpp
index 460575d..9153d3b 100644
--- a/synfig-core/src/synfig/savecanvas.cpp
+++ b/synfig-core/src/synfig/savecanvas.cpp
@@ -152,6 +152,13 @@ xmlpp::Element* encode_vector(xmlpp::Element* root,Vector
vect,bool s=false)
return root;
}
+xmlpp::Element* encode_boundaries(xmlpp::Element* root,Vector vect)
+{
+ root->set_name("boundaries");
+ encode_vector(root->add_child("vector"), vect);
+ return root;
+}
+
xmlpp::Element* encode_color(xmlpp::Element* root,Color color,bool s=false)
{
root->set_name("color");
@@ -406,6 +413,10 @@ xmlpp::Element* encode_dynamic_list(xmlpp::Element*
root,ValueNode_DynamicList::
root->set_attribute("loop","true");
else
root->set_attribute("loop","false");
+ Vector bounds(wplist_value_node->get_bounds());
+ xmlpp::Element *bounds_node=root->add_child("boundaries");
+ assert(bounds.is_valid());
+ encode_boundaries(bounds_node, bounds);
}
if(dilist_value_node)
{
diff --git a/synfig-core/src/synfig/valuenode_wplist.cpp
b/synfig-core/src/synfig/valuenode_wplist.cpp
index 679a062..761d20b 100644
--- a/synfig-core/src/synfig/valuenode_wplist.cpp
+++ b/synfig-core/src/synfig/valuenode_wplist.cpp
@@ -204,8 +204,9 @@ synfig::widthpoint_interpolate(const WidthPoint& prev,
const WidthPoint& next, c
ValueNode_WPList::ValueNode_WPList():
- ValueNode_DynamicList(ValueBase::TYPE_WIDTHPOINT)
+ValueNode_DynamicList(ValueBase::TYPE_WIDTHPOINT)
{
+ bounds_=Vector(0.0, 1.0);
}
ValueNode_WPList::~ValueNode_WPList()
@@ -443,3 +444,15 @@ ValueNode_WPList::set_bline(ValueNode::Handle b)
bline_=b;
}
+Vector
+ValueNode_WPList::get_bounds()const
+{
+ return bounds_;
+}
+
+void
+ValueNode_WPList::set_bounds(Vector &x)
+{
+ bounds_[0]=x[0];
+ bounds_[1]=x[1];
+}
diff --git a/synfig-core/src/synfig/valuenode_wplist.h
b/synfig-core/src/synfig/valuenode_wplist.h
index 0f445ff..d5d8282 100644
--- a/synfig-core/src/synfig/valuenode_wplist.h
+++ b/synfig-core/src/synfig/valuenode_wplist.h
@@ -64,6 +64,8 @@ class ValueNode_WPList : public ValueNode_DynamicList
{
private:
ValueNode::RHandle bline_;
+ //! The boundaries of the width points positions, usually (0.0, 1.0)
+ Vector bounds_;
public:
@@ -106,6 +108,9 @@ public:
ValueNode::LooseHandle get_bline()const;
//! Sets the bline RHandle
void set_bline(ValueNode::Handle b);
+ //! Gets the boundaries of the WPList
+ Vector get_bounds()const;
+ void set_bounds(Vector &x);
protected:
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl