From 4f643146c794d654dd0e75f78289be9edf0572c8 Mon Sep 17 00:00:00 2001 From: omigamedev Date: Fri, 29 Nov 2019 12:37:11 +0100 Subject: [PATCH] ignore xml children parsing in text node --- src/node.cpp | 10 ++++++++-- src/node.h | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/node.cpp b/src/node.cpp index d342abc..0e306df 100644 --- a/src/node.cpp +++ b/src/node.cpp @@ -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(); //LOG("load_internal node %s", m_name.c_str()); @@ -1381,6 +1381,12 @@ void Node::load_internal(const tinyxml2::XMLElement* x_node) create(); + if (skip_children) + { + loaded(); + return; + } + auto x_child = x_node->FirstChildElement(); while (x_child) { @@ -1442,7 +1448,7 @@ void Node::load_internal(const tinyxml2::XMLElement* x_node) { auto n = new NodeText(); add_child(n); - n->load_internal(x_child); + n->load_internal(x_child, true); std::string text; auto node = x_child->FirstChild(); while (node) diff --git a/src/node.h b/src/node.h index 475f3f2..b9fc344 100644 --- a/src/node.h +++ b/src/node.h @@ -209,7 +209,7 @@ public: void update(); void update_internal(const glm::vec2& origin, const glm::mat4& proj, float zoom); 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 Node* clone_instantiate() const; virtual void clone_copy(Node* dest) const;