-
Notifications
You must be signed in to change notification settings - Fork 20
Flipped textures #116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flipped textures #116
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |||
| using System.Drawing; | ||||
| using System.Drawing.Imaging; | ||||
| using System.IO; | ||||
| using System.Linq; | ||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainVerify the necessity of the System.Linq using directive. The 🏁 Script executed: #!/bin/bash
# Description: Check if LINQ operations are used in BitmapsUtils.cs
# Expected: Find LINQ method calls or confirm the directive is unnecessary
# Search for common LINQ methods in the file
ast-grep --pattern 'Where($$$)' Common_glTF_Exporter/Materials/BitmapsUtils.cs
ast-grep --pattern 'Select($$$)' Common_glTF_Exporter/Materials/BitmapsUtils.cs
ast-grep --pattern 'Any($$$)' Common_glTF_Exporter/Materials/BitmapsUtils.cs
ast-grep --pattern 'First($$$)' Common_glTF_Exporter/Materials/BitmapsUtils.cs
rg -n '\.(Where|Select|Any|First|Last|Count|Sum|Min|Max|OrderBy|GroupBy)\(' Common_glTF_Exporter/Materials/BitmapsUtils.csLength of output: 627 Remove the unused System.Linq directive The - using System.Linq;📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||
| using System.Runtime.InteropServices; | ||||
| using System.Text; | ||||
|
|
||||
|
|
||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.IO; | ||
| using Common_glTF_Exporter.Utils; | ||
|
|
||
| namespace Common_glTF_Exporter.Materials | ||
| { | ||
| public static class TextureLocation | ||
| { | ||
| private const string AUTODESK_TEXTURES = @"Autodesk Shared\Materials\Textures\"; | ||
|
|
||
| public static List<string> GetPaths() | ||
| { | ||
| var paths = new List<string> | ||
| { | ||
| Path.Combine( | ||
| Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles), | ||
| AUTODESK_TEXTURES) | ||
| }; | ||
|
|
||
| var externalPaths = RevitIniReader.GetAdditionalRenderAppearancePaths(); | ||
| if (externalPaths?.Count > 0) | ||
| { | ||
| paths.AddRange(externalPaths); | ||
| } | ||
|
|
||
| return paths; | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
| using Revit_glTF_Exporter; | ||
| using System.IO; | ||
| using System.Linq; | ||
| using Autodesk.Revit.ApplicationServices; | ||
|
|
||
| namespace Common_glTF_Exporter.Utils | ||
| { | ||
| public static class RevitIniReader | ||
| { | ||
| public static List<string> GetAdditionalRenderAppearancePaths() | ||
| { | ||
| string revitVersion = ExternalApplication.RevitCollectorService.GetApplication().VersionNumber; | ||
| string appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); | ||
|
|
||
| string iniDir = Path.Combine( | ||
| appData, | ||
| "Autodesk", | ||
| "Revit", | ||
| $"Autodesk Revit {revitVersion}" | ||
| ); | ||
|
|
||
| string iniPath = Path.Combine(iniDir, "Revit.ini"); | ||
|
|
||
| if (!File.Exists(iniPath)) | ||
| return null; | ||
|
|
||
| foreach (var line in File.ReadAllLines(iniPath)) | ||
| { | ||
| if (line.StartsWith("AdditionalRenderAppearancePaths=")) | ||
| { | ||
| string pathString = line.Substring("AdditionalRenderAppearancePaths=".Length); | ||
| var paths = pathString.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); | ||
|
|
||
| var absolutePaths = new List<string>(); | ||
| string userProfile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); | ||
|
|
||
| foreach (var p in paths) | ||
| { | ||
| string trimmedPath = p.Trim(); | ||
|
|
||
| // If already rooted, normalize it | ||
| if (Path.IsPathRooted(trimmedPath)) | ||
| { | ||
| absolutePaths.Add(Path.GetFullPath(trimmedPath)); | ||
| } | ||
| else | ||
| { | ||
| // Combine with user profile to resolve relative path | ||
| string fullPath = Path.GetFullPath(Path.Combine(userProfile, trimmedPath)); | ||
| absolutePaths.Add(fullPath); | ||
| } | ||
| } | ||
|
|
||
| return absolutePaths; | ||
| } | ||
| } | ||
|
|
||
| return null; | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add defensive null check for MainWindow.TexturePaths.
Consider adding a null check for
MainWindow.TexturePathsto prevent potential NullReferenceException if the static property isn't properly initialized.🤖 Prompt for AI Agents