BOOL LLDriverParamInfo::parseXml(LLXmlTreeNode* node) { llassert( node->hasName( "param" ) && node->getChildByName( "param_driver" ) ); if( !LLViewerVisualParamInfo::parseXml( node )) return FALSE; LLXmlTreeNode* param_driver_node = node->getChildByName( "param_driver" ); if( !param_driver_node ) return FALSE; for (LLXmlTreeNode* child = param_driver_node->getChildByName( "driven" ); child; child = param_driver_node->getNextNamedChild()) { S32 driven_id; static LLStdStringHandle id_string = LLXmlTree::addAttributeString("id"); if( child->getFastAttributeS32( id_string, driven_id ) ) { F32 min1 = mMinWeight; F32 max1 = mMaxWeight; F32 max2 = max1; F32 min2 = max1; // driven ________ // // ^ /| |\ // // | / | | \ // // | / | | \ // // | / | | \ // // | / | | \ // //-------|----|-------|----|-------> driver // // | min1 max1 max2 min2 static LLStdStringHandle min1_string = LLXmlTree::addAttributeString("min1"); child->getFastAttributeF32( min1_string, min1 ); // optional static LLStdStringHandle max1_string = LLXmlTree::addAttributeString("max1"); child->getFastAttributeF32( max1_string, max1 ); // optional static LLStdStringHandle max2_string = LLXmlTree::addAttributeString("max2"); child->getFastAttributeF32( max2_string, max2 ); // optional static LLStdStringHandle min2_string = LLXmlTree::addAttributeString("min2"); child->getFastAttributeF32( min2_string, min2 ); // optional // Push these on the front of the deque, so that we can construct // them in order later (faster) mDrivenInfoList.push_front( LLDrivenEntryInfo( driven_id, min1, max1, max2, min2 ) ); } else { LL_ERRS() << "<driven> Unable to resolve driven parameter: " << driven_id << LL_ENDL; return FALSE; } } return TRUE; }
bool LLViewerFolderDictionary::initEnsemblesFromFile() { std::string xml_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"foldertypes.xml"); LLXmlTree folder_def; if (!folder_def.parseFile(xml_filename)) { llerrs << "Failed to parse folders file " << xml_filename << llendl; return false; } LLXmlTreeNode* rootp = folder_def.getRoot(); for (LLXmlTreeNode* ensemble = rootp->getFirstChild(); ensemble; ensemble = rootp->getNextChild()) { if (!ensemble->hasName("ensemble")) { llwarns << "Invalid ensemble definition node " << ensemble->getName() << llendl; continue; } S32 ensemble_type; static LLStdStringHandle ensemble_num_string = LLXmlTree::addAttributeString("foldertype_num"); if (!ensemble->getFastAttributeS32(ensemble_num_string, ensemble_type)) { llwarns << "No ensemble type defined" << llendl; continue; } if (ensemble_type < S32(LLFolderType::FT_ENSEMBLE_START) || ensemble_type > S32(LLFolderType::FT_ENSEMBLE_END)) { llwarns << "Exceeded maximum ensemble index" << LLFolderType::FT_ENSEMBLE_END << llendl; break; } std::string xui_name; static LLStdStringHandle xui_name_string = LLXmlTree::addAttributeString("xui_name"); if (!ensemble->getFastAttributeString(xui_name_string, xui_name)) { llwarns << "No xui name defined" << llendl; continue; } std::string icon_name; static LLStdStringHandle icon_name_string = LLXmlTree::addAttributeString("icon_name"); if (!ensemble->getFastAttributeString(icon_name_string, icon_name)) { llwarns << "No ensemble icon name defined" << llendl; continue; } std::string allowed_names; static LLStdStringHandle allowed_names_string = LLXmlTree::addAttributeString("allowed"); if (!ensemble->getFastAttributeString(allowed_names_string, allowed_names)) { } // Add the entry and increment the asset number. const static std::string new_ensemble_name = "New Ensemble"; addEntry(LLFolderType::EType(ensemble_type), new ViewerFolderEntry(xui_name, new_ensemble_name, icon_name, allowed_names)); } return true; }
//----------------------------------------------------------------------------- // loadNodeArchetype(): loads <archetype> node from XML tree //----------------------------------------------------------------------------- BOOL LLGenePool::loadNodeArchetype( LLXmlTreeNode* node ) { llassert( node->hasName( "archetype" ) ); LLAppearance* archetype = new LLAppearance(); BOOL success = TRUE; LLVOAvatar* avatar = gAgent.getAvatarObject(); if( !avatar ) { delete archetype; return FALSE; } LLXmlTreeNode* child; for (child = node->getChildByName( "param" ); child; child = node->getNextNamedChild()) { F32 value; static LLStdStringHandle value_string = LLXmlTree::addAttributeString("value"); if( !child->getFastAttributeF32( value_string, value ) ) { llwarns << "avatar genepool file: <param> missing value attribute" << llendl; success = FALSE; break; } S32 id; static LLStdStringHandle id_string = LLXmlTree::addAttributeString("id"); if( !child->getFastAttributeS32( id_string, id ) ) { llwarns << "avatar genepool file: <param> missing id attribute" << llendl; success = FALSE; break; } LLVisualParam* param = avatar->getVisualParam( id ); if( param ) { archetype->addParam( id, value ); } else { llwarns << "avatar genepool file: ignoring invalid <param> with id: " << id << llendl; } } for (child = node->getChildByName( "texture" ); child; child = node->getNextNamedChild()) { LLUUID uuid; static LLStdStringHandle uuid_string = LLXmlTree::addAttributeString("uuid"); if( !child->getFastAttributeUUID( uuid_string, uuid ) ) { llwarns << "avatar genepool file: <texture> missing uuid attribute" << llendl; success = FALSE; break; } S32 te; static LLStdStringHandle te_string = LLXmlTree::addAttributeString("te"); if( !child->getFastAttributeS32( te_string, te ) ) { llwarns << "avatar genepool file: <texture> missing te attribute" << llendl; success = FALSE; break; } archetype->addTexture( te, uuid ); } if( success ) { mArchetypes.put( archetype ); } else { delete archetype; } return success; }