From 2439438302be27505aeba78becc732291c2e9fba Mon Sep 17 00:00:00 2001 From: Craig Long Date: Tue, 11 Jun 2024 16:52:25 -0400 Subject: [PATCH] Add notification to the user --- .../Properties/Resources.Designer.cs | 27 ++++++++++++++ .../Properties/Resources.en-US.resx | 9 +++++ src/DynamoCoreWpf/Properties/Resources.resx | 9 +++++ .../Watch3D/HelixWatch3DViewModel.cs | 37 +++++++++++++++++++ 4 files changed, 82 insertions(+) diff --git a/src/DynamoCoreWpf/Properties/Resources.Designer.cs b/src/DynamoCoreWpf/Properties/Resources.Designer.cs index bc4b0d2cbf3..d7ce15c2a09 100644 --- a/src/DynamoCoreWpf/Properties/Resources.Designer.cs +++ b/src/DynamoCoreWpf/Properties/Resources.Designer.cs @@ -4073,6 +4073,24 @@ public static string InstallMessageCaption { } } + /// + /// Looks up a localized string similar to Please disable Use Instancing in the Display Settings section of Visual Settings.. + /// + public static string InstancingRenderFailureDescription { + get { + return ResourceManager.GetString("InstancingRenderFailureDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Dynamo has had an issue displaying some geometry to the background preview. + /// + public static string InstancingRenderFailureSummary { + get { + return ResourceManager.GetString("InstancingRenderFailureSummary", resourceCulture); + } + } + /// /// Looks up a localized string similar to _Interactive Guides. /// @@ -7273,6 +7291,15 @@ public static string PackageWebsiteLabel { } } + /// + /// Looks up a localized string similar to 3D Preview had an issue. + /// + public static string PartialRenderFailureTitle { + get { + return ResourceManager.GetString("PartialRenderFailureTitle", resourceCulture); + } + } + /// /// Looks up a localized string similar to Periodic. /// diff --git a/src/DynamoCoreWpf/Properties/Resources.en-US.resx b/src/DynamoCoreWpf/Properties/Resources.en-US.resx index e1a3efd6f54..1843e8a85f9 100644 --- a/src/DynamoCoreWpf/Properties/Resources.en-US.resx +++ b/src/DynamoCoreWpf/Properties/Resources.en-US.resx @@ -4004,4 +4004,13 @@ To make this file into a new template, save it to a different folder, then move Failed to create node: + + Please disable Use Instancing in the Display Settings section of Visual Settings. + + + Dynamo has had an issue displaying some geometry to the background preview + + + 3D Preview had an issue + \ No newline at end of file diff --git a/src/DynamoCoreWpf/Properties/Resources.resx b/src/DynamoCoreWpf/Properties/Resources.resx index 6ad258d82b7..84bdc6ee321 100644 --- a/src/DynamoCoreWpf/Properties/Resources.resx +++ b/src/DynamoCoreWpf/Properties/Resources.resx @@ -3991,4 +3991,13 @@ To make this file into a new template, save it to a different folder, then move Failed to create node: + + Please disable Use Instancing in the Display Settings section of Visual Settings. + + + Dynamo has had an issue displaying some geometry to the background preview + + + 3D Preview had an issue + \ No newline at end of file diff --git a/src/DynamoCoreWpf/ViewModels/Watch3D/HelixWatch3DViewModel.cs b/src/DynamoCoreWpf/ViewModels/Watch3D/HelixWatch3DViewModel.cs index 08b43daa618..6bb78197547 100644 --- a/src/DynamoCoreWpf/ViewModels/Watch3D/HelixWatch3DViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/Watch3D/HelixWatch3DViewModel.cs @@ -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(() => @@ -2088,6 +2102,29 @@ internal virtual void AggregateRenderPackages(IEnumerable 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) + { } }