goat3d

diff src/goat3d_writexml.cc @ 55:af1310ed212b

not done yet
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 19 Jan 2014 14:56:44 +0200
parents fa5c52ea9d59
children d317eb4f83da
line diff
     1.1 --- a/src/goat3d_writexml.cc	Fri Jan 17 18:30:35 2014 +0200
     1.2 +++ b/src/goat3d_writexml.cc	Sun Jan 19 14:56:44 2014 +0200
     1.3 @@ -43,33 +43,19 @@
     1.4  	return true;
     1.5  }
     1.6  
     1.7 -static void collect_nodes(std::list<const XFormNode*> *res, const XFormNode *node)
     1.8 -{
     1.9 -	if(!node) return;
    1.10 -
    1.11 -	res->push_back(node);
    1.12 -
    1.13 -	for(int i=0; i<node->get_children_count(); i++) {
    1.14 -		collect_nodes(res, node->get_child(i));
    1.15 -	}
    1.16 -}
    1.17 -
    1.18 -bool Scene::save_anim_xml(const XFormNode *node, goat3d_io *io) const
    1.19 +bool Scene::save_anim_xml(goat3d_io *io) const
    1.20  {
    1.21  	xmlout(io, 0, "<anim>\n");
    1.22  
    1.23 -	const char *anim_name = node->get_animation_name();
    1.24 -	if(anim_name && *anim_name) {
    1.25 -		xmlout(io, 1, "<name string=\"%s\"/>\n", anim_name);
    1.26 +	if(!nodes.empty()) {
    1.27 +		const char *anim_name = nodes[0]->get_animation_name();
    1.28 +		if(anim_name && *anim_name) {
    1.29 +			xmlout(io, 1, "<name string=\"%s\"/>\n", anim_name);
    1.30 +		}
    1.31  	}
    1.32  
    1.33 -	std::list<const XFormNode*> allnodes;
    1.34 -	collect_nodes(&allnodes, node);
    1.35 -
    1.36 -	std::list<const XFormNode*>::const_iterator it = allnodes.begin();
    1.37 -	while(it != allnodes.end()) {
    1.38 -		const XFormNode *n = *it++;
    1.39 -		write_node_anim(io, n, 1);
    1.40 +	for(size_t i=0; i<nodes.size(); i++) {
    1.41 +		write_node_anim(io, nodes[i], 1);
    1.42  	}
    1.43  
    1.44  	xmlout(io, 0, "</anim>\n");