void ofApp::guiEvent(ofxUIEventArgs &e) { if (e.getName() == "FULLSCREEN") { ofxUIToggle* toggle = e.getToggle(); ofSetFullscreen(toggle->getValue()); } else if (e.getName() == "ENABLE FACE TRACKING") { ofxUIToggle* toggle = e.getToggle(); trackingEnabled = toggle->getValue(); } else if (e.getName() == "SHOW TRACKER") { ofxUIToggle* toggle = e.getToggle(); showTracker = toggle->getValue(); } else if (e.getName() == "SET TRACKER OFFSET") { ofxUIButton *button = (ofxUIButton *)e.widget; if (button->getValue()) { trackerOffset = ofVec2f(cam.getPosition().x - trackerOffset.x, cam.getPosition().y - trackerOffset.y); } } else if (e.getName() == "REMOVE TRACKER OFFSET") { ofxUIButton *button = (ofxUIButton *)e.widget; if (button->getValue()) { trackerOffset = ofVec2f(); } } }
//------------- void ofApp::selectAudioUnit(ofxUIEventArgs &e) { if (e.getButton()->getValue()) return; if (e.getName() == "Aalto") { setupAalto(); } else if (e.getName() == "Kaivo") { setupKaivo(); } }
void GUIAxes::guiEvent(ofxUIEventArgs &e){ // events based on mouse released if(ofGetMousePressed()){return;} string name = e.getName(); int axe = getNumAxe(e.getParent()); ofLogNotice("GUI") << e.getParent()->getName() << " // " << e.getName() << "// " << axe ; // attributes and aggregator modification if( axe!=-1 && attr[axe]->getSelected().size()>0 ){ if(isAnAttributeList(e.getParent())){ shouldUpdateAggregator = axe; } else if (aggr[axe]->getSelected().size()>0 && scaleType[axe]->getSelectedIndeces().size()>0) { reorderAxe(axe); } } else if(e.getParent() == coordinateType){ for(int i = 0 ; i <3; i++){ reorderAxe(i); } } // mins maxs modifications else if (e.getKind() == OFX_UI_WIDGET_NUMBERDIALER){ axe = getNumAxe(e.widget); float s =((ofxUINumberDialer*)e.widget)->getValue(); ofVec3f mask(axe==0?1:0,axe==1?1:0,axe==2?1:0); if(name.substr(0,name.length()-1)=="min"){ Physics::mins = s*mask + (-mask+ofVec3f(1))*Physics::mins; } if(name.substr(0,name.length()-1)=="max"){ Physics::maxs = s*mask + (-mask+ofVec3f(1))*Physics::maxs; } scaleType[axe]->getToggles()[2]->setValue(true); scaleType[axe]->getToggles()[2]->triggerSelf(); Physics::orderByAttributes(attr[axe]->getSelected()[0]->getName()+"."+aggr[axe]->getSelected()[0]->getName(), axe, scaleType[axe]->getSelectedIndeces()[0]); } checkOverlapingDDL(e); }
void ofxUITabBar::mainUiEvent(ofxUIEventArgs &event) { string name = event.getName(); for (map<ofxUIToggle*, ofxUICanvas*>::iterator it=canvases.begin(); it!=canvases.end(); ++it) { if(active != NULL && active->getName() == name) { it->first->setValue(false); it->second->disable(); active = NULL; } else if(it->second->getName() == name && event.getToggle()->getValue()) { active = it->second; it->first->setValue(true); it->second->enable(); it->second->setPosition(rect->getX() + rect->getWidth() + padding*0.5, this->rect->getY()); } else { it->first->setValue(false); it->second->disable(); } } }
void TestScene::guiEvent(ofxUIEventArgs &e) { string name = e.getName(); int kind = e.getKind(); //cout << "got event from: " << name << endl; }
void SuperColliderLoopElement::guiEvent(ofxUIEventArgs &e) { if (e.getName() == "Play") { setPlaying(isPlay); } else if (e.getName() == "Rec") { setToRecord(toRecord); } else if (e.getName() == "Solo") { setSolo(solo); SuperColliderLoopElement *ref = this; ofNotifyEvent(soloEvent, ref); } else if (e.getName() == "Del") { SuperColliderLoopElement *ref = this; ofNotifyEvent(deleteEvent, ref); } else if (e.getName() == "Skip") { skip = pow((float) 2, (float) ((ofxUIRadio *) gui->getWidget("Skip"))->getValue()); count = beat % (numBeats * getSkip()); } else if (e.getName() == "BusIn") { int channel = ((ofxUIRadio *) gui->getWidget("BusIn"))->getValue(); bufWriter->set("channel", channel); } else if (e.getName() == "Volume") { cout << "write vol " << volume << endl; bufReader->set("volume", volume); } }
void ofApp::guiEvent(ofxUIEventArgs &e) { string name = e.getName(); int kind = e.getKind(); cout << "got event from: " << name << endl; if(kind == OFX_UI_WIDGET_NUMBERDIALER) { ofxUINumberDialer *n = (ofxUINumberDialer *) e.widget; cout << n->getValue() << endl; } if(name == "SAMPLER") { ofxUIImageSampler *is = (ofxUIImageSampler *) e.widget; ofColor clr = is->getColor(); red = clr.r; blue = clr.b; green = clr.g; } else if(name == "BUTTON") { ofxUIButton *button = (ofxUIButton *) e.getButton(); bdrawGrid = button->getValue(); } else if(name == "TOGGLE") { ofxUIToggle *toggle = (ofxUIToggle *) e.getToggle(); bdrawGrid = toggle->getValue(); if(textInput != NULL) { textInput->setFocus(bdrawGrid); } } else if(name == "RADIO VERTICAL") { ofxUIRadio *radio = (ofxUIRadio *) e.widget; cout << radio->getName() << " value: " << radio->getValue() << " active name: " << radio->getActiveName() << endl; } else if(name == "TEXT INPUT") { ofxUITextInput *ti = (ofxUITextInput *) e.widget; if(ti->getInputTriggerType() == OFX_UI_TEXTINPUT_ON_ENTER) { cout << "ON ENTER: "; } else if(ti->getInputTriggerType() == OFX_UI_TEXTINPUT_ON_FOCUS) { cout << "ON FOCUS: "; } else if(ti->getInputTriggerType() == OFX_UI_TEXTINPUT_ON_UNFOCUS) { cout << "ON BLUR: "; } string output = ti->getTextString(); cout << output << endl; } }
void CloudsVisualSystemMazeGenerator::selfGuiEvent(ofxUIEventArgs &e) { if (e.getName() == "GROUND CAM") { if (!settings.groundCam) { mazeCam.setFlyOver(maze[0]->getWidth()/2); } } }
//-------------------------------------------------------------- void TestScene::guiEvent(ofxUIEventArgs &e) { name = e.getName() ; if ( name == "LOAD SETTINGS" && e.getButton()->getValue() == true ) loadSettings() ; if ( name == "SAVE SETTINGS" && e.getButton()->getValue() == true ) saveSettings() ; }
//-------------------------------------------------------------- void ofApp::guiEvent(ofxUIEventArgs &e) { string name = e.getName(); string alignment = "alignment"; if(name == "pixelWidth" || name == "pixelWidthLarge"){ ((ofxUITextInput*)settingCanvas->getWidget("pixelWidthText"))->setTextString(ofToString(float(desideredPixelWidthLarge)+desideredPixelWidth)); }else if(name == "pixelWidthText"){ string val = ((ofxUITextInput*)e.widget)->getTextString(); float fval = ofToFloat(val); desideredPixelWidth = fmodf(fval,1.0); desideredPixelWidthLarge = floor(fval); }else if(name == "Calibrate Menu"){ lastState = state; state = Calibratig; settingCanvas->setVisible(false); calibrateCanvas->setVisible(true); }else if(name.substr(0,alignment.size()) == alignment ){ int start = alignment.size()+1; int x = ofToInt(name.substr(start,start+1)); int y = ofToInt(name.substr(start+2,start+3)); texAlign.x = x == 0 ? 0 : x == 1 ? 0.5 : 1.0; texAlign.y = y == 0 ? 1.0 : y == 1 ? 0.5 : 0.0; }else if(name == "Settings Menu"){ lastState = state; state = Settings; settingCanvas->setVisible(true); calibrateCanvas->setVisible(false); }else if(name == "Calibration Size"){ ofxUIRadio* w = ((ofxUIRadio*)e.widget); string active = w->getActiveName(); vector<string> names(calibrationSizeOptionsNames,end(calibrationSizeOptionsNames)); int pos = find(names.begin(), names.end(), active) - names.begin(); ((ofxUILabel*)calibrateCanvas->getWidget("selected_calibration"))->setLabel(calibrationSizeOptionsNames[pos]); currentCalibratorTolLengthInMM = calibrationSizeOptionsValues[pos]; }else if(name == "Read From Marker"){ outPixelPerMM = calibratorTool.getLength() / currentCalibratorTolLengthInMM; }else if(name == "Syphon Servers"){ ofxUIRadio *syphon_list = (ofxUIRadio*)e.widget; string active = syphon_list->getActiveName(); vector<string> parts = ofSplitString(active, "::"); syphonServerDesc = ofxSyphonServerDescription(parts[0],parts[1]); syphonClient.set(syphonServerDesc); }else if(name == "Mode"){ ofxUIRadio *mode_list = (ofxUIRadio*)e.widget; if(mode_list->getActiveName() == "Round"){ mode = 0; }else { mode = 1; } } }
//-------------------------------------------------------------- void AnimationWaves::guiEvent(ofxUIEventArgs &e) { Animation::guiEvent(e); string name = e.getName(); if (name == "nbWavePoints") { m_nbWavePoints = (int) e.getSlider()->getScaledValue(); updateNbPointsForWaves(); } }
void CloudsVisualSystemPaintBrush::guiSystemEvent(ofxUIEventArgs &e) { if (e.widget->getKind() == OFX_UI_WIDGET_TOGGLE && e.getToggle()->getValue()) { string name = e.getName(); for (map<string, ofPixels *>::iterator it = colorMapPixelsMap.begin(); it != colorMapPixelsMap.end(); it++) { if (it->first == name) { colorMap = it->second; } } } }
void ofApp::guiEvent(ofxUIEventArgs &e) { string name = e.getName(); int kind = e.getKind(); cout << "got event from: " << name << endl; if(name == "RED") { ofxUISlider *slider = (ofxUISlider *) e.getSlider(); cout << "RED " << slider->getScaledValue() << endl; red = slider->getScaledValue(); } else if(name == "GREEN") { ofxUISlider *slider = (ofxUISlider *) e.getSlider(); cout << "GREEN " << slider->getScaledValue() << endl; green = slider->getScaledValue(); } else if(name == "BLUE") { ofxUISlider *slider = (ofxUISlider *) e.getSlider(); cout << "BLUE " << slider->getScaledValue() << endl; blue = slider->getScaledValue(); } else if(name == "BUTTON") { ofxUIButton *button = (ofxUIButton *) e.getButton(); bdrawGrid = button->getValue(); } else if(name == "TOGGLE") { ofxUIToggle *toggle = (ofxUIToggle *) e.getToggle(); bdrawGrid = toggle->getValue(); } else if(name == "TEXT INPUT") { ofxUITextInput *textinput = (ofxUITextInput *) e.widget; if(textinput->getTriggerType() == OFX_UI_TEXTINPUT_ON_ENTER) { cout << "ON ENTER: "; } else if(textinput->getTriggerType() == OFX_UI_TEXTINPUT_ON_FOCUS) { cout << "ON FOCUS: "; } else if(textinput->getTriggerType() == OFX_UI_TEXTINPUT_ON_UNFOCUS) { cout << "ON BLUR: "; } string output = textinput->getTextString(); cout << output << endl; } }
void ofApp::guiEvent(ofxUIEventArgs &e){ string name = e.getName(); int kind = e.getKind(); if (name=="simulate") { simulate = ((ofxUIToggle *)e.widget)->getValue(); } else if (name == "enable actuator 1"){ enableActuator(1); } else if (name == "enable actuator 2"){ enableActuator(2); } }
void testApp::onGuiEvent( ofxUIEventArgs &e){ // Send Message To Log. Where is message coming from? cout << "I got a message" << e.getName() << endl; // Force Slider if( e.getName() == "Mass"){ ofxUISlider * ForceSlider = (ofxUISlider*)e.widget; mass = ForceSlider -> getScaledValue(); } if( e.getName() == "Alpha"){ ofxUISlider * ForceSlider = (ofxUISlider*)e.widget; alphaLevel = ForceSlider -> getScaledValue(); } // Alpha Slider if( e.getName() == "Field"){ ofxUISlider * AlphaSlider = (ofxUISlider*)e.widget; fieldForce = AlphaSlider -> getScaledValue(); } }
void ofApp::guiEvent(ofxUIEventArgs &e) { string name = e.getName(); cout << "got event from: " << name << endl; if(name == "VAR") { ofxUISlider *sliderValue = (ofxUISlider *) e.getSlider(); ofxOscMessage m; m.setAddress("/var"); m.addFloatArg(sliderValue->getValue()); sender.sendMessage(m); } }
//-------------------------------------------------------------- void toolCalibration::handleEvents(ofxUIEventArgs& e) { string name = e.getName(); OFAPPLOG->begin("toolCalibration::handleEvents('"+name+"')"); OFAPPLOG->println("- kind="+ofToString(e.getKind())); if (e.getKind() == OFX_UI_WIDGET_TOGGLE) { ofxUIToggle* pToggle = e.getToggle(); if (pToggle->getValue()) { mp_modelData = 0; m_editModelPropertyName = name; if (pToggle->getParent() == mp_radioApparel) { m_editModel = EDIT_APPAREL; mp_modelData = &m_apparelData; } else if (pToggle->getParent() == mp_radioManikin) { m_editModel = EDIT_MANIKIN; mp_modelData = &m_manikinData; } if (mp_modelData) { mp_modelData->reset(); mp_modelData->m_modelPositionSensitivity = m_modelPositionSensitivity; mp_modelData->m_modelScaleSensitivity = m_modelScaleSensitivity; } } } else if (e.getKind() == OFX_UI_WIDGET_LABELBUTTON) { if (name == "savePropertiesDevice" && e.getButton()->getValue()==1) { GLOBALS->getApp()->apparelModel.saveProperties(); OSC_SENDER->saveCalibration(); } } OFAPPLOG->end(); }
void ofApp::guiEvent(ofxUIEventArgs &e) { // if(e.getName() == "Background") // { // ofxUISlider *slider = new ofxUISlider(); // ofBackground(slider->getScaledValue()); // } if(e.getName() == "fogNear") { ofxUISlider *slider = new ofxUISlider(); } // else if(e.getName() == "tunnelLength") // { // ofxUISlider *slider = new ofxUISlider(); // // } // else if(e.getName() == "tunnelSeparation") // { // // } // else if(e.getName() == "tunnelRadius") // { // // } // else if(e.getName() == "rotationChange") // { // // } // else if(e.getName() == "xRotation") // { // // } // else if(e.getName() == "yRotation") // { // // } // else if(e.getName() == "moveSpeed") // { // // } // else if(e.getName() == "circleResolution") // { // // } }
void CloudsVisualSystemFlocking::guiSystemEvent(ofxUIEventArgs &e){ string name = e.getName(); if(name == "ADD PARTICLE") { if(e.getButton()->getValue()) { for(int i = 0; i < 100; i++) { ofxBoidParticle *bp = new ofxBoidParticle(ofVec3f(ofRandom(-debugGridSize, debugGridSize), ofRandom(-debugGridSize, debugGridSize), ofRandom(-debugGridSize, debugGridSize))); bp->setParticlesRef(&ps->getParticles()); ps->addParticle(bp); } } } else if(name == "BORDER") { *(ps->bWidth) = debugGridSize; *(ps->bHeight) = debugGridSize; *(ps->bDepth) = debugGridSize; } else if(name == "ZONE RADIUS") { (*ps->zoneRadiusHalf) = (*ps->zoneRadius)/2.0; (*ps->zoneRadiusSqrd) = powf((*ps->zoneRadius), 2.0); } else if(name == "KILL PARTICLES") { if(e.getButton()->getValue()) { ps->clear(); } } else if(name == "PRINT SETTINGS") { if(e.getButton()->getValue()) { ps->printSettings(); } } else if(name == "RANDOMIZE") { if(e.getButton()->getValue()) { randomize(); } } }
void PMUICanvasRibbonRenderer::handleEvents(ofxUIEventArgs &e) { PMUICanvasBaseRenderer::handleEvents(e); string name = e.getName(); if (name == STR_BRUSH_COLORMODE_RADIO) { ofxUIRadio *colorModeRadio = (ofxUIRadio *)(e.widget); colorMode = (RibbonColorMode)(colorModeRadio->getValue()); ofxUIIntSlider *slColorR = (ofxUIIntSlider *)getWidget(STR_BRUSH_COLORMODE_R); colorR = slColorR->getValue(); ofxUIIntSlider *slColorG = (ofxUIIntSlider *)getWidget(STR_BRUSH_COLORMODE_G); colorG = slColorG->getValue(); ofxUIIntSlider *slColorB = (ofxUIIntSlider *)getWidget(STR_BRUSH_COLORMODE_B); colorB = slColorB->getValue(); } }
//------------------------------------------------------------------------------------ //GUI STUFF void ofApp::guiEvent(ofxUIEventArgs &e) { string name = e.getName(); if(name == "Load Video"){ videoLoaded = false; ofxUIButton *button = (ofxUIButton *) e.getButton(); if (button->getValue()){ timeline.stop(); //pausePlayback = true; ofFileDialogResult result = ofSystemLoadDialog("Choose a Video File",false); if(result.bSuccess){ //need to clear old data //timeline.removeTrack("Video"); loadVideo(result.getPath(),result.getName()); } } } else if (name == "Toggle Min Movement"){ minMovementBool = e.getToggle()->getValue(); minMove->setVisible(minMovementBool); } else if (name == "Toggle Max Movement"){ maxMovementBool = e.getToggle()->getValue(); maxMove->setVisible(maxMovementBool); } else if(name == "Min Movement") { minMovementThresh = e.getSlider()->getValue(); } else if(name == "Max Movement") { maxMovementThresh = e.getSlider()->getValue(); } else if(name == "Length Range"){ if(loopLengthSlider->getState() != OFX_UI_STATE_DOWN){ timeline.stop(); minPeriod = (int)(fps*minPeriodSecs); maxPeriod = (int)(fps*maxPeriodSecs); } } }
void ofApp::guiEvent(ofxUIEventArgs &e) { string name = e.getName(); int kind = e.getKind(); cout << "got event from: " << name << endl; if(name=="NUMPATTERN") { mesh.clear(); for(int i = 0 ; i < numPattern ; i++) { for( int j = 0 ; j < numStroke ; j++) { mesh.addVertex(ofVec3f(0,0)); mesh.addVertex(ofVec3f(0,0)); } } vbo = mesh; } if(name=="NUMSTROKE") { mesh.clear(); for(int i = 0 ; i < numPattern ; i++) { for( int j = 0 ; j < numStroke ; j++) { mesh.addVertex(ofVec3f(0,0)); mesh.addVertex(ofVec3f(0,0)); } } vbo = mesh; } }
void GUIMidi::guiEvent(ofxUIEventArgs & e){ if(e.getParent() == midiPorts){ Midi::i()->midiIn.closePort(); Midi::i()->midiIn.openPort(e.getName()); } else if(e.widget == midiVelCenter || e.widget == midiVelRange){ Midi::velScale.set(midiVelCenter->getValue() - midiVelRange->getValue()/2.0,midiVelCenter->getValue() + midiVelRange->getValue()/2.0); } else if(e.widget == resetNoteMap && !resetNoteMap->getValue()){ Midi::midiNotes.clear(); } else if(e.widget == midiRadius){ Midi::radius = midiRadius->getValue(); for(auto & m:Midi::midiSpots){ m.radius = Midi::radius; } } else if(e.widget == midiHold){ Midi::hold=midiHold->getValue(); } else if(e.widget == midiLink2Cam){ Midi::link2Cam = midiLink2Cam->getValue(); } else if(e.widget == vel2Vol ){ Midi::vel2VolScale.set(vel2Vol->getValueLow(),vel2Vol->getValueHigh()); } else if(e.widget == midiSpots){ Midi::bMidiSpot = e.getBool(); } else if(e.widget==randomMidi){ Midi::random = e.getDouble(); } }
void SuperColliderLooper::guiEvent(ofxUIEventArgs &evt) { if (evt.getName() == "Bpm") { setBpm(bpm); } else if (evt.getName() == "Record") { string filename = ofSystem("Filename"); } else if (evt.getName() == "+1" && ((ofxUILabelButton *) gui->getWidget("+1"))->getValue()) { addNewElement(1, elements.size()); } else if (evt.getName() == "+2" && ((ofxUILabelButton *) gui->getWidget("+2"))->getValue()) { addNewElement(2, elements.size()); } else if (evt.getName() == "+4" && ((ofxUILabelButton *) gui->getWidget("+4"))->getValue()) { addNewElement(4, elements.size()); } else if (evt.getName() == "+8" && ((ofxUILabelButton *) gui->getWidget("+8"))->getValue()) { addNewElement(8, elements.size()); } else if (evt.getName() == "+16" && ((ofxUILabelButton *) gui->getWidget("+16"))->getValue()) { addNewElement(16, elements.size()); } }
void CloudsVisualSystemBalloons::selfGuiEvent(ofxUIEventArgs &e) { string name = e.getName(); if( name == "c0Hue"|| name == "c0Saturation"|| name == "c0Brightness" || name == "w0") { c0.setHue(c0Hue); c0.setSaturation(c0Sat); c0.setBrightness(c0Bri); colorGui->getWidget("c0Hue")->setColorFill(c0); colorGui->getWidget("c0Saturation")->setColorFill(c0); colorGui->getWidget("c0Brightness")->setColorFill(c0); setBalloonColors(); } else if( name == "c1Hue"|| name == "c1Saturation"|| name == "c1Brightness" || name == "w1") { c1.setHue(c1Hue); c1.setSaturation(c1Sat); c1.setBrightness(c1Bri); colorGui->getWidget("c1Hue")->setColorFill(c1); colorGui->getWidget("c1Saturation")->setColorFill(c1); colorGui->getWidget("c1Brightness")->setColorFill(c1); setBalloonColors(); } else if( name == "c2Hue"|| name == "c2Saturation"|| name == "c2Brightness" || name == "w2") { c2.setHue(c2Hue); c2.setSaturation(c2Sat); c2.setBrightness(c2Bri); colorGui->getWidget("c2Hue")->setColorFill(c2); colorGui->getWidget("c2Saturation")->setColorFill(c2); colorGui->getWidget("c2Brightness")->setColorFill(c2); setBalloonColors(); } else if( name == "c3Hue"|| name == "c3Saturation"|| name == "c3Brightness" || name == "w3") { c3.setHue(c3Hue); c3.setSaturation(c3Sat); c3.setBrightness(c3Bri); colorGui->getWidget("c3Hue")->setColorFill(c3); colorGui->getWidget("c3Saturation")->setColorFill(c3); colorGui->getWidget("c3Brightness")->setColorFill(c3); setBalloonColors(); } else if(name == "reset") { bReleased = false; setBalloonPositions(); } else if(name == "release") { bReleased = true; } else if(name == "sphereVolume") { releaseType = 0; bReleased = false; setBalloonPositions(); } else if(name == "plane") { releaseType = 1; bReleased = false; setBalloonPositions(); } else if(name == "cos") { releaseType = 2; bReleased = false; setBalloonPositions(); } else if(name == "bulge") { releaseType = 3; bReleased = false; setBalloonPositions(); } }
void testApp::guiEvent(ofxUIEventArgs &e){ string name = e.widget->getName(); int kind = e.widget->getKind(); if(e.getName() == "FULLSCREEN"){ ofxUIToggle *toggle = (ofxUIToggle *) e.widget; ofSetFullscreen(toggle->getValue()); /*----------------- PARTICLES -----------------*/ }else if(name == "PARTICLE GUI MODE"){ ofxUIToggle *toggle = (ofxUIToggle *) e.widget; particleGUImode = toggle->getValue(); }else if(name == "EXPANSION"){ ofxUISlider *slider = (ofxUISlider *) e.widget; expansion = slider->getScaledValue(); }else if(name == "ROTATION"){ ofxUISlider *slider = (ofxUISlider *) e.widget; rotation = slider->getScaledValue(); }else if(name == "SHAPE SIZE"){ ofxUISlider *slider = (ofxUISlider *) e.widget; shapeSize = slider->getScaledValue(); }else if(name == "VERTICES"){ ofxUISlider *slider = (ofxUISlider *) e.widget; nVertices = slider->getScaledValue(); }else if(name == "PARTICLE SIZE"){ ofxUISlider *slider = (ofxUISlider *) e.widget; particleSize = slider->getScaledValue(); }else if(name == "SHAPES"){ ofxUIRadio *radio = (ofxUIRadio *) e.widget; cout << radio->getName() << " value: " << radio->getValue() << " active name: " << radio->getActiveName() << endl; selectedShape = radio->getActiveName(); }else if(name == "MODES"){ ofxUIRadio *radio = (ofxUIRadio *) e.widget; cout << radio->getName() << " value: " << radio->getValue() << " active name: " << radio->getActiveName() << endl; selectedMode = radio->getActiveName(); /*---------------- BACKGROUND -----------------*/ }else if(name == "TILE GUI MODE"){ ofxUIToggle *toggle = (ofxUIToggle *) e.widget; tileGUImode = toggle->getValue(); }else if(name == "TILE MODES"){ ofxUIRadio *radio = (ofxUIRadio *) e.widget; cout << radio->getName() << " value: " << radio->getValue() << " active name: " << radio->getActiveName() << endl; selectedTileMode = radio->getActiveName(); }else if(name == "HUE"){ ofxUISlider *slider = (ofxUISlider *) e.widget; hue = slider->getScaledValue(); }else if(name == "VIDEO"){ ofxUISlider *slider = (ofxUISlider *) e.widget; videoAlpha = slider->getScaledValue(); }else if(name == "THRESHOLD"){ ofxUISlider *slider = (ofxUISlider *) e.widget; threshold = slider->getScaledValue(); } }
void testApp::guiEvent(ofxUIEventArgs &e) { if(e.getName() == "FULLSCREEN") { ofxUIToggle *toggle = e.getToggle(); ofSetFullscreen(toggle->getValue()); }else if(e.getName() == "Meditation_Level") { ofxUISlider *slider = e.getSlider(); meditationLevel = slider->getScaledValue(); }else if(e.getName() == "camera_distance"){ ofxUISlider *slider = e.getSlider(); camDistance = slider->getScaledValue(); }else if(e.getName() == "background_color"){ ofxUISlider *slider = e.getSlider(); ofBackground(slider->getScaledValue()); }else if(e.getName() == "Whole_Scene_Position_x"){ ofxUISlider *slider = e.getSlider(); whole_scene_x = slider->getScaledValue(); }else if(e.getName() == "Whole_Scene_Position_y"){ ofxUISlider *slider = e.getSlider(); whole_scene_y = slider->getScaledValue(); }else if(e.getName() == "Whole_Scene_Position_z"){ ofxUISlider *slider = e.getSlider(); whole_scene_z = slider->getScaledValue(); }else if(e.getName() == "Whole_Scene_Rotate_x"){ ofxUISlider *slider = e.getSlider(); scene_rx = slider->getScaledValue(); }else if(e.getName() == "Whole_Scene_Rotate_y"){ ofxUISlider *slider = e.getSlider(); scene_ry = slider->getScaledValue(); }else if(e.getName() == "Whole_Scene_Rotate_z"){ ofxUISlider *slider = e.getSlider(); scene_rz = slider->getScaledValue(); }else if(e.getName() == "particle_Size"){ ofxUISlider *slider = e.getSlider(); particleSize = slider->getScaledValue(); }else if(e.getName() == "PlaneX"){ ofxUISlider *slider = e.getSlider(); planeX = slider->getScaledValue(); }else if(e.getName() == "PlaneY"){ ofxUISlider *slider = e.getSlider(); planeY = slider->getScaledValue(); }else if(e.getName() == "PlaneZ"){ ofxUISlider *slider = e.getSlider(); planeZ = slider->getScaledValue(); }else if(e.getName() == "whole_scene_scale"){ ofxUISlider *slider = e.getSlider(); whole_scene_scale = slider->getScaledValue(); }else if(e.getName() == "tv_x"){ ofxUISlider *slider = e.getSlider(); tv_x = slider->getScaledValue(); }else if(e.getName() == "tv_y"){ ofxUISlider *slider = e.getSlider(); tv_y = slider->getScaledValue(); }else if(e.getName() == "tv_z"){ ofxUISlider *slider = e.getSlider(); tv_z = slider->getScaledValue(); }else if(e.getName() == "gif_x"){ ofxUISlider *slider = e.getSlider(); image_x = slider->getScaledValue(); }else if(e.getName() == "gif_y"){ ofxUISlider *slider = e.getSlider(); image_y = slider->getScaledValue(); }else if(e.getName() == "gif_z"){ ofxUISlider *slider = e.getSlider(); image_z = slider->getScaledValue(); }else if(e.getName() == "gif_scale"){ ofxUISlider *slider = e.getSlider(); image_scale = slider->getScaledValue(); } }
void testApp::menuEvent(ofxUIEventArgs &e) { zoom_in = false; zoom_out = false; string name = e.getName(); if (name == "Straight Links") { ((ofxUIImageToggle*)menu->getWidget("Straight Links"))->setValue(true); ((ofxUIImageToggle*)menu->getWidget("Segmented Links"))->setValue(false); ((ofxUIImageToggle*)menu->getWidget("Curved Links"))->setValue(false); composer->setLinkType(STRAIGHT_LINKS); } else if (name == "Curved Links") { ((ofxUIImageToggle*)menu->getWidget("Curved Links"))->setValue(true); ((ofxUIImageToggle*)menu->getWidget("Segmented Links"))->setValue(false); ((ofxUIImageToggle*)menu->getWidget("Straight Links"))->setValue(false); composer->setLinkType(CURVE_LINKS); } else if (name == "Segmented Links") { ((ofxUIImageToggle*)menu->getWidget("Segmented Links"))->setValue(true); ((ofxUIImageToggle*)menu->getWidget("Curved Links"))->setValue(false); ((ofxUIImageToggle*)menu->getWidget("Straight Links"))->setValue(false); composer->setLinkType(PATH_LINKS); } else if (name == "Create Node") { if (newNodeInput == NULL) this->createNodeInput((ofGetWidth()/2)-75, ofGetHeight()/2); else if (!newNodeInput->isClicked()){ newNodeInput->getRect()->setX((ofGetWidth()/2)-75); newNodeInput->getRect()->setY(ofGetHeight()/2); newNodeInput->getDropdownList()->getRect()->setX((ofGetWidth()/2)-75); newNodeInput->getDropdownList()->getRect()->setY(ofGetHeight()/2); newNodeInput->setFocus(true); } } else if (name == "Edit Mode on/off") { if (composer->getEdit()) composer->setEdit(false); else composer->setEdit(true); } else if (name == "Inspect"){ if (open_flyout) open_flyout = false; else open_flyout = true; } else if (name == "Zoom In"){ if(((ofxUIMultiImageButton*)e.widget)->getValue() == 1){ zoom_in = true; scale -= 10*SCALE_SENSITIVITY; cam.setScale(scale); } } else if (name == "Zoom Out"){ if(((ofxUIMultiImageButton*)e.widget)->getValue() == 1){ zoom_out = true; scale += 10*SCALE_SENSITIVITY; cam.setScale(scale); } } else if (name == "Save Snippet"){ if(((ofxUIMultiImageButton*)e.widget)->getValue() == 1){ composer->saveSnippet(); } } else if (name == "Open Snippet"){ if(((ofxUIMultiImageButton*)e.widget)->getValue() == 1){ composer->loadSnippet(); } } }
void blobApp::guiEvent(ofxUIEventArgs &_e) { if (_e.getName() == mResSlider->getName()) { int vcnt = mResSlider->getScaledValue(); if (mMasterCurve) mMasterCurve->resample(vcnt); } else if (_e.getName() == mHoleToggle->getName()) { if (mMasterCurve) { mMasterCurve->removeHole(true, mMirrorHolesToggle->getValue()); if (mHoleToggle->getValue()) { mMasterCurve->addHole(mHolePosSlider->getScaledValue(), mHoleOSSlider->getScaledValue(), mHoleSizeSlider->getScaledValue(), mMirrorHolesToggle->getValue()); } mMasterCurve->freeHoles(false); mFreeHolesToggle->setValue(false); } } else if (_e.getName() == mMirrorHolesToggle->getName()) { if (mMasterCurve) { mMasterCurve->removeHole(false,!mMirrorHolesToggle->getValue()); if (mMirrorHolesToggle->getValue() == true) { mHoleToggle->setName("add holes"); mMasterCurve->removeHole(true, true); mMasterCurve->addHole(mHolePosSlider->getScaledValue(), mHoleOSSlider->getScaledValue(), mHoleSizeSlider->getScaledValue(), mMirrorHolesToggle->getValue()); } else { mHoleToggle->setName("add hole"); } if (mMirrorHolesToggle->getValue()) { mMasterCurve->freeHoles(false); mFreeHolesToggle->setValue(false); } } } else if (_e.getName() == mFreeHolesToggle->getName()) { if (mMasterCurve) { mMasterCurve->freeHoles(mFreeHolesToggle->getValue()); // if (mFreeHolesToggle->getValue()) { // mHoleGUI->removeWidget(mHoleOSSlider); // mHoleGUI->removeWidget(mHolePosSlider); // mHoleGUI->removeWidget(mHoleSizeSlider); // } else { // mHoleGUI->addWidget(mHoleOSSlider); // mHoleGUI->addWidget(mHolePosSlider); // mHoleGUI->addWidget(mHoleSizeSlider); // } } } else if (_e.getName() == mUpdateButton->getName() && mUpdateButton->getValue()) { mForm->update(); } else if (_e.getName() == mShowZipperToggle->getName()) { mMasterCurve->showZipper(mShowZipperToggle->getValue()); } else if (_e.getName() == mExportCutFileButton->getName() && mExportCutFileButton->getValue()) { ofBeginSaveScreenAsPDF("blob-to-cut-"+ofGetTimestampString()+".pdf", false); ofClear(255,255,255); ofPushMatrix(); ofTranslate(ofGetWidth()*0.5, ofGetHeight()*0.5); mMasterCurve->mZipperPath->draw(); ofPopMatrix(); ofEndSaveScreenAsPDF(); } else if (_e.getName() == mExportSTLButton->getName() && mExportSTLButton->getValue()) { mForm->exportModel(); } }
//-------------------------------------------------------------- void ofApp::guiEvent(ofxUIEventArgs &e){ if(e.getName()=="Fullscreen"){ ofToggleFullscreen(); } }