BOOL LLTexGlobalColorInfo::parseXml(LLXmlTreeNode* node) { // name attribute static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); if (!node->getFastAttributeString(name_string, mName)) { llwarns << "<global_color> element is missing name attribute." << llendl; return FALSE; } // <param> sub-element for (LLXmlTreeNode* child = node->getChildByName("param"); child; child = node->getNextNamedChild()) { if (child->getChildByName("param_color")) { // <param><param_color/></param> LLTexLayerParamColorInfo* info = new LLTexLayerParamColorInfo(); if (!info->parseXml(child)) { delete info; return FALSE; } mParamColorInfoList.push_back(info); } } return TRUE; }
void LLXmlTreeParser::startElement(const char* name, const char **atts) { if( mDump ) { llinfos << tabs() << "startElement " << name << llendl; S32 i = 0; while( atts[i] && atts[i+1] ) { llinfos << tabs() << "attribute: " << atts[i] << "=" << atts[i+1] << llendl; i += 2; } } LLXmlTreeNode* child = CreateXmlTreeNode( std::string(name), mCurrent ); S32 i = 0; while( atts[i] && atts[i+1] ) { child->addAttribute( atts[i], atts[i+1] ); i += 2; } if( mCurrent ) { mCurrent->addChild( child ); } else { llassert( !mRoot ); mRoot = child; } mCurrent = child; }
BOOL LLGenePool::load() { std::string filename; filename = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,"genepool.xml"); if( mLoaded ) { return TRUE; } LLXmlTree xml_tree; BOOL success = xml_tree.parseFile( filename, FALSE ); if( !success ) { return FALSE; } LLXmlTreeNode* root = xml_tree.getRoot(); if( !root ) { return FALSE; } //------------------------------------------------------------------------- // <linden_genepool version="1.0"> (root) //------------------------------------------------------------------------- if( !root->hasName( "linden_genepool" ) ) { llwarns << "Invalid linden_genepool file header: " << filename << llendl; return FALSE; } std::string version; static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version"); if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") ) { llwarns << "Invalid linden_genepool file version: " << version << llendl; return FALSE; } //------------------------------------------------------------------------- // <archetype> //------------------------------------------------------------------------- for (LLXmlTreeNode* child = root->getChildByName( "archetype" ); child; child = root->getNextNamedChild()) { if( !loadNodeArchetype( child ) ) { return FALSE; } } mLoaded = TRUE; return TRUE; }
static BOOL loadAttentions() { static BOOL first_time = TRUE; if( ! first_time) { return TRUE; // maybe not ideal but otherwise it can continue to fail forever. } first_time = FALSE; std::string filename; filename = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,"attentions.xml"); LLXmlTree xml_tree; BOOL success = xml_tree.parseFile( filename, FALSE ); if( !success ) { return FALSE; } LLXmlTreeNode* root = xml_tree.getRoot(); if( !root ) { return FALSE; } //------------------------------------------------------------------------- // <linden_attentions version="1.0"> (root) //------------------------------------------------------------------------- if( !root->hasName( "linden_attentions" ) ) { llwarns << "Invalid linden_attentions file header: " << filename << llendl; return FALSE; } std::string version; static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version"); if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") ) { llwarns << "Invalid linden_attentions file version: " << version << llendl; return FALSE; } //------------------------------------------------------------------------- // <gender> //------------------------------------------------------------------------- for (LLXmlTreeNode* child = root->getChildByName( "gender" ); child; child = root->getNextNamedChild()) { if( !loadGender( child ) ) { return FALSE; } } return TRUE; }
BOOL LLTexLayerParamColorInfo::parseXml(LLXmlTreeNode *node) { llassert(node->hasName("param") && node->getChildByName("param_color")); if (!LLViewerVisualParamInfo::parseXml(node)) return FALSE; LLXmlTreeNode* param_color_node = node->getChildByName("param_color"); if (!param_color_node) { return FALSE; } std::string op_string; static LLStdStringHandle operation_string = LLXmlTree::addAttributeString("operation"); if (param_color_node->getFastAttributeString(operation_string, op_string)) { LLStringUtil::toLower(op_string); if (op_string == "add") mOperation = LLTexLayerParamColor::OP_ADD; else if (op_string == "multiply") mOperation = LLTexLayerParamColor::OP_MULTIPLY; else if (op_string == "blend") mOperation = LLTexLayerParamColor::OP_BLEND; } mNumColors = 0; LLColor4U color4u; for (LLXmlTreeNode* child = param_color_node->getChildByName("value"); child; child = param_color_node->getNextNamedChild()) { if ((mNumColors < MAX_COLOR_VALUES)) { static LLStdStringHandle color_string = LLXmlTree::addAttributeString("color"); if (child->getFastAttributeColor4U(color_string, color4u)) { mColors[ mNumColors ].setVec(color4u); mNumColors++; } } } if (!mNumColors) { llwarns << "<param_color> is missing <value> sub-elements" << llendl; return FALSE; } if ((mOperation == LLTexLayerParamColor::OP_BLEND) && (mNumColors != 1)) { llwarns << "<param_color> with operation\"blend\" must have exactly one <value>" << llendl; return FALSE; } return TRUE; }
BOOL LLPolyMorphTargetInfo::parseXml(LLXmlTreeNode* node) { llassert( node->hasName( "param" ) && node->getChildByName( "param_morph" ) ); if (!LLViewerVisualParamInfo::parseXml(node)) return FALSE; // Get mixed-case name static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); if( !node->getFastAttributeString( name_string, mMorphName ) ) { LL_WARNS() << "Avatar file: <param> is missing name attribute" << LL_ENDL; return FALSE; // Continue, ignoring this tag } static LLStdStringHandle clothing_morph_string = LLXmlTree::addAttributeString("clothing_morph"); node->getFastAttributeBOOL(clothing_morph_string, mIsClothingMorph); LLXmlTreeNode *paramNode = node->getChildByName("param_morph"); if (NULL == paramNode) { LL_WARNS() << "Failed to getChildByName(\"param_morph\")" << LL_ENDL; return FALSE; } for (LLXmlTreeNode* child_node = paramNode->getFirstChild(); child_node; child_node = paramNode->getNextChild()) { static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); if (child_node->hasName("volume_morph")) { std::string volume_name; if (child_node->getFastAttributeString(name_string, volume_name)) { LLVector3 scale; static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale"); child_node->getFastAttributeVector3(scale_string, scale); LLVector3 pos; static LLStdStringHandle pos_string = LLXmlTree::addAttributeString("pos"); child_node->getFastAttributeVector3(pos_string, pos); mVolumeInfoList.push_back(LLPolyVolumeMorphInfo(volume_name,scale,pos)); } } } return TRUE; }
BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node) { llassert( node->hasName( "param" ) && node->getChildByName( "param_skeleton" ) ); if (!LLViewerVisualParamInfo::parseXml(node)) return FALSE; LLXmlTreeNode* skeletalParam = node->getChildByName("param_skeleton"); if (NULL == skeletalParam) { LL_WARNS() << "Failed to getChildByName(\"param_skeleton\")" << LL_ENDL; return FALSE; } for( LLXmlTreeNode* bone = skeletalParam->getFirstChild(); bone; bone = skeletalParam->getNextChild() ) { if (bone->hasName("bone")) { std::string name; LLVector3 scale; LLVector3 pos; BOOL haspos = FALSE; static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); if (!bone->getFastAttributeString(name_string, name)) { LL_WARNS() << "No bone name specified for skeletal param." << LL_ENDL; continue; } static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale"); if (!bone->getFastAttributeVector3(scale_string, scale)) { LL_WARNS() << "No scale specified for bone " << name << "." << LL_ENDL; continue; } // optional offset deformation (translation) static LLStdStringHandle offset_string = LLXmlTree::addAttributeString("offset"); if (bone->getFastAttributeVector3(offset_string, pos)) { haspos = TRUE; } mBoneInfoList.push_back(LLPolySkeletalBoneInfo(name, scale, pos, haspos)); } else { LL_WARNS() << "Unrecognized element " << bone->getName() << " in skeletal distortion" << LL_ENDL; continue; } } return TRUE; }
void exoFlickrUploadResponse::completedRaw( U32 status, const std::string& reason, const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer) { LLBufferStream istr(channels, buffer.get()); std::stringstream strstrm; strstrm << istr.rdbuf(); std::string result = std::string(strstrm.str()); LLSD output; bool success; LLXmlTree tree; if(!tree.parseString(result)) { LL_WARNS("FlickrAPI") << "Couldn't parse flickr response(" << status << "): " << result << LL_ENDL; mCallback(false, LLSD()); return; } LLXmlTreeNode* root = tree.getRoot(); if(!root->hasName("rsp")) { LL_WARNS("FlickrAPI") << "Bad root node: " << root->getName() << LL_ENDL; mCallback(false, LLSD()); return; } std::string stat; root->getAttributeString("stat", stat); output["stat"] = stat; if(stat == "ok") { success = true; LLXmlTreeNode* photoid_node = root->getChildByName("photoid"); if(photoid_node) { output["photoid"] = photoid_node->getContents(); } } else { success = false; LLXmlTreeNode* err_node = root->getChildByName("err"); if(err_node) { S32 code; std::string msg; err_node->getAttributeS32("code", code); err_node->getAttributeString("msg", msg); output["code"] = code; output["msg"] = msg; } } mCallback(success, output); }
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; }
std::string LLXmlTreeNode::getTextContents() { std::string msg; LLXmlTreeNode* p = getChildByName("p"); if (p) { // Case 1: node has <p>text</p> tags while (p) { msg += p->getContents() + "\n"; p = getNextNamedChild(); } } else { std::string::size_type n = mContents.find_first_not_of(" \t\n"); if (n != std::string::npos && mContents[n] == '\"') { // Case 2: node has quoted text S32 num_lines = 0; while(1) { // mContents[n] == '"' ++n; std::string::size_type t = n; std::string::size_type m = 0; // fix-up escaped characters while(1) { m = mContents.find_first_of("\\\"", t); // find first \ or " if ((m == std::string::npos) || (mContents[m] == '\"')) { break; } mContents.erase(m,1); t = m+1; } if (m == std::string::npos) { break; } // mContents[m] == '"' num_lines++; msg += mContents.substr(n,m-n) + "\n"; n = mContents.find_first_of("\"", m+1); if (n == std::string::npos) { if (num_lines == 1) { msg.erase(msg.size()-1); // remove "\n" if only one line } break; } } } else { // Case 3: node has embedded text (beginning and trailing whitespace trimmed) msg = mContents; } } return msg; }
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; }
// Returns number of controls loaded, so 0 if failure U32 LLControlGroup::loadFromFile(const LLString& filename, BOOL require_declaration, eControlType declare_as) { LLString name; LLXmlTree xml_controls; if (!xml_controls.parseFile(filename)) { llwarns << "Unable to open control file " << filename << llendl; return 0; } LLXmlTreeNode* rootp = xml_controls.getRoot(); if (!rootp || !rootp->hasAttribute("version")) { llwarns << "No valid settings header found in control file " << filename << llendl; return 0; } U32 item = 0; U32 validitems = 0; S32 version; rootp->getAttributeS32("version", version); // Check file version if (version != CURRENT_VERSION) { llinfos << filename << " does not appear to be a version " << CURRENT_VERSION << " controls file" << llendl; return 0; } LLXmlTreeNode* child_nodep = rootp->getFirstChild(); while(child_nodep) { name = child_nodep->getName(); BOOL declared = controlExists(name); if (require_declaration && !declared) { // Declaration required, but this name not declared. // Complain about non-empty names. if (!name.empty()) { //read in to end of line llwarns << "LLControlGroup::loadFromFile() : Trying to set \"" << name << "\", setting doesn't exist." << llendl; } child_nodep = rootp->getNextChild(); continue; } // Got an item. Load it up. item++; // If not declared, assume it's a string if (!declared) { switch(declare_as) { case TYPE_COL4: declareColor4(name, LLColor4::white, "", NO_PERSIST); break; case TYPE_COL4U: declareColor4U(name, LLColor4U::white, "", NO_PERSIST); break; case TYPE_STRING: default: declareString(name, LLString::null, "", NO_PERSIST); break; } } // Control name has been declared in code. LLControlBase *control = getControl(name); llassert(control); mLoadedSettings.insert(name); switch(control->mType) { case TYPE_F32: { F32 initial = 0.f; child_nodep->getAttributeF32("value", initial); control->set(initial); validitems++; } break; case TYPE_S32: { S32 initial = 0; child_nodep->getAttributeS32("value", initial); control->set(initial); validitems++; } break; case TYPE_U32: { U32 initial = 0; child_nodep->getAttributeU32("value", initial); control->set((LLSD::Integer) initial); validitems++; } break; case TYPE_BOOLEAN: { BOOL initial = FALSE; child_nodep->getAttributeBOOL("value", initial); control->set(initial); validitems++; } break; case TYPE_STRING: { LLString string; child_nodep->getAttributeString("value", string); if (string == LLString::null) { string = ""; } control->set(string); validitems++; } break; case TYPE_VEC3: { LLVector3 vector; child_nodep->getAttributeVector3("value", vector); control->set(vector.getValue()); validitems++; } break; case TYPE_VEC3D: { LLVector3d vector; child_nodep->getAttributeVector3d("value", vector); control->set(vector.getValue()); validitems++; } break; case TYPE_RECT: { //RN: hack to support reading rectangles from a string LLString rect_string; child_nodep->getAttributeString("value", rect_string); std::istringstream istream(rect_string); S32 left, bottom, width, height; istream >> left >> bottom >> width >> height; LLRect rect; rect.setOriginAndSize(left, bottom, width, height); control->set(rect.getValue()); validitems++; } break; case TYPE_COL4U: { LLColor4U color; child_nodep->getAttributeColor4U("value", color); control->set(color.getValue()); validitems++; } break; case TYPE_COL4: { LLColor4 color; child_nodep->getAttributeColor4("value", color); control->set(color.getValue()); validitems++; } break; case TYPE_COL3: { LLVector3 color; child_nodep->getAttributeVector3("value", color); control->set(LLColor3(color.mV).getValue()); validitems++; } break; } child_nodep = rootp->getNextChild(); } return validitems; }
// static void LLVOTree::initClass() { std::string xml_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"trees.xml"); LLXmlTree tree_def_tree; if (!tree_def_tree.parseFile(xml_filename)) { llerrs << "Failed to parse tree file." << llendl; } LLXmlTreeNode* rootp = tree_def_tree.getRoot(); for (LLXmlTreeNode* tree_def = rootp->getFirstChild(); tree_def; tree_def = rootp->getNextChild()) { if (!tree_def->hasName("tree")) { llwarns << "Invalid tree definition node " << tree_def->getName() << llendl; continue; } F32 F32_val; LLUUID id; S32 S32_val; BOOL success = TRUE; S32 species; static LLStdStringHandle species_id_string = LLXmlTree::addAttributeString("species_id"); if (!tree_def->getFastAttributeS32(species_id_string, species)) { llwarns << "No species id defined" << llendl; continue; } if (species < 0) { llwarns << "Invalid species id " << species << llendl; continue; } if (sSpeciesTable.count(species)) { llwarns << "Tree species " << species << " already defined! Duplicate discarded." << llendl; continue; } TreeSpeciesData* newTree = new TreeSpeciesData(); static LLStdStringHandle texture_id_string = LLXmlTree::addAttributeString("texture_id"); success &= tree_def->getFastAttributeUUID(texture_id_string, id); newTree->mTextureID = id; static LLStdStringHandle droop_string = LLXmlTree::addAttributeString("droop"); success &= tree_def->getFastAttributeF32(droop_string, F32_val); newTree->mDroop = F32_val; static LLStdStringHandle twist_string = LLXmlTree::addAttributeString("twist"); success &= tree_def->getFastAttributeF32(twist_string, F32_val); newTree->mTwist = F32_val; static LLStdStringHandle branches_string = LLXmlTree::addAttributeString("branches"); success &= tree_def->getFastAttributeF32(branches_string, F32_val); newTree->mBranches = F32_val; static LLStdStringHandle depth_string = LLXmlTree::addAttributeString("depth"); success &= tree_def->getFastAttributeS32(depth_string, S32_val); newTree->mDepth = S32_val; static LLStdStringHandle scale_step_string = LLXmlTree::addAttributeString("scale_step"); success &= tree_def->getFastAttributeF32(scale_step_string, F32_val); newTree->mScaleStep = F32_val; static LLStdStringHandle trunk_depth_string = LLXmlTree::addAttributeString("trunk_depth"); success &= tree_def->getFastAttributeS32(trunk_depth_string, S32_val); newTree->mTrunkDepth = S32_val; static LLStdStringHandle branch_length_string = LLXmlTree::addAttributeString("branch_length"); success &= tree_def->getFastAttributeF32(branch_length_string, F32_val); newTree->mBranchLength = F32_val; static LLStdStringHandle trunk_length_string = LLXmlTree::addAttributeString("trunk_length"); success &= tree_def->getFastAttributeF32(trunk_length_string, F32_val); newTree->mTrunkLength = F32_val; static LLStdStringHandle leaf_scale_string = LLXmlTree::addAttributeString("leaf_scale"); success &= tree_def->getFastAttributeF32(leaf_scale_string, F32_val); newTree->mLeafScale = F32_val; static LLStdStringHandle billboard_scale_string = LLXmlTree::addAttributeString("billboard_scale"); success &= tree_def->getFastAttributeF32(billboard_scale_string, F32_val); newTree->mBillboardScale = F32_val; static LLStdStringHandle billboard_ratio_string = LLXmlTree::addAttributeString("billboard_ratio"); success &= tree_def->getFastAttributeF32(billboard_ratio_string, F32_val); newTree->mBillboardRatio = F32_val; static LLStdStringHandle trunk_aspect_string = LLXmlTree::addAttributeString("trunk_aspect"); success &= tree_def->getFastAttributeF32(trunk_aspect_string, F32_val); newTree->mTrunkAspect = F32_val; static LLStdStringHandle branch_aspect_string = LLXmlTree::addAttributeString("branch_aspect"); success &= tree_def->getFastAttributeF32(branch_aspect_string, F32_val); newTree->mBranchAspect = F32_val; static LLStdStringHandle leaf_rotate_string = LLXmlTree::addAttributeString("leaf_rotate"); success &= tree_def->getFastAttributeF32(leaf_rotate_string, F32_val); newTree->mRandomLeafRotate = F32_val; static LLStdStringHandle noise_mag_string = LLXmlTree::addAttributeString("noise_mag"); success &= tree_def->getFastAttributeF32(noise_mag_string, F32_val); newTree->mNoiseMag = F32_val; static LLStdStringHandle noise_scale_string = LLXmlTree::addAttributeString("noise_scale"); success &= tree_def->getFastAttributeF32(noise_scale_string, F32_val); newTree->mNoiseScale = F32_val; static LLStdStringHandle taper_string = LLXmlTree::addAttributeString("taper"); success &= tree_def->getFastAttributeF32(taper_string, F32_val); newTree->mTaper = F32_val; static LLStdStringHandle repeat_z_string = LLXmlTree::addAttributeString("repeat_z"); success &= tree_def->getFastAttributeF32(repeat_z_string, F32_val); newTree->mRepeatTrunkZ = F32_val; sSpeciesTable[species] = newTree; if (species >= sMaxTreeSpecies) sMaxTreeSpecies = species + 1; if (!success) { std::string name; static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); tree_def->getFastAttributeString(name_string, name); llwarns << "Incomplete definition of tree " << name << llendl; } } BOOL have_all_trees = TRUE; std::string err; for (S32 i=0;i<sMaxTreeSpecies;++i) { if (!sSpeciesTable.count(i)) { err.append(llformat(" %d",i)); have_all_trees = FALSE; } } if (!have_all_trees) { LLSD args; args["SPECIES"] = err; LLNotifications::instance().add("ErrorUndefinedTrees", args); } };
//----------------------------------------------------------------------------- // 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; }