Esempio n. 1
0
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;
}
Esempio n. 2
0
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 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;
}
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;
}