//--------------------------------------------------------------
bool ofxGestureGenerator::removeGesture(string gesture_name) {
	XnStatus result = XN_STATUS_OK;	
	
	result = gesture_generator.RemoveGesture(gesture_name.c_str());
	string msg = "Removing simple (openNI) gesture " + gesture_name;
	BOOL_RC(result, msg.c_str());
}
//--------------------------------------------------------------
bool ofxGestureGenerator::addGesture(string gesture_name) {
	XnStatus result = XN_STATUS_OK;	
	
	result = gesture_generator.AddGesture(gesture_name.c_str(), NULL);
	string msg = "Adding simple (openNI) gesture " + gesture_name;
	BOOL_RC(result, msg.c_str());
}
// Initialize using an XML file.
//----------------------------------------
bool ofxOpenNIContext::setupUsingXMLFile(std::string sFile) {
	
	xn::EnumerationErrors errors;
	
	if(sFile == "") sFile = ofToDataPath("openni/config/ofxopenni_config.xml",true);
	
	printf("Using file: %s\n", sFile.c_str());
	
	XnStatus result = context.InitFromXmlFile(sFile.c_str(), &errors);
	
	if(result != XN_STATUS_OK) logErrors(errors);
	
	BOOL_RC(result, "ofxOpenNIContext.setupUsingXMLFile()");
	
}
// Initialize using an .ONI recording.
//----------------------------------------
bool ofxOpenNIContext::setupUsingRecording(std::string sFileRecording) {
	
	xn::EnumerationErrors errors;
	
	initContext();
	addLicense("PrimeSense", "0KOIk2JeIBYClPWVnMoRKn5cdY4=");
	
	is_using_recording = true;
	
	std::string file_path = ofToDataPath(sFileRecording.c_str(), true);
	
	printf("Attempting to open file: %s\n", file_path.c_str());
	
	XnStatus result = context.OpenFileRecording(file_path.c_str());
	
	if(result != XN_STATUS_OK) logErrors(errors);
	
	BOOL_RC(result, "Loading file");
}
// Just initialize; use this when you"re creating nodes yourself.
//----------------------------------------
bool ofxOpenNIContext::initContext(){
	xn::EnumerationErrors errors;
	XnStatus result = context.Init();
	if(result != XN_STATUS_OK) logErrors(errors);
	BOOL_RC(result, "ofxOpenNIContext.setup()");
}
bool ofxOpenNIContext::setMirror(XnBool mirroring) {
	XnStatus result = context.SetGlobalMirror(mirroring);
	BOOL_RC(result, "Set mirroring");
}
bool ofxOpenNIContext::getHandsGenerator(xn::HandsGenerator* hands_generator) {
	XnStatus result = XN_STATUS_OK;
	result = context.FindExistingNode(XN_NODE_TYPE_HANDS, *hands_generator);
	BOOL_RC(result, "Retrieving hands generator");
}
bool ofxOpenNIContext::getGestureGenerator(xn::GestureGenerator* gesture_generator) {
	XnStatus result = XN_STATUS_OK;
	result = context.FindExistingNode(XN_NODE_TYPE_GESTURE, *gesture_generator);
	BOOL_RC(result, "Retrieving gesture generator");
}
bool ofxOpenNIContext::getUserGenerator(xn::UserGenerator* user_generator) {
	XnStatus result = XN_STATUS_OK;
	result = context.FindExistingNode(XN_NODE_TYPE_USER, *user_generator);
	BOOL_RC(result, "Retrieving user generator");
}
bool ofxOpenNIContext::getIRGenerator(xn::IRGenerator* ir_generator) {
	XnStatus result = XN_STATUS_OK;
	result = context.FindExistingNode(XN_NODE_TYPE_IR, *ir_generator);
	BOOL_RC(result, "Retrieving ir generator");
}
// Use these to retrieve references to various node types on the production tree
// TODO: should these be made static so retrievl is more immediate? Or is this sufficient?
//----------------------------------------
bool ofxOpenNIContext::getDepthGenerator(xn::DepthGenerator* depth_generator) {
	XnStatus result = XN_STATUS_OK;
	result = context.FindExistingNode(XN_NODE_TYPE_DEPTH, *depth_generator);
	BOOL_RC(result, "Retrieving depth generator");
}