public override void CreateDependencies(string assetPath) { XmlDocument doc = new XmlDocument(); doc.Load(assetPath); XmlNode root = doc.DocumentElement; // Add materials dependencies XmlNodeList materialsNode = root.SelectSingleNode("Materials").ChildNodes; for (int i = 0; i < materialsNode.Count; i++) { string materialPath = materialsNode[i].SelectSingleNode("Path").InnerText; string name = materialsNode[i].SelectSingleNode("Name").InnerText; string fullPath = Path.Combine(materialPath, name + ".mat"); AddDependency <Material>(fullPath); } // Add mesh dependency string meshPath = root.SelectSingleNode("Model").InnerText + ".fbx"; AddDependency <Mesh>(meshPath); string path = root.SelectSingleNode("Path").InnerText; string fileName = Path.GetFileNameWithoutExtension(assetPath); // Add it's own prefab dependency AddDependency <GameObject>(Path.Combine(path, fileName + ".prefab")); // Add prefabs dependencies SmallImporterUtils.RecursiveGetTransformDependecies(this, root); }
public override void CreateDependencies(string assetPath) { XmlDocument doc = new XmlDocument(); doc.Load(assetPath); XmlNode root = doc.DocumentElement; string path = root.SelectSingleNode("Path").InnerText; string fileName = Path.GetFileNameWithoutExtension(assetPath); // Add it's own prefab dependency AddDependency <GameObject>(Path.Combine(path, fileName + ".prefab")); // Add prefabs dependencies SmallImporterUtils.RecursiveGetTransformDependecies(this, root); }
public static void RecursiveGetTransformDependecies(AAssetImporter importer, XmlNode root) { XmlNode childrenNode = root.SelectSingleNode("Children"); if (childrenNode != null) { XmlNodeList childrenNodeList = childrenNode.ChildNodes; for (int i = 0; i < childrenNodeList.Count; i++) { string type = childrenNodeList[i].SelectSingleNode("Type").InnerText; if (type == "MESH" || type == "LIGHT" || type == "CAMERA") { string path = childrenNodeList[i].SelectSingleNode("Prefab").InnerText; importer.AddDependency <GameObject>(path); } SmallImporterUtils.RecursiveGetTransformDependecies(importer, childrenNodeList[i]); } } }
public override void CreateDependencies(string assetPath) { XmlDocument xml = new XmlDocument(); xml.Load(assetPath); XmlNode root = xml.DocumentElement; // Add textures dependencies XmlNode channels = root.SelectSingleNode("Channels"); if (channels != null) { foreach (XmlNode node in channels.ChildNodes) { if (node != null && SmallParserUtils.IsValidTextureXml(node.InnerText)) { AddDependency <Texture>(SmallImporterUtils.GetTexturePath(node.InnerText)); } } } }
public override void OnPreImport(string assetPath) { SmallImporterUtils.CreatePrefabFromXml(assetPath); }
public override void OnPreImport(string assetPath) { _material = SmallImporterUtils.CreateMaterialFromXml(assetPath); }