void ofxBvh::load(string path)
{
	path = ofToDataPath(path);
	
	string data = ofBufferFromFile(path).getText();
	
	const size_t HIERARCHY_BEGIN = data.find("HIERARCHY", 0);
	const size_t MOTION_BEGIN = data.find("MOTION", 0);
	
	if (HIERARCHY_BEGIN == string::npos
		|| MOTION_BEGIN == string::npos)
	{
		ofLogError("ofxBvh", "invalid bvh format");
		return;
	}
	
	parseHierarchy(data.substr(HIERARCHY_BEGIN, MOTION_BEGIN));
	parseMotion(data.substr(MOTION_BEGIN));
	
	currentFrame = frames[0];
	
	int index = 0;
	updateJoint(index, currentFrame, root);
	
	frame_new = false;
}
void ofxBvh::load(const string& data)
{
	const size_t HIERARCHY_BEGIN = data.find("HIERARCHY", 0);
	const size_t MOTION_BEGIN = data.find("MOTION", 0);
	
	if (HIERARCHY_BEGIN == string::npos
		|| MOTION_BEGIN == string::npos)
	{
		ofLogError("ofxBvh", "invalid bvh format");
		return;
	}
	
	parseHierarchy(data.substr(HIERARCHY_BEGIN, MOTION_BEGIN));
	
	frame_new = false;
}