예제 #1
0
void bankManager::saveScene(ofxXmlSettings & XML, ofPtr<scene> sn){
    
    XML.addValue("NAME", sn->getName());
    XML.addValue("UID", sn->getUid());
    XML.addValue("FADE_IN", sn->getFadeIn());
    XML.addValue("FADE_OUT", sn->getFadeOut());
    
    vector <ofPtr<triggerZone> > t_tzs = sn->getTriggerZones();
    vector <ofPtr<triggerZone> > ::iterator it;
    int count = 0;
    
    for(it = t_tzs.begin(); it != t_tzs.end(); it++){
        
        XML.addTag("ZONE");
        
        ofPtr<triggerZone> z = (*it);
        
        if(XML.pushTag("ZONE", count)){
            
            saveZone(XML, z);
                        
            count++;
            
            //zone tag
            XML.popTag();
        }
        
        
    }

    
}
예제 #2
0
void bankManager::loadScene(ofxXmlSettings & XML, ofPtr<scene> nScene){
    
    
    nScene->setName(XML.getValue("NAME", ""));
    nScene->setUid(XML.getValue("UID", nScene->getUid()));
    nScene->setFadeIn(XML.getValue("FADE_IN", 0.01));
    nScene->setFadeOut(XML.getValue("FADE_OUT", 0.01));
    
    int numZones = XML.getNumTags("ZONE");
    
    for(int tz = 0; tz < numZones; tz++){
        
        ofSleepMillis(1000/60); //FIX ME : a hack to prevent UDP flooding
                                //but really OSC Manager should handle this and throttle the number of messages per frame
        
        if(XML.pushTag("ZONE", tz)){
            
            ofPtr<triggerZone> z = nScene->addTriggerZone(currentZone, true); //isLoading flag to prevent OSC flood
            
            loadZone(XML, z);
            
            
            //zone tag
            XML.popTag();
            
        }
        
    }
    
    
    allScenes.push_back(nScene);

}
예제 #3
0
void bankManager::checkUniqueId(ofPtr<scene> sn){
    
    bool isUnique = false;
    
    while (!isUnique) {
        
        bool isFound = false;
        vector<ofPtr<scene> >::iterator it = allScenes.begin();
        for(it = allScenes.begin(); it != allScenes.end(); it++){
            if(sn->getUid() == (*it)->getUid())isFound = true;
        }
        
        if(isFound){
            sn->newIndex();
        }else{
            isUnique = true;
        }
    }
    
}