예제 #1
0
        public static void Bake(BakerProfile profile, ProceduralMaterial proceduralMaterial, SubstanceImporter substanceImporter)
        {
            isBaking = true;
            var exportTo = UnityPath(Path.Combine(profile.materialFolder, proceduralMaterial.name)) + "/";

            Debug.Log("Baking : " + proceduralMaterial.name);
            if (!pendingTextures.ContainsKey((proceduralMaterial.name)))
            {
                pendingTextures.Add(proceduralMaterial.name, proceduralMaterial.GetGeneratedTextures().Select(x => x.name).ToList <string>());
                bakingMaterials.Add(proceduralMaterial.name, proceduralMaterial);
                // foreach (var name in proceduralMaterial.GetGeneratedTextures().Select(x => x.name))
                // {
                //     Debug.Log("Name added to pendingTextures    " + name);
                // }
            }

            Debug.Log("Exporting");
            substanceImporter.ExportBitmaps(proceduralMaterial, exportTo, profile.remapAlpha);

            Debug.Log("Exported");
            AssetDatabase.Refresh();
        }