public ResultSet CreateScenes()
        {
            var resultSetBuilder = new ResultSetBuilder();

            for (var i = 0; i < _mapList.Count; i++)
            {
                var document  = _mapList[i];
                var processor = new MapDocumentProcessor();

                RaiseStepEvent(document.FileName, i);

                var result = processor.Convert(document);
                var map    = result.RootNode;

                resultSetBuilder.AddProcessorProblems(result.Problems, document.FileName);

                if (map == null)
                {
                    continue;
                }

                SceneBuilder.OutputFromMap(map, MakeOutputPathForScene(document));
            }

            AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport | ImportAssetOptions.ForceUpdate);

            return(resultSetBuilder.ToResultSet());
        }
Example #2
0
        public ResultSet CreateShaderGraphs()
        {
            var resultSetBuilder = new ResultSetBuilder();

            AssetDatabase.StartAssetEditing();

            for (var i = 0; i < _materialList.Count; i++)
            {
                var document  = _materialList[i];
                var processor = new MaterialDocumentProcessor();

                RaiseStepEvent(document.FileName, i);

                var result   = processor.Convert(document);
                var material = result.RootNode;

                resultSetBuilder.AddProcessorProblems(result.Problems, document.FileName);

                if (material == null)
                {
                    continue;
                }

                var shaderGraph = ShaderGraphBuilder.FromMaterial(material);
                shaderGraph.ValidateGraph();

                var content    = JsonUtility.ToJson(shaderGraph);
                var outputPath = MakeOutputPathForShaderGraph(document);

                Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
                File.WriteAllText(outputPath, content, Encoding.UTF8);
            }

            AssetDatabase.StopAssetEditing();
            AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport | ImportAssetOptions.ForceUpdate);

            return(resultSetBuilder.ToResultSet());
        }