| 764 | } |
| 765 | |
| 766 | int scene::parse_object_query(std::vector<std::string>& f, std::string& result, std::string& error) const |
| 767 | { |
| 768 | if (f.size() == 0) |
| 769 | { |
| 770 | error = "Expecting id argument"; |
| 771 | return 1; |
| 772 | } |
| 773 | |
| 774 | string id = f[0]; |
| 775 | const sgnode* node = this->get_node(id); |
| 776 | if (node == 0) |
| 777 | { |
| 778 | error = "Node not found"; |
| 779 | return 1; |
| 780 | } |
| 781 | |
| 782 | vec3 pos, rot, scale; |
| 783 | node->get_trans(pos, rot, scale); |
| 784 | |
| 785 | const tag_map& tags = node->get_all_tags(); |
| 786 | |
| 787 | stringstream ss; |
| 788 | ss << "o " << id; |
| 789 | ss << " p " << pos[0] << " " << pos[1] << " " << pos[2]; |
| 790 | ss << " r " << rot[0] << " " << rot[1] << " " << rot[2]; |
| 791 | ss << " s " << scale[0] << " " << scale[1] << " " << scale[2]; |
| 792 | ss << " t " << tags.size(); |
| 793 | for (tag_map::const_iterator i = tags.begin(); i != tags.end(); i++) |
| 794 | { |
| 795 | ss << " " << i->first << " = " << i->second; |
| 796 | } |
| 797 | |
| 798 | result = ss.str(); |
| 799 | return -1; |
| 800 | } |
| 801 | |
| 802 | int scene::parse_objects_with_flag_query(std::vector<std::string>& f, std::string& result, std::string& error) const |
| 803 | { |