diff --git a/Common_glTF_Exporter/Export/Draco.cs b/Common_glTF_Exporter/Export/Draco.cs index eb82f24..acebdd9 100644 --- a/Common_glTF_Exporter/Export/Draco.cs +++ b/Common_glTF_Exporter/Export/Draco.cs @@ -32,11 +32,11 @@ public static void Compress(Preferences preferences) files.Add(fileToCompress); } - #if REVIT2025 || REVIT2026 +#if REVIT2025 || REVIT2026 var loadContext = new NonCollectibleAssemblyLoadContext(); - string programDataPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData); + string programDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string assemblyPath = Path.Combine(programDataPath, "Autodesk", "ApplicationPlugins", "leia.bundle", "Contents", "2025", "DracoWrapper.dll"); Assembly mixedModeAssembly = loadContext.LoadFromAssemblyPath(assemblyPath); diff --git a/Common_glTF_Exporter/Export/MeshOpt.cs b/Common_glTF_Exporter/Export/MeshOpt.cs index 2dc2ed4..46e4a53 100644 --- a/Common_glTF_Exporter/Export/MeshOpt.cs +++ b/Common_glTF_Exporter/Export/MeshOpt.cs @@ -31,11 +31,11 @@ public static void Compress(Preferences preferences) files.Add(fileToCompress); } - #if REVIT2025 || REVIT2026 +#if REVIT2025 || REVIT2026 var loadContext = new NonCollectibleAssemblyLoadContext(); - string programDataPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData); + string programDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string meshOptPath = Path.Combine(programDataPath, "Autodesk", "ApplicationPlugins", "leia.bundle", "Contents", "2025", "MeshOpt.dll"); Assembly mixedModeAssembly = loadContext.LoadFromAssemblyPath(meshOptPath); MethodInfo defaultSettings = mixedModeAssembly.GetType("Gltf.GltfSettings").GetMethod("defaults"); diff --git a/Common_glTF_Exporter/Utils/RevitIniReader.cs b/Common_glTF_Exporter/Utils/RevitIniReader.cs index 44e2901..2859c48 100644 --- a/Common_glTF_Exporter/Utils/RevitIniReader.cs +++ b/Common_glTF_Exporter/Utils/RevitIniReader.cs @@ -39,17 +39,26 @@ public static List GetAdditionalRenderAppearancePaths() foreach (var p in paths) { - string trimmedPath = p.Trim(); + string cleanedPath = p.Trim().Trim('"'); - // If already rooted, normalize it - if (Path.IsPathRooted(trimmedPath)) - { - absolutePaths.Add(Path.GetFullPath(trimmedPath)); - } - else + // Replace | with ; or split further if needed + cleanedPath = cleanedPath.Replace('|', ';'); + + foreach (var subPath in cleanedPath.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)) { - // Combine with user profile to resolve relative path - string fullPath = Path.GetFullPath(Path.Combine(userProfile, trimmedPath)); + string trimmedPath = subPath.Trim().Trim('"'); + + if (Path.GetInvalidPathChars().Any(c => trimmedPath.Contains(c))) + { + // Skip or log invalid path + Console.WriteLine($"Skipping invalid path: {trimmedPath}"); + continue; + } + + string fullPath = Path.IsPathRooted(trimmedPath) + ? Path.GetFullPath(trimmedPath) + : Path.GetFullPath(Path.Combine(userProfile, trimmedPath)); + absolutePaths.Add(fullPath); } } diff --git a/Common_glTF_Exporter/Utils/glTFExportUtils.cs b/Common_glTF_Exporter/Utils/glTFExportUtils.cs index 2eb5154..476bcf8 100644 --- a/Common_glTF_Exporter/Utils/glTFExportUtils.cs +++ b/Common_glTF_Exporter/Utils/glTFExportUtils.cs @@ -205,9 +205,12 @@ public static void AddNormals(Transform transform, PolymeshTopology polymesh, Li { var newNormal = transform.OfVector(normal).Normalize(); - normals.Add(newNormal.X); - normals.Add(newNormal.Y); - normals.Add(newNormal.Z); + for (int j = 0; j < 3; j++) + { + normals.Add(newNormal.X); + normals.Add(newNormal.Y); + normals.Add(newNormal.Z); + } } break; diff --git a/Common_glTF_Exporter/Windows/ErrorWindow.xaml b/Common_glTF_Exporter/Windows/ErrorWindow.xaml index 2b3a542..ca8df49 100644 --- a/Common_glTF_Exporter/Windows/ErrorWindow.xaml +++ b/Common_glTF_Exporter/Windows/ErrorWindow.xaml @@ -63,7 +63,9 @@ + VerticalAlignment="Bottom" + HorizontalAlignment="Center" + Margin="0,0,0,15">