void ramActorsScene::addSegment(BaseSegment *newSegment) { const string name = newSegment->getName(); if (mSegmentsMap.find(name) != mSegmentsMap.end()) return; mSegmentsMap.insert( make_pair(name, newSegment) ); /// create and add child panel const int panelIndex = mSegmentsMap.size()-1; const int panelHeight = 192; const int panelHeaderHeight = 164; ofxUICanvasPlus* childPanel = newSegment->createPanel(name); childPanel->getRect()->x = ramGetGUI().kXInit; childPanel->getRect()->y = panelHeaderHeight + panelIndex * panelHeight; childPanel->getRect()->width = ramGetGUI().kLength; /// append widget, resize parent panel, load default settings mLocalPanel->addWidget(childPanel); mLocalPanel->autoSizeToFitWidgets(); newSegment->loadCache(); }
void EmptyScene::setupControlPanel() { ramGetGUI().addSlider("Slider", 0.0, 10.0, &mySlider); ramGetGUI().addToggle("Toggle", &myToggle); ofAddListener(ramGetGUI().getCurrentUIContext()->newGUIEvent, this, &EmptyScene::onPanelChanged); }
void ramBaseApp::drawFloor() { ramDrawBasicFloor(ramGetGUI().getPreferencesTab().getFloorPattern(), ramGetGUI().getPreferencesTab().getFloorSize(), ramGetGUI().getPreferencesTab().getFloorGridSize(), ramColor::GRAY_ALPHA, ramColor::DARK_GRAY_ALPHA); }
void setup() { ofSetFrameRate(60); ofSetVerticalSync(true); ramGetGUI().setup(); ramGetSceneManager().addScene(&scene); }
void ramActorsScene::createPanelHeader() { const int width = ramGetGUI().kLength/2 - 3; const int height = ramGetGUI().kDim * 1.3; mLocalPanel->addLabel(getName(), OFX_UI_FONT_LARGE); mLocalPanel->addSpacer(ramGetGUI().kLength, 2); // ignore win32 #ifndef TARGET_WIN32 mLocalPanel->addWidgetDown( new ofxUILabelButton("Load Recorded File", false, ramGetGUI().kLength, height) ); #endif /// 2x2 matrix btnShowAll = new ofxUILabelToggle("Show All Actors", &bShowAllActor, width, height); mLocalPanel->addWidgetDown( btnShowAll ); mLocalPanel->addWidgetRight( new ofxUILabelButton("Reset Positions", &bRecAllActor, width, height) ); mLocalPanel->addWidgetDown( new ofxUILabelToggle("Use Shading", &bUseShading, width, height) ); mLocalPanel->addWidgetRight( new ofxUILabelToggle("Use SimpleActor", &bUseSimpleActor, width, height) ); /// buttons which are controlled programatically // all of the child widgets of mLocalPanel are deleted when rebuildControlPanel is executed // so it needs to make new pointer btnPause = new ofxUILabelToggle("Pause (Space key)", false, ramGetGUI().kLength, height); btnRecAll = new ofxUILabelToggle("Recording All Actors", false, ramGetGUI().kLength, height); mLocalPanel->addWidgetDown(btnPause); mLocalPanel->addWidgetDown(btnRecAll); }
void ramActorsScene::setupControlPanel() { mLocalPanel = ramGetGUI().getCurrentUIContext(); rebuildControlPanel(); ofAddListener(mLocalPanel->newGUIEvent, this, &ramActorsScene::onValueChanged); // ignore win32 #ifndef TARGET_WIN32 /// load Ando_1.tsv if this is the first launch of this application string initial_file_path = "Settings/presets/preset.init.xml"; if (!ofFile::doesFileExist( ramToResourcePath(initial_file_path) )) { ofBuffer buf("hello ram!"); ofBufferToFile(ramToResourcePath(initial_file_path), buf); loadFile(ramToResourcePath("MotionData/Ando_1.tsv")); } #endif }
void ramInitialize(int oscPort, bool usePresetScenes) { static bool inited = false; if (inited) return; inited = true; ram_simple_shadow.setup(); ramOscManager::instance().setup(oscPort); ramActorManager::instance().setup(); ramActorManager::instance().setupOscReceiver(&ramOscManager::instance()); ramSceneManager::instance().setup(); ramPhysics::instance(); ramGetGUI().setup(usePresetScenes); ramCommunicationManager::instance().setup(&ramOscManager::instance()); }
void ramPresetTab::setEnableScene(size_t idx, bool enable) { // FIXME: // idx:0 is "Actors" scene. it should be not scene but tab. if (idx == 0) return; if (idx > ramSceneManager::instance().getNumScenes()) return; ramSceneManager::instance().getScene(idx)->setEnabled(enable); // 0:Actors, 1:Preset, 2:Preferences tab don't have enableToggle. int ui_offset = 3; if ((idx + ui_offset) > ramSceneManager::instance().getNumScenes()+1) return; ramGetGUI().getSceneTabs().getEnableToggle(idx+ui_offset-1)->setValue(enable); }
void setupControlPanel() { ramGetGUI().getCurrentUIContext()->addFPS(); }
//-------------------------------------------------------------- void Kepler::setupControlPanel() { #ifdef RAM_GUI_SYSTEM_OFXUI ofxUICanvas* panel = ramGetGUI().getCurrentUIContext(); ofAddListener(panel->newGUIEvent, this, &Kepler::onValueChanged); ofxUIRadio *radio = NULL; const float dim = 16.0f; panel->getRect()->width =500.0f; vector<string> names; names.clear(); mNamesNodeA.clear(); for (int i=0; i<ramActor::NUM_JOINTS; i++) { mNamesNodeA["A "+ramActor::getJointName(i)] = i; names.push_back("A "+ramActor::getJointName(i)); } radio = new ofxUIRadio("JOINT A", names, OFX_UI_ORIENTATION_VERTICAL, dim, dim); radio->getToggles().at(ramActor::JOINT_LEFT_HAND)->setValue(true); panel->addWidgetDown(radio); names.clear(); mNamesNodeB.clear(); for (int i=0; i<ramActor::NUM_JOINTS; i++) { mNamesNodeB["B "+ramActor::getJointName(i)] = i; names.push_back("B "+ramActor::getJointName(i)); } radio = new ofxUIRadio("JOINT B", names, OFX_UI_ORIENTATION_VERTICAL, dim, dim); radio->getToggles().at(ramActor::JOINT_RIGHT_HAND)->setValue(true); panel->addWidgetRight(radio); names.clear(); mNamesEdgeA.clear(); for (int i=0; i<KeplerCube::N_EDGES; i++) { mNamesEdgeA["A EDGE_"+ofToString(i)] = i; names.push_back("A EDGE_"+ofToString(i)); } radio = new ofxUIRadio("EDGE A", names, OFX_UI_ORIENTATION_VERTICAL, dim, dim); radio->getToggles().at(KeplerCube::EDGE_9)->setValue(true); panel->addWidgetRight(radio); names.clear(); mNamesEdgeB.clear(); for (int i=0; i<KeplerCube::N_EDGES; i++) { mNamesEdgeB["B EDGE_"+ofToString(i)] = i; names.push_back("B EDGE_"+ofToString(i)); } radio = new ofxUIRadio("EDGE B", names, OFX_UI_ORIENTATION_VERTICAL, dim, dim); radio->getToggles().at(KeplerCube::EDGE_11)->setValue(true); panel->addWidgetRight(radio); #endif }