private void Editor_CreateHistory(GTexturePainterArgs args) { if (!Editor_EnableHistory) { return; } if (EditedTerrains.Count == 0) { return; } List <GTerrainResourceFlag> flags = new List <GTerrainResourceFlag>(); flags.AddRange(ActivePainter.GetResourceFlagForHistory(args)); List <GStylizedTerrain> terrainList = new List <GStylizedTerrain>(EditedTerrains); string backupName = GBackup.TryCreateBackup(ActivePainter.HistoryPrefix, terrainList[0], flags, false); if (!string.IsNullOrEmpty(backupName)) { for (int i = 1; i < terrainList.Count; ++i) { GBackup.BackupTerrain(terrainList[i], backupName, flags); } } }
private void Editor_CreateInitialHistoryEntry(GTexturePainterArgs args, List <GStylizedTerrain> overlappedTerrains) { if (!Editor_EnableHistory) { return; } if (overlappedTerrains.Count == 0) { return; } List <GTerrainResourceFlag> flags = new List <GTerrainResourceFlag>(); flags.AddRange(ActivePainter.GetResourceFlagForHistory(args)); if (InitialRecordedTerrains.Count == 0) { currentInitialBackupName = GBackup.TryCreateInitialBackup(ActivePainter.HistoryPrefix, overlappedTerrains[0], flags, false); if (!string.IsNullOrEmpty(currentInitialBackupName)) { InitialRecordedTerrains.Add(overlappedTerrains[0]); } } else { if (!string.IsNullOrEmpty(currentInitialBackupName)) { for (int i = 0; i < overlappedTerrains.Count; ++i) { if (InitialRecordedTerrains.Contains(overlappedTerrains[i])) { continue; } GBackup.BackupTerrain(overlappedTerrains[i], currentInitialBackupName, flags); InitialRecordedTerrains.Add(overlappedTerrains[i]); } } } }