//-------------------------------------------------------------- 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 GUIAxes::checkOverlapingDDL(ofxUIEventArgs & e){ switch (e.getKind()) { case OFX_UI_WIDGET_DROPDOWNLIST: {bool hideothers = ((ofxUIDropDownList*)e.widget)->getValue(); if(e.getCanvasParent()!=NULL){ vector<ofxUIWidget*> vv = e.getCanvasParent()->getWidgetsOfType(OFX_UI_WIDGET_DROPDOWNLIST); for(vector<ofxUIWidget*>::iterator it = vv.begin() ; it !=vv.end() ; ++it){ if(e.widget->getRect()->x == (*it)->getRect()->x && e.widget->getRect()->y < (*it)->getRect()->y &&((ofxUIDropDownList*)*it)!=e.widget){ ((ofxUIDropDownList*)*it)->setVisible(!hideothers); } } } } break; default: break; } }
void TestScene::guiEvent(ofxUIEventArgs &e) { string name = e.getName(); int kind = e.getKind(); //cout << "got event from: " << name << endl; }
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 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 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 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; } }