@@ -23,6 +23,11 @@ SceneNode* SceneNode::getMeshNode()
2323 return mesh_node_;
2424}
2525
26+ std::string SceneNode::getComponentPath () const
27+ {
28+ return component_path_;
29+ }
30+
2631std::vector<SceneNode*> SceneNode::getChildren ()
2732{
2833 return children_;
@@ -125,6 +130,45 @@ void SceneNode::fillByXMLNode(pugi::xml_node xml_node)
125130 setSetting (key, value, type, preserve);
126131 }
127132 }
133+
134+ // Read components
135+ const pugi::xml_node components_node = xml_node.child (" components" );
136+ if (components_node != nullptr )
137+ {
138+ for (pugi::xml_node component = components_node.child (" component" ); component != nullptr ; component = component.next_sibling (" component" ))
139+ {
140+ std::string path = component.attribute (" p:path" ).as_string ();
141+ if (! path.empty ())
142+ {
143+ component_path_ = path;
144+ }
145+
146+ std::string transformation = component.attribute (" transform" ).as_string ();
147+ if (! transformation.empty ())
148+ {
149+ transformation_ = transformation;
150+ }
151+ }
152+ }
153+ }
154+
155+ void SceneNode::parseComponentData (const std::string& xml_string)
156+ {
157+ pugi::xml_document document;
158+ document.load_string (xml_string.c_str ());
159+
160+ pugi::xml_node xml_node = document;
161+ for (const std::string child_name : {" model" , " resources" , " object" , " mesh" })
162+ {
163+ xml_node = xml_node.child (child_name.c_str ());
164+ if (xml_node == nullptr )
165+ {
166+ return ;
167+ }
168+ }
169+
170+ mesh_data_.clear ();
171+ mesh_data_.fillByXMLNode (xml_node);
128172}
129173
130174std::string SceneNode::getId ()
0 commit comments