@@ -18,10 +18,12 @@ public static IEnumerable<string> GetObjDependencies(string objPath)
1818
1919 foreach ( var line in objFile )
2020 {
21- if ( ! line . StartsWith ( "mtllib" ) ) continue ;
21+ var trimmedLine = line . Trim ( ) ;
22+
23+ if ( ! trimmedLine . StartsWith ( "mtllib" ) ) continue ;
2224
23- var mtlPath = Path . Combine ( folderName , line [ 7 ..] . Trim ( ) ) ;
24- dependencies . Add ( line [ 7 ..] . Trim ( ) ) ;
25+ var mtlPath = Path . Combine ( folderName , trimmedLine [ 7 ..] . Trim ( ) ) ;
26+ dependencies . Add ( trimmedLine [ 7 ..] . Trim ( ) ) ;
2527
2628 dependencies . AddRange ( GetMtlDependencies ( mtlPath ) ) ;
2729 }
@@ -42,70 +44,70 @@ private static IList<string> GetMtlDependencies(string mtlPath)
4244
4345 if ( trimmedLine . StartsWith ( "map_Kd" ) )
4446 {
45- dependencies . Add ( line [ 7 ..] . Trim ( ) ) ;
47+ dependencies . Add ( trimmedLine [ 7 ..] . Trim ( ) ) ;
4648
4749 continue ;
4850 }
4951
5052 if ( trimmedLine . StartsWith ( "map_Ka" ) )
5153 {
52- dependencies . Add ( line [ 7 ..] . Trim ( ) ) ;
54+ dependencies . Add ( trimmedLine [ 7 ..] . Trim ( ) ) ;
5355
5456 continue ;
5557 }
5658
5759 if ( trimmedLine . StartsWith ( "norm" ) )
5860 {
59- dependencies . Add ( line [ 5 ..] . Trim ( ) ) ;
61+ dependencies . Add ( trimmedLine [ 5 ..] . Trim ( ) ) ;
6062
6163 continue ;
6264 }
6365
6466 if ( trimmedLine . StartsWith ( "map_Ks" ) )
6567 {
66- dependencies . Add ( line [ 7 ..] . Trim ( ) ) ;
68+ dependencies . Add ( trimmedLine [ 7 ..] . Trim ( ) ) ;
6769
6870 continue ;
6971 }
7072
7173 if ( trimmedLine . StartsWith ( "map_Bump" ) )
7274 {
73- dependencies . Add ( line [ 8 ..] . Trim ( ) ) ;
75+ dependencies . Add ( trimmedLine [ 8 ..] . Trim ( ) ) ;
7476
7577 continue ;
7678 }
7779
7880 if ( trimmedLine . StartsWith ( "map_d" ) )
7981 {
80- dependencies . Add ( line [ 6 ..] . Trim ( ) ) ;
82+ dependencies . Add ( trimmedLine [ 6 ..] . Trim ( ) ) ;
8183
8284 continue ;
8385 }
8486
8587 if ( trimmedLine . StartsWith ( "map_Ns" ) )
8688 {
87- dependencies . Add ( line [ 7 ..] . Trim ( ) ) ;
89+ dependencies . Add ( trimmedLine [ 7 ..] . Trim ( ) ) ;
8890
8991 continue ;
9092 }
9193
9294 if ( trimmedLine . StartsWith ( "bump" ) )
9395 {
94- dependencies . Add ( line [ 5 ..] . Trim ( ) ) ;
96+ dependencies . Add ( trimmedLine [ 5 ..] . Trim ( ) ) ;
9597
9698 continue ;
9799 }
98100
99101 if ( trimmedLine . StartsWith ( "disp" ) )
100102 {
101- dependencies . Add ( line [ 5 ..] . Trim ( ) ) ;
103+ dependencies . Add ( trimmedLine [ 5 ..] . Trim ( ) ) ;
102104
103105 continue ;
104106 }
105107
106108 if ( trimmedLine . StartsWith ( "decal" ) )
107109 {
108- dependencies . Add ( line [ 6 ..] . Trim ( ) ) ;
110+ dependencies . Add ( trimmedLine [ 6 ..] . Trim ( ) ) ;
109111
110112 continue ;
111113 }
@@ -175,4 +177,4 @@ public static void ConvertB3dm(string objPath, string destPath)
175177
176178 File . WriteAllBytes ( destPath , b3dm . ToBytes ( ) ) ;
177179 }
178- }
180+ }
0 commit comments