Skip to content

Commit 187acd6

Browse files
made KdTree generation robust against non-opc folders within the hierarchy. Also, when loading of the hierarchy fails anyways, this opc is ignored and others can continue
1 parent b870934 commit 187acd6

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/PRo3D.Core/Surface/SurfaceApp.fs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -859,8 +859,16 @@ module SurfaceApp =
859859
| Some p ->
860860
Log.startTimed "[RebuildKdTrees] loading patch hierarchy"
861861
let hs =
862-
Directory.EnumerateDirectories(p) |> Seq.toArray |> Array.map (fun p ->
863-
PatchHierarchy.load Serialization.binarySerializer.Pickle Serialization.binarySerializer.UnPickle (OpcPaths.OpcPaths p)
862+
Directory.EnumerateDirectories(p) |> Seq.toArray |> Array.choose (fun p ->
863+
if Files.isOpcFolder p then
864+
try
865+
PatchHierarchy.load Serialization.binarySerializer.Pickle Serialization.binarySerializer.UnPickle (OpcPaths.OpcPaths p) |> Some
866+
with e ->
867+
Log.warn "[RebuildKdTrees] failed to load patch hierarchy: %s\nException: %A" p e
868+
None
869+
else
870+
Log.warn "[RebuildKdTrees] skipping %s for KdTree Generation" p
871+
None
864872
)
865873
Log.stop()
866874
Log.startTimed "[RebuildKdTrees] creating kdtrees"
@@ -869,6 +877,7 @@ module SurfaceApp =
869877
KdTrees.loadKdTrees' h Trafo3d.Identity true ViewerModality.XYZ Serialization.binarySerializer true true PRo3D.Core.Surface.DebugKdTreesX.loadTriangles' false
870878
)
871879
Log.stop()
880+
Log.line "[RebuildKdTrees] created/validated KdTrees for %d opcs." kdTrees.Length
872881
model
873882
| None -> model
874883
| _ -> model

0 commit comments

Comments
 (0)