示例#1
0
 //--------------------------------------------------
 //--------------------------------------------------
 XML::Node* GetFirstChildElement(const XML::Node* in_node, const std::string& in_name)
 {
     const s8* nameData = nullptr;
     u32 nameSize = in_name.length();
     if (nameSize > 0)
     {
         nameData = in_name.c_str();
     }
     
     XML::Node* child = in_node->first_node(nameData, nameSize);
     if (child != nullptr && child->type() == rapidxml::node_type::node_element)
     {
         return child;
     }
     else if (child != nullptr)
     {
         XML::Node* sibling = child;
         do
         {
             sibling = sibling->next_sibling(nameData, nameSize);
         }
         while(sibling != nullptr && sibling->type() != rapidxml::node_type::node_element);
         return sibling;
     }
     
     return nullptr;
 }
示例#2
0
FaerieAnimation::FaerieAnimation(Xml::Node* element)
{
	_name = Xml::GetStringAttribute(element, "name");
	_time = Xml::GetFloatAttribute(element, "time");
	Xml::Node* keyFrameXml = element->first_node("keyFrame");
	while (keyFrameXml != NULL) {
		_keyFrames.push_back(FaerieFrame(keyFrameXml));
		keyFrameXml = keyFrameXml->next_sibling("keyFrame");
	}
	CreateAnimationSplines();
}
void FaerieAnimationsCollection::Reread() {
	Clear();
	Xml::ReadDocument doc(_filename);
	Xml::Node* rootNode = doc.first_node();
	assert(rootNode != NULL);
	Xml::Node* animationNode = rootNode->first_node("animation");
	while (animationNode != NULL) {
		FaerieAnimation* animation = new FaerieAnimation(animationNode);
		std::string animationName = animation->GetName();
		assert(_mapAnimations.find(animationName) == _mapAnimations.end());
		_mapAnimations[animationName] = animation;
		animationNode = animationNode->next_sibling("animation");
	}
}
示例#4
0
 //--------------------------------------------------
 //--------------------------------------------------
 XML::Node* GetNextSiblingElement(const XML::Node* in_node, const std::string& in_name)
 {
     const s8* nameData = nullptr;
     u32 nameSize = in_name.length();
     if (nameSize > 0)
     {
         nameData = in_name.c_str();
     }
     
     XML::Node* sibling = in_node->next_sibling(nameData, nameSize);
     while (sibling != nullptr && sibling->type() != rapidxml::node_type::node_element)
     {
         sibling = sibling->next_sibling(nameData, nameSize);
     }
     return sibling;
 }