//private void ExportStandartMaterial(Material mat, XmlWriter xmlStream) //{ // var _MainTex = mat.GetTexture("_MainTex"); // var _BumpMap = mat.GetTexture("_BumpMap"); // var _DetailNormalMap = mat.GetTexture("_DetailNormalMap"); // var _ParallaxMap = mat.GetTexture("_ParallaxMap"); // var _OcclusionMap = mat.GetTexture("_OcclusionMap"); // var _EmissionMap = mat.GetTexture("_EmissionMap"); // var _DetailMask = mat.GetTexture("_DetailMask"); // var _DetailAlbedoMap = mat.GetTexture("_DetailAlbedoMap"); // var _MetallicGlossMap = mat.GetTexture("_MetallicGlossMap"); // WriteTechnique(xmlStream, "\t", "Techniques/Diff.xml"); // if (_MainTex != null) // { // string t; // if (_assets.TryGetTexturePath(_MainTex, out t)) // { // WriteTexture(xmlStream, "\t", "diffuse", t); // } // } //} public void ExportAsset(AssetContext asset) { var material = AssetDatabase.LoadAssetAtPath <Material>(asset.AssetPath); _assets.AddMaterialPath(material, asset.UrhoAssetName); if (File.Exists(asset.UrhoFileName)) { return; } using (XmlTextWriter writer = CreateXmlFile(asset)) { writer.WriteStartDocument(); writer.WriteStartElement("material"); writer.WriteWhitespace(Environment.NewLine); if (material != null) { if (material.shader.name == "Standard") { ExportStandartMaterial(material, writer); } else { Debug.Log("Unknown shader " + material.shader.name); ExportStandartMaterial(material, writer); } } writer.WriteEndElement(); writer.WriteEndDocument(); } }
//private void ExportStandartMaterial(Material mat, XmlWriter xmlStream) //{ // var _MainTex = mat.GetTexture("_MainTex"); // var _BumpMap = mat.GetTexture("_BumpMap"); // var _DetailNormalMap = mat.GetTexture("_DetailNormalMap"); // var _ParallaxMap = mat.GetTexture("_ParallaxMap"); // var _OcclusionMap = mat.GetTexture("_OcclusionMap"); // var _EmissionMap = mat.GetTexture("_EmissionMap"); // var _DetailMask = mat.GetTexture("_DetailMask"); // var _DetailAlbedoMap = mat.GetTexture("_DetailAlbedoMap"); // var _MetallicGlossMap = mat.GetTexture("_MetallicGlossMap"); // WriteTechnique(xmlStream, "\t", "Techniques/Diff.xml"); // if (_MainTex != null) // { // string t; // if (_assets.TryGetTexturePath(_MainTex, out t)) // { // WriteTexture(xmlStream, "\t", "diffuse", t); // } // } //} public void ExportAsset(AssetContext asset) { var material = AssetDatabase.LoadAssetAtPath <Material>(asset.AssetPath); _assets.AddMaterialPath(material, asset.UrhoAssetName); ExportMaterial(asset, material); }