Пример #1
0
        private void DoBulkImport()
        {
            string        ext   = BitDepth == GBitDepth.Bit8 ? "raw" : "r16";
            List <string> files = new List <string>(Directory.GetFiles(DataDirectory));

            files.RemoveAll(f => !f.EndsWith(ext));

            GCommon.ForEachTerrain(
                BulkImportGroupId,
                (t) =>
            {
                if (t == null || t.TerrainData == null)
                {
                    return;
                }

                string file = files.Find(
                    s =>
                {
                    string f = Path.GetFileNameWithoutExtension(s);
                    return(f.StartsWith(BitDepth == GBitDepth.Bit8 ? "RAW8" : "RAW16") && f.EndsWith(t.TerrainData.Id));
                });
                if (string.IsNullOrEmpty(file))
                {
                    return;
                }

                GBackup.TryCreateInitialBackup(HISTORY_PREFIX, t, GCommon.HeightMapAndFoliageResourceFlags);

                GRawImporter importer     = new GRawImporter();
                importer.Terrain          = t;
                importer.DesData          = t.TerrainData;
                importer.BitDepth         = BitDepth;
                importer.UseRawResolution = UseRawResolution;
                importer.FilePath         = file;
                importer.Import();

                GBackup.TryCreateBackup(HISTORY_PREFIX, t, GCommon.HeightMapAndFoliageResourceFlags);
            });
            GStylizedTerrain.MatchEdges(BulkImportGroupId);
        }
Пример #2
0
        private void DoImport()
        {
            if (Terrain != null)
            {
                GBackup.TryCreateInitialBackup(HISTORY_PREFIX, Terrain, GCommon.HeightMapAndFoliageResourceFlags);
            }

            GRawImporter importer = new GRawImporter();

            importer.Terrain          = Terrain;
            importer.DesData          = DesData;
            importer.BitDepth         = BitDepth;
            importer.UseRawResolution = UseRawResolution;
            importer.FilePath         = FilePath;
            importer.Import();

            if (Terrain != null)
            {
                GBackup.TryCreateBackup(HISTORY_PREFIX, Terrain, GCommon.HeightMapAndFoliageResourceFlags);
            }
        }