From 1dfe98ab29665f33c9a8b0ffdd3ace4041297db8 Mon Sep 17 00:00:00 2001 From: T1m0thys Date: Sat, 31 Aug 2024 14:24:34 +0200 Subject: [PATCH 1/2] Covering case of no Rhino GLTF materials - avoiding expensive catch --- GltfExport.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/GltfExport.cs b/GltfExport.cs index b748bb9..ea1a19f 100644 --- a/GltfExport.cs +++ b/GltfExport.cs @@ -93,9 +93,25 @@ protected override void SolveInstance(IGH_DataAccess DA) // material assignment and baking int path = 0; + var matLst = material.Branches[RepeatLast(material.Branches.Count, path)]; // get mat branch list (repeating last if less) + if (matLst == null || matLst.Count == 0) + { + res = "Please assign GLTF materials in Rhino before running this component."; + AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, res); + return; + } + + if (!matLst.Any(item => item != null)) + { + res = "No valid GLTF materials found in Rhino."; + AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, res); + return; + } + + // Proceed with processing + foreach (var branch in geo!.Branches) { - var matLst = material.Branches[RepeatLast(material.Branches.Count, path)]; // get mat branch list (repeating last if less) int index = 0; RenderMaterial? materialRH = null; foreach (var g in branch) From 95abc70fc477a6c754e1440e7c26e17fbd2a3554 Mon Sep 17 00:00:00 2001 From: T1m0thys Date: Sat, 31 Aug 2024 14:37:16 +0200 Subject: [PATCH 2/2] Enabling Unix Support via runtimeconfig, as per: https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/6.0/system-drawing-common-windows-only#recommended-action - needs validation --- runtimeconfig.template.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 runtimeconfig.template.json diff --git a/runtimeconfig.template.json b/runtimeconfig.template.json new file mode 100644 index 0000000..40b04a7 --- /dev/null +++ b/runtimeconfig.template.json @@ -0,0 +1,5 @@ +{ + "configProperties": { + "System.Drawing.EnableUnixSupport": true + } +} \ No newline at end of file