Ejemplo n.º 1
0
        public YAMLNode ExportYAML(IExportContainer container)
        {
            YAMLMappingNode node = new YAMLMappingNode();

            node.AddSerializedVersion(GetSerializedVersion(container.ExportVersion));
            node.Add(PatchesName, Patches.ExportYAML(container));
            node.Add(DetailPrototypesName, DetailPrototypes.ExportYAML(container));
            node.Add(PatchCountName, PatchCount);
            node.Add(PatchSamplesName, PatchSamples);
            node.Add(RandomRotationsName, RandomRotations.ExportYAML(container));
            node.Add(WavingGrassTintName, WavingGrassTint.ExportYAML(container));
            node.Add(WavingGrassStrengthName, WavingGrassStrength);
            node.Add(WavingGrassAmountName, WavingGrassAmount);
            node.Add(WavingGrassSpeedName, WavingGrassSpeed);
            if (IsReadDetailBillboardShader(container.ExportVersion))
            {
                node.Add(DetailBillboardShaderName, ExportDetailBillboardShader(container));
                node.Add(DetailMeshLitShaderName, ExportDetailMeshLitShader(container));
                node.Add(DetailMeshGrassShaderName, ExportDetailMeshGrassShader(container));
            }
            node.Add(TreeInstancesName, TreeInstances.ExportYAML(container));
            node.Add(TreePrototypesName, TreePrototypes.ExportYAML(container));
            node.Add(PreloadTextureAtlasDataName, PreloadTextureAtlasData.ExportYAML(container));
            return(node);
        }
Ejemplo n.º 2
0
        public YAMLNode ExportYAML(IExportContainer container)
        {
            YAMLMappingNode node = new YAMLMappingNode();

            node.AddSerializedVersion(ToSerializedVersion(container.ExportVersion));
            node.Add(PatchesName, Patches.ExportYAML(container));
            node.Add(DetailPrototypesName, DetailPrototypes.ExportYAML(container));
            node.Add(PatchCountName, PatchCount);
            node.Add(PatchSamplesName, PatchSamples);
            node.Add(RandomRotationsName, RandomRotations.ExportYAML(container));
            if (HasAtlasTexture(container.ExportVersion))
            {
                node.Add(AtlasTextureName, AtlasTexture.ExportYAML(container));
            }

            node.Add(WavingGrassTintName, WavingGrassTint.ExportYAML(container));
            node.Add(WavingGrassStrengthName, WavingGrassStrength);
            node.Add(WavingGrassAmountName, WavingGrassAmount);
            node.Add(WavingGrassSpeedName, WavingGrassSpeed);
            if (HasDetailBillboardShader(container.ExportVersion))
            {
                node.Add(DetailBillboardShaderName, DetailBillboardShader.ExportYAML(container));
                node.Add(DetailMeshLitShaderName, DetailMeshLitShader.ExportYAML(container));
                node.Add(DetailMeshGrassShaderName, DetailMeshGrassShader.ExportYAML(container));
            }
            TreeDatabase.ExportYAML(container, node);
            if (!HasAtlasTexture(container.ExportVersion))
            {
                node.Add(PreloadTextureAtlasDataName, PreloadTextureAtlasData.ExportYAML(container));
            }
            return(node);
        }
Ejemplo n.º 3
0
        public void Write(AssetWriter writer)
        {
            Patches.Write(writer);
            DetailPrototypes.Write(writer);
            writer.Write(PatchCount);
            writer.Write(PatchSamples);
            RandomRotations.Write(writer);
            if (HasAtlasTexture(writer.Version))
            {
                AtlasTexture.Write(writer);
            }

            WavingGrassTint.Write(writer);
            writer.Write(WavingGrassStrength);
            writer.Write(WavingGrassAmount);
            writer.Write(WavingGrassSpeed);
            if (HasDetailBillboardShader(writer.Version))
            {
                DetailBillboardShader.Write(writer);
                DetailMeshLitShader.Write(writer);
                DetailMeshGrassShader.Write(writer);
            }

            TreeDatabase.Write(writer);
            if (!HasAtlasTexture(writer.Version))
            {
                PreloadTextureAtlasData.Write(writer);
            }
        }
        public void LoadSettings()
        {
            // Deserialize
            string filePath = UPath.GetAbsolutePath(ImportCfgPath);

            if (File.Exists(filePath))
            {
                try {
                    TextReader    textReader = new StreamReader(filePath);
                    XmlSerializer serializer = new XmlSerializer(typeof(ImporterConfiguration));
                    ImportCfg = serializer.Deserialize(textReader) as ImporterConfiguration;
                    textReader.Close();
                }
                catch (Exception e) {
                    Debug.LogWarning("Import configuration could not be loaded, loading defaults.\n" + e.Message);
                    ImportCfg = new ImporterConfiguration();
                }
            }
            else
            {
                Debug.LogWarning("No configuration found, loading defaults");
                ImportCfg = new ImporterConfiguration();
            }

            // Parse splatPrototypeSettings to actual splatPrototype objects
            SplatPrototypes.Clear();
            foreach (SplatPrototypeConfiguration settings in ImportCfg.SplatPrototypes)
            {
                var prototype = SplatPrototypeConfiguration.Deserialize(settings);
                SplatPrototypes.Add(prototype);
            }

            DetailPrototypes.Clear();
            foreach (DetailPrototypeConfiguration settings in ImportCfg.DetailPrototypes)
            {
                var prototype = DetailPrototypeConfiguration.Deserialize(settings);
                DetailPrototypes.Add(prototype);
            }

            TreePrototypes.Clear();
            foreach (TreePrototypeConfiguration settings in ImportCfg.TreePrototypes)
            {
                var prototype = TreePrototypeConfiguration.Deserialize(settings);
                TreePrototypes.Add(prototype);
            }

            ImportCfg.IsDirty = false;
        }
Ejemplo n.º 5
0
        public YAMLNode ExportYAML(IExportContainer container)
        {
#warning TODO: values acording to read version (current 2017.3.0f3)
            YAMLMappingNode node = new YAMLMappingNode();
            node.AddSerializedVersion(GetSerializedVersion(container.Version));
            node.Add("m_Patches", Patches.ExportYAML(container));
            node.Add("m_DetailPrototypes", DetailPrototypes.ExportYAML(container));
            node.Add("m_PatchCount", PatchCount);
            node.Add("m_PatchSamples", PatchSamples);
            node.Add("m_RandomRotations", RandomRotations.ExportYAML(container));
            node.Add("WavingGrassTint", WavingGrassTint.ExportYAML(container));
            node.Add("m_WavingGrassStrength", WavingGrassStrength);
            node.Add("m_WavingGrassAmount", WavingGrassAmount);
            node.Add("m_WavingGrassSpeed", WavingGrassSpeed);
            node.Add("m_TreeInstances", TreeInstances.ExportYAML(container));
            node.Add("m_TreePrototypes", TreePrototypes.ExportYAML(container));
            node.Add("m_PreloadTextureAtlasData", PreloadTextureAtlasData.ExportYAML(container));
            return(node);
        }