diff --git a/Package.swift b/Package.swift index dae3352..e0a3ef9 100644 --- a/Package.swift +++ b/Package.swift @@ -15,10 +15,13 @@ import Foundation // Prefer a local sibling checkout (../) when present, else the published URL — so the whole // OCCT ecosystem SHARES the single OCCTSwift/Libraries/OCCT.xcframework instead of each repo // extracting its own 1.3 GB copy. CI / fresh clones (no sibling) use the URL pin. `#filePath`-relative -// so it's independent of build CWD. +// so it's independent of build CWD. Guarded against SwiftPM's own checkout layout: a transitively- +// resolved checkout under a consumer's .build/ must never be treated as a local dev sibling +// (ecosystem issue OCCTSwiftScripts#69 / #70). func occtDep(_ name: String, from version: String) -> Package.Dependency { let manifestDir = URL(fileURLWithPath: #filePath).deletingLastPathComponent().path - if FileManager.default.fileExists(atPath: manifestDir + "/../\(name)/Package.swift") { + if !manifestDir.contains("/.build/"), + FileManager.default.fileExists(atPath: manifestDir + "/../\(name)/Package.swift") { return .package(path: "../\(name)") } return .package(url: "https://github.com/SecondMouseAU/\(name).git", from: Version(version)!) @@ -27,9 +30,11 @@ func occtDep(_ name: String, from version: String) -> Package.Dependency { // As occtDep, but pins to the package's minor line (`.upToNextMinor`) instead of // the major. Used to cap a transitive dependency whose newer minors pull deps we // don't want in the graph — see the OCCTSwiftIO note in `dependencies` below. +// Same checkout-layout guard as occtDep (ecosystem issue OCCTSwiftScripts#69 / #70). func occtDepUpToNextMinor(_ name: String, from version: String) -> Package.Dependency { let manifestDir = URL(fileURLWithPath: #filePath).deletingLastPathComponent().path - if FileManager.default.fileExists(atPath: manifestDir + "/../\(name)/Package.swift") { + if !manifestDir.contains("/.build/"), + FileManager.default.fileExists(atPath: manifestDir + "/../\(name)/Package.swift") { return .package(path: "../\(name)") } return .package(url: "https://github.com/SecondMouseAU/\(name).git", .upToNextMinor(from: Version(version)!)) diff --git a/Sources/OCCTMCPCore/Tools/HeatmapTools.swift b/Sources/OCCTMCPCore/Tools/HeatmapTools.swift index 9fcaa81..ae3024c 100644 --- a/Sources/OCCTMCPCore/Tools/HeatmapTools.swift +++ b/Sources/OCCTMCPCore/Tools/HeatmapTools.swift @@ -135,9 +135,19 @@ public enum HeatmapTools { let base = UInt32(indices.count) indices.append(base); indices.append(base + 1); indices.append(base + 2) } - bodies.append(ViewportBody.directMesh( + // ViewportBody.directMesh (positions/normals as separate arrays) no longer exists — + // ViewportBody's init takes a single interleaved vertexData ([px,py,pz,nx,ny,nz,...], + // stride 6), so zip the two flat per-vertex arrays together here (same idiom the + // OCCTSwiftViewport primitive factories, e.g. .box, use internally). + var vertexData: [Float] = [] + vertexData.reserveCapacity(positions.count * 2) + for i in stride(from: 0, to: positions.count, by: 3) { + vertexData.append(positions[i]); vertexData.append(positions[i + 1]); vertexData.append(positions[i + 2]) + vertexData.append(bnormals[i]); vertexData.append(bnormals[i + 1]); vertexData.append(bnormals[i + 2]) + } + bodies.append(ViewportBody( id: "\(fromBodyId)#band\(b)", - positions: positions, normals: bnormals, indices: indices, color: color + vertexData: vertexData, indices: indices, edges: [], color: color )) } guard !bodies.isEmpty else { return .init("No coloured surface produced.", isError: true) }