ignore xml children parsing in text node

This commit is contained in:
2019-11-29 12:37:11 +01:00
parent 2aadf9e92c
commit 4f643146c7
2 changed files with 9 additions and 3 deletions

View File

@@ -1365,7 +1365,7 @@ void Node::parse_attributes(kAttribute ka, const tinyxml2::XMLAttribute* attr)
} }
} }
void Node::load_internal(const tinyxml2::XMLElement* x_node) void Node::load_internal(const tinyxml2::XMLElement* x_node, bool skip_children /*= false*/)
{ {
m_name = x_node->Name(); m_name = x_node->Name();
//LOG("load_internal node %s", m_name.c_str()); //LOG("load_internal node %s", m_name.c_str());
@@ -1381,6 +1381,12 @@ void Node::load_internal(const tinyxml2::XMLElement* x_node)
create(); create();
if (skip_children)
{
loaded();
return;
}
auto x_child = x_node->FirstChildElement(); auto x_child = x_node->FirstChildElement();
while (x_child) while (x_child)
{ {
@@ -1442,7 +1448,7 @@ void Node::load_internal(const tinyxml2::XMLElement* x_node)
{ {
auto n = new NodeText(); auto n = new NodeText();
add_child(n); add_child(n);
n->load_internal(x_child); n->load_internal(x_child, true);
std::string text; std::string text;
auto node = x_child->FirstChild(); auto node = x_child->FirstChild();
while (node) while (node)

View File

@@ -209,7 +209,7 @@ public:
void update(); void update();
void update_internal(const glm::vec2& origin, const glm::mat4& proj, float zoom); void update_internal(const glm::vec2& origin, const glm::mat4& proj, float zoom);
virtual void parse_attributes(kAttribute ka, const tinyxml2::XMLAttribute* attr); virtual void parse_attributes(kAttribute ka, const tinyxml2::XMLAttribute* attr);
void load_internal(const tinyxml2::XMLElement* x_node); void load_internal(const tinyxml2::XMLElement* x_node, bool skip_children = false);
virtual void draw(); virtual void draw();
virtual Node* clone_instantiate() const; virtual Node* clone_instantiate() const;
virtual void clone_copy(Node* dest) const; virtual void clone_copy(Node* dest) const;