Completes fix of 1785296: If a waypoint has <animated type="canvas">, then just save...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Mon, 3 Sep 2007 11:05:50 +0000 (11:05 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Mon, 3 Sep 2007 11:05:50 +0000 (11:05 +0000)
git-svn-id: http://svn.voria.com/code@574 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-core/trunk/src/synfig/savecanvas.cpp

index 6129f71..cb47847 100644 (file)
@@ -268,8 +268,18 @@ xmlpp::Element* encode_animated(xmlpp::Element* root,ValueNode_Animated::ConstHa
                //waypoint_node->add_child(encode_value(iter->get_value(),canvas));
                if(iter->get_value_node()->is_exported())
                        waypoint_node->set_attribute("use",iter->get_value_node()->get_relative_id(canvas));
-               else
-                       encode_value_node(waypoint_node->add_child("value_node"),iter->get_value_node(),canvas);
+               else {
+                       ValueNode::ConstHandle value_node = iter->get_value_node();
+                       if(ValueNode_Const::ConstHandle::cast_dynamic(value_node)) {
+                               const ValueBase data = ValueNode_Const::ConstHandle::cast_dynamic(value_node)->get_value();
+                               if (data.get_type() == ValueBase::TYPE_CANVAS)
+                                       waypoint_node->set_attribute("use",data.get(Canvas::Handle()).get()->get_relative_id(canvas));
+                               else
+                                       encode_value_node(waypoint_node->add_child("value_node"),iter->get_value_node(),canvas);
+                       }
+                       else
+                               encode_value_node(waypoint_node->add_child("value_node"),iter->get_value_node(),canvas);
+               }
 
                switch(iter->get_before())
                {