Skip to content

Commit

Permalink
Add notification to the user
Browse files Browse the repository at this point in the history
  • Loading branch information
saintentropy committed Jun 11, 2024
1 parent b43d17b commit 2439438
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -4004,4 +4004,13 @@ To make this file into a new template, save it to a different folder, then move
<data name="NodeInCanvasSearchCreationError" xml:space="preserve">
<value>Failed to create node: </value>
</data>
<data name="InstancingRenderFailureDescription" xml:space="preserve">
<value>Please disable Use Instancing in the Display Settings section of Visual Settings.</value>
</data>
<data name="InstancingRenderFailureSummary" xml:space="preserve">
<value>Dynamo has had an issue displaying some geometry to the background preview</value>
</data>
<data name="PartialRenderFailureTitle" xml:space="preserve">
<value>3D Preview had an issue</value>
</data>
</root>
9 changes: 9 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3991,4 +3991,13 @@ To make this file into a new template, save it to a different folder, then move
<data name="NodeInCanvasSearchCreationError" xml:space="preserve">
<value>Failed to create node: </value>
</data>
<data name="InstancingRenderFailureDescription" xml:space="preserve">
<value>Please disable Use Instancing in the Display Settings section of Visual Settings.</value>
</data>
<data name="InstancingRenderFailureSummary" xml:space="preserve">
<value>Dynamo has had an issue displaying some geometry to the background preview</value>
</data>
<data name="PartialRenderFailureTitle" xml:space="preserve">
<value>3D Preview had an issue</value>
</data>
</root>
37 changes: 37 additions & 0 deletions src/DynamoCoreWpf/ViewModels/Watch3D/HelixWatch3DViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,20 @@ public override void GenerateViewGeometryFromRenderPackagesAndRequestUpdate(Rend
var description = Resources.RenderingMemoryOutageDescription;
(dynamoModel as DynamoModel).Report3DPreviewOutage(summary, description);
}
catch (InstancingRenderFailureException)
{
//Notify the user of an issue impacting the background preview but do not disable the background preview.
string title = Resources.PartialRenderFailureTitle;
string summary = Resources.InstancingRenderFailureSummary;
var description = Resources.InstancingRenderFailureDescription;

const string imageUri = "/DynamoCoreWpf;component/UI/Images/task_dialog_future_file.png";
var args = new TaskDialogEventArgs(
new Uri(imageUri, UriKind.Relative),
title, summary, description);

(dynamoModel as DynamoModel).OnRequestTaskDialog(null, args);
}
#if DEBUG
// Defer stopping the timer until after the rendering has occurred
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Loaded, new Action(() =>
Expand Down Expand Up @@ -2088,6 +2102,29 @@ internal virtual void AggregateRenderPackages(IEnumerable<HelixRenderPackage> pa
rp.Transform, rp.RequiresPerVertexColoration);
}
}

//Pass failure to the calling function try catch.
if (instancingRenderFailure)
{
throw new InstancingRenderFailureException();
}
}
}

internal class InstancingRenderFailureException : Exception
{
public InstancingRenderFailureException()
{
}

public InstancingRenderFailureException(string message)
: base(message)
{
}

public InstancingRenderFailureException(string message, Exception inner)
: base(message, inner)
{
}
}

Expand Down

0 comments on commit 2439438

Please sign in to comment.