public static AvatarXmlInfo ParseXml(XmlNode root) { if (root.NodeType != XmlNodeType.Element) { throw new Exception("Invalid root node."); } XmlElement rootElement = (XmlElement)root; AvatarXmlInfo avatarXmlInfo = new AvatarXmlInfo(); avatarXmlInfo.ParseXmlSkeletonNode(rootElement); avatarXmlInfo.ParseXmlMeshNodes(rootElement); //avatarXmlInfo.ParseXmlColorNodes(rootElement); //avatarXmlInfo.ParseXmlLayerNodes(rootElement); //avatarXmlInfo.ParseXmlDriverNodes(rootElement); //avatarXmlInfo.ParseXmlMorphNodes(rootElement); return(avatarXmlInfo); }
public static void InitClass(string avatarFilename, string skeletonFilename) { if (string.IsNullOrEmpty(avatarFilename)) { avatarFilename = $"{AVATAR_DEFAULT_CHAR}_lad.xml"; } avatarFilename = System.IO.Path.Combine(Application.streamingAssetsPath, "Character", avatarFilename); AvatarConfigurationXmlTree = OpenAvatarXmlFile(avatarFilename, "linden_avatar", new[] { "1.0", "2.0" }); // TODO: Extract the "wearable_definition_version" attribute of the root node and set it in the Wearable class if (string.IsNullOrEmpty(skeletonFilename)) { skeletonFilename = "avatar_skeleton.xml"; } skeletonFilename = System.IO.Path.Combine(Application.streamingAssetsPath, "Character", skeletonFilename); SkeletonXmlTree = OpenAvatarXmlFile(skeletonFilename, "linden_skeleton", new[] { "1.0", "2.0" }); try { AvatarSkeletonInfo = null; AvatarSkeletonInfo = AvatarSkeletonInfo.ParseXml(SkeletonXmlTree.GetFirstChild()); } catch (Exception e) { Logger.LogError("AvatarAppearance.InitClass", $"Error parsing skeleton file: {skeletonFilename} ({e})"); } try { AvatarXmlInfo = null; AvatarXmlInfo = AvatarXmlInfo.ParseXml(AvatarConfigurationXmlTree.GetFirstChild()); } catch (Exception e) { Logger.LogError("AvatarAppearance.InitClass", $"Error parsing avatar file: {avatarFilename} ({e})"); } }