Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Blocktavius.AppDQB2/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ internal async void DoPreview()
var vm = (this.DataContext as MainWindowVM)?.CurrentContent as ProjectVM;
if (EyeOfRubissDriver != null && vm != null)
{
var scriptedStage = await vm.TryRebuildStage();
var scriptedStage = await vm.TryRebuildStage(preview: true);
if (scriptedStage != null)
{
await EyeOfRubissDriver.WriteStageAsync(scriptedStage);
Expand Down
2 changes: 1 addition & 1 deletion src/Blocktavius.AppDQB2/PlanScriptDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public PlanScriptVM(ProjectVM project)
ScriptName = project.SelectedScript.GetScriptName() ?? "<Untitled Script>";
Title = $"Plan and Run -- {ScriptName}";

rebuildTask = project.TryRebuildStage();
rebuildTask = project.TryRebuildStage(preview: false);

if (project.BackupsEnabled(out var backupDir))
{
Expand Down
8 changes: 7 additions & 1 deletion src/Blocktavius.AppDQB2/ProjectVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,20 @@ private void ExpandChunks(IReadOnlySet<ChunkOffset> expansion)
return stage;
}

public async Task<IStage?> TryRebuildStage()
public async Task<IStage?> TryRebuildStage(bool preview)
{
var workingStage = await TryLoadMutableStage(expandChunks: true);
if (workingStage == null)
{
return null;
}

if (this.SelectedScript == Scripts.FirstOrDefault()) // NOMERGE!!
{
TERRAGEN.DropTheHammer(workingStage, preview);
return workingStage;
}

var context = new StageRebuildContext(workingStage);
var mutation = this.SelectedScript?.BuildMutation(context);
if (mutation != null)
Expand Down
Loading