void ResourceWindow::updateCharacter( Fl_Tree_Item* tree, SmartBody::SBCharacter* character ) { SmartBody::SBCharacter* sbcharacter = dynamic_cast<SmartBody::SBCharacter*>(character); Fl_Tree_Item* item = resourceTree->add(tree,character->getName().c_str()); item->user_data((void*) addSpecialName(character->getName())); resourceTree->sortorder(FL_TREE_SORT_NONE); Fl_Tree_Item* skeletonFolder = resourceTree->add(item,"skeleton"); skeletonFolder->user_data((void*) _reverseSpecialNames["skeleton"]); SmartBody::SBSkeleton* sbSk = sbcharacter->getSkeleton(); if (sbSk) { Fl_Tree_Item* charSkItem = resourceTree->add(skeletonFolder, sbSk->getName().c_str()); } Fl_Tree_Item* controllerFolder = resourceTree->add(item,"controllers"); controllerFolder->user_data((void*) _reverseSpecialNames["controller"]); controllerFolder->close(); // add controllers MeControllerTreeRoot* ctTree = character->ct_tree_p ; if( ctTree ) { int n = ctTree->count_controllers(); for (int c = 0; c < n; c++) { //LOG( "%s", ctTree->controller(c)->name() ); Fl_Tree_Item* ctrlItem = resourceTree->add(controllerFolder,ctTree->controller(c)->getName().c_str()); // ctrlItem->user_data((void*)ITEM_CONTROLLER); } } /* // add gesture map Fl_Tree_Item* gestureFolder = resourceTree->add(item,"gestures"); gestureFolder->user_data((void*)-1); gestureFolder->close(); // add individual gesture mappings SmartBody::SBScene* scene = SmartBody::SBScene::getScene(); SBGestureMap* gestureMap = scene->getGestureMapManager()->getGestureMap(sbcharacter->getName()); if (gestureMap) { std::string lexeme; std::string type; std::string hand; std::string style; std::string posture; gestureMap->getGestureByInfo(lexeme, type, hand, style, posture); Fl_Tree_Item* gestureItem = resourceTree->add(gestureFolder, lexeme.c_str()); gestureItem->user_data((void*)ITEM_GESTUREMAP); } */ // add NVBG Fl_Tree_Item* nvbgItem = resourceTree->add(item, "minibrain"); nvbgItem->user_data((void*) _reverseSpecialNames["minibrain"]); SmartBody::Nvbg* nvbg = character->getNvbg(); if (nvbg) { nvbgItem = resourceTree->add(item, nvbg->getName().c_str()); } }
// TODO: populate the curve list once we actually have a list of curves. void ModelerUserInterface::populateCurveList(Property* prop, Fl_Tree_Item* parent) { // Create a tree node for this property Fl_Tree_Item* item; if (parent == NULL) { // HACK: We have to add and remove a fake list item so that the tree // control will create a root node to put it under. curvesTree->remove(curvesTree->add("You shouldn't see this.")); item = curvesTree->root(); item->label(prop->getName()); } else { item = curvesTree->add(parent, prop->getName()); } item->labelfont(FL_HELVETICA_BOLD); if (GroupProperty* g = dynamic_cast<GroupProperty*>(prop)) { if (g->getCollapsed()) { item->close(); } } else if (dynamic_cast<RGBProperty*>(prop)) { item->close(); } // Examine the list of properties. PropertyList* controls = prop->getProperties(); for (PropertyList::iterator iter = controls->begin(); iter != controls->end(); iter++) { // For now, only RangeProperty is supported by the Curve interface. // The RGBProperty is also indirectly supported because it can provide // RangeProperties when its getProperties() method is called. // TODO: make this work with more property types (using a new // plotting widget?) if (RangeProperty* range = dynamic_cast<RangeProperty*>(*iter)) { // TODO: connect to Curve object instead of Property object. Fl_Tree_Item* childNode = curvesTree->add(item, range->getName()); curveProps.push_back(range); childNode->user_data((void*)(curveProps.size() - 1)); range->setCurveIndex(curveProps.size() - 1); graph->addCurve(range->getValue(), range->getMin(), range->getMax()); } else if ((*iter)->getProperties() != NULL) { // Try to get a list of GroupProperties out of it. populateCurveList(*iter, item); } } }
void ResourceWindow::hideTree() { // show only top-level items Fl_Tree_Item* root = resourceTree->first(); int numChildren = root->children(); for (int c = 0; c < numChildren; c++) { Fl_Tree_Item* item = root->child(c); item->close(); } }
void ResourceWindow::updateFaceDefinition( Fl_Tree_Item* tree, SmartBody::SBFaceDefinition* faceDefinition ) { std::string neutralMotionName = "NA"; if (faceDefinition->getFaceNeutral()) { neutralMotionName = faceDefinition->getFaceNeutral()->getName(); } Fl_Tree_Item* neutralMotionTree = resourceTree->add(tree,"Neutral Expression"); neutralMotionTree->close(); Fl_Tree_Item* item = resourceTree->add(neutralMotionTree,neutralMotionName.c_str()); // update action unit tree Fl_Tree_Item* auTree = resourceTree->add(tree,"Action Units (AUs)"); auTree->close(); int numAUs = faceDefinition->getNumAUs(); for (int a = 0; a < numAUs; a++) { int auNUm = faceDefinition->getAUNum(a); ActionUnit* au = faceDefinition->getAU(auNUm); std::string auName = "Au " + boost::lexical_cast<std::string>(faceDefinition->getAUNum(a)); Fl_Tree_Item* auItem = resourceTree->add(auTree,auName.c_str()); auItem->close(); std::string auType = "bilateral:"; if (au->is_bilateral()) { Fl_Tree_Item* item = NULL; if (au->left) item = resourceTree->add(auItem,(auType+ au->left->getName()).c_str()); else item = resourceTree->add(auItem, auType.c_str()); } else { if (au->is_left()) { auType = "left:"; Fl_Tree_Item* item = NULL; if (au->left) { item = resourceTree->add(auItem,(auType+au->left->getName()).c_str()); } else { item = resourceTree->add(auItem, auType.c_str()); } } if (au->is_right()) { auType = "right:"; if (au->right) { item = resourceTree->add(auItem,(auType+au->right->getName()).c_str()); } else { item = resourceTree->add(auItem, auType.c_str()); } } } } // update viseme tree Fl_Tree_Item* visemeTree = resourceTree->add(tree,"Visemes"); visemeTree->close(); int numVisemes = faceDefinition->getNumVisemes(); for (int v = 0; v < numVisemes; v++) { std::string visemeName = faceDefinition->getVisemeName(v); std::string motionName = ""; if (faceDefinition->getVisemeMotion(visemeName)) motionName = faceDefinition->getVisemeMotion(visemeName)->getName(); Fl_Tree_Item* item = resourceTree->add(visemeTree,(visemeName+"-->"+motionName).c_str()); } }