Esempio n. 1
0
File: Bone.cpp Progetto: iph/mocaps
 /**
 * String must be in the form of:
 *	begin
 *	(contents)
 *	end
 */
 void Bone::build_bone_from_file(string contents, map<string, Bone *> & mapper){
	 
	regex parse("begin([()-.a-zA-Z0-9\n\r\t ]*?)end");
	smatch sm; 

	while (std::regex_search (contents,sm,parse)) {
		for(int i = 1; i < sm.size(); i+=2){
			string check = sm[i];

			//OutputDebugString(check.c_str());	
			Bone * bonez = build_node_from_file(check);
			mapper[bonez->GetName()] = bonez;
		}
		contents = sm.suffix().str();

	}
 }
Esempio n. 2
0
void CGrModelXp::XmlLoadBone(CXmlDocument *xml, IXMLDOMNode *topNode)
{
    Bone bone;

    // Attributes to load:  index, name, transform, parent
    CComPtr<IXMLDOMNamedNodeMap> attributes;
    topNode->get_attributes(&attributes);
    GetXmlAttribute(attributes, L"index", bone.mIndex);
    wstring name;
    GetXmlAttribute(attributes, L"name", name);
    bone.SetName(name.c_str());

    bone.mParent = -1;
    GetXmlAttribute(attributes, L"parent", bone.mParent);
    GetXmlAttribute(attributes, L"transform", bone.mTransform);

    mBonesByName[bone.GetName()] = (int)mBones.size();
    mBones.push_back(bone);
}