X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Fsrc%2Fsynfig%2Fsavecanvas.cpp;h=768219551e9f3a05c6bc3d03d41e9303e56de269;hb=813c9518c88ab69610aa506392a33fc1560782b5;hp=a2ae0d92e2594c258b83d03e57148385796632ca;hpb=adfc80c126f482d7ea2bac38001a2c4a7c7df88c;p=synfig.git diff --git a/synfig-core/src/synfig/savecanvas.cpp b/synfig-core/src/synfig/savecanvas.cpp index a2ae0d9..7682195 100644 --- a/synfig-core/src/synfig/savecanvas.cpp +++ b/synfig-core/src/synfig/savecanvas.cpp @@ -37,15 +37,10 @@ #include "savecanvas.h" #include "general.h" #include "valuenode.h" -#include "valuenode_subtract.h" #include "valuenode_animated.h" -#include "valuenode_composite.h" #include "valuenode_const.h" -#include "valuenode_linear.h" #include "valuenode_dynamiclist.h" #include "valuenode_reference.h" -#include "valuenode_segcalctangent.h" -#include "valuenode_segcalcvertex.h" #include "valuenode_bline.h" #include "time.h" #include "keyframe.h" @@ -104,10 +99,9 @@ xmlpp::Element* encode_real(xmlpp::Element* root,Real v) return root; } -xmlpp::Element* encode_time(xmlpp::Element* root,Time t, float /*fps*/=0) +xmlpp::Element* encode_time(xmlpp::Element* root,Time t) { root->set_name("time"); - //root->set_attribute("value",t.get_string(fps)); root->set_attribute("value",t.get_string()); return root; } @@ -220,10 +214,7 @@ xmlpp::Element* encode_value(xmlpp::Element* root,const ValueBase &data,Canvas:: case ValueBase::TYPE_REAL: return encode_real(root,data.get(Real())); case ValueBase::TYPE_TIME: - if(canvas) - return encode_time(root,data.get(Time()),canvas->rend_desc().get_frame_rate()); - else - return encode_time(root,data.get(Time())); + return encode_time(root,data.get(Time())); case ValueBase::TYPE_INTEGER: return encode_integer(root,data.get(int())); case ValueBase::TYPE_COLOR: @@ -270,10 +261,8 @@ xmlpp::Element* encode_animated(xmlpp::Element* root,ValueNode_Animated::ConstHa for(iter=waypoint_list.begin();iter!=waypoint_list.end();++iter) { xmlpp::Element *waypoint_node=root->add_child("waypoint"); - //waypoint_node->set_attribute("time",iter->get_time().get_string(canvas->rend_desc().get_frame_rate())); waypoint_node->set_attribute("time",iter->get_time().get_string()); - //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 { @@ -345,44 +334,6 @@ xmlpp::Element* encode_animated(xmlpp::Element* root,ValueNode_Animated::ConstHa return root; } -xmlpp::Element* encode_subtract(xmlpp::Element* root,ValueNode_Subtract::ConstHandle value_node,Canvas::ConstHandle canvas=0) -{ - assert(value_node); - root->set_name("subtract"); - - ValueNode::ConstHandle lhs=value_node->get_lhs(); - ValueNode::ConstHandle rhs=value_node->get_rhs(); - ValueNode::ConstHandle scalar=value_node->get_scalar(); - - assert(lhs); - assert(rhs); - - root->set_attribute("type",ValueBase::type_name(value_node->get_type())); - - if(lhs==rhs) - warning("LHS is equal to RHS, this will always be zero!"); - - //if(value_node->get_scalar()!=1) - // root->set_attribute("scalar",strprintf(VECTOR_VALUE_TYPE_FORMAT,value_node->get_scalar())); - - if(!scalar->get_id().empty()) - root->set_attribute("scalar",scalar->get_relative_id(canvas)); - else - encode_value_node(root->add_child("scalar")->add_child("value_node"),scalar,canvas); - - if(!lhs->get_id().empty()) - root->set_attribute("lhs",lhs->get_relative_id(canvas)); - else - encode_value_node(root->add_child("lhs")->add_child("value_node"),lhs,canvas); - - if(!rhs->get_id().empty()) - root->set_attribute("rhs",rhs->get_relative_id(canvas)); - else - encode_value_node(root->add_child("rhs")->add_child("value_node"),rhs,canvas); - - return root; -} - xmlpp::Element* encode_dynamic_list(xmlpp::Element* root,ValueNode_DynamicList::ConstHandle value_node,Canvas::ConstHandle canvas=0) { assert(value_node); @@ -480,9 +431,6 @@ xmlpp::Element* encode_linkable_value_node(xmlpp::Element* root,LinkableValueNod ValueBase value((*value_node)(0)); encode_value(root,value,canvas); - // ValueNode_Const::ConstHandle const_value(ValueNode_Const::create((*value_node)(0))); - // encode_value_node(root,const_value,canvas); - return root; } @@ -512,9 +460,6 @@ xmlpp::Element* encode_value_node(xmlpp::Element* root,ValueNode::ConstHandle va if(ValueNode_Animated::ConstHandle::cast_dynamic(value_node)) encode_animated(root,ValueNode_Animated::ConstHandle::cast_dynamic(value_node),canvas); else - if(ValueNode_Subtract::ConstHandle::cast_dynamic(value_node)) - encode_subtract(root,ValueNode_Subtract::ConstHandle::cast_dynamic(value_node),canvas); - else if(ValueNode_DynamicList::ConstHandle::cast_dynamic(value_node)) encode_dynamic_list(root,ValueNode_DynamicList::ConstHandle::cast_dynamic(value_node),canvas); else if(ValueNode_Const::ConstHandle::cast_dynamic(value_node)) @@ -697,7 +642,11 @@ xmlpp::Element* encode_canvas(xmlpp::Element* root,Canvas::ConstHandle canvas) } // Output the section - //! \todo check where the parentheses should really go - around the && or the ||? + //! Check where the parentheses should really go - around the && or the ||? + //! If children is not empty (there are exported canvases in the current canvas) + //! they must be listed in the defs section regardless the result of check the + //! Value Node list (exported value nodes in the canvas) and if the canvas is + //! in line or not. Inline canvases cannot have exported canvases inside. if((!canvas->is_inline() && !canvas->value_node_list().empty()) || !canvas->children().empty()) { xmlpp::Element *node=root->add_child("defs");