Skip to content

Commit 5f43aaa

Browse files
committed
Don't show extraneous info if script has no geometry
1 parent 62370af commit 5f43aaa

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

Viewer/Shared/Document+ModelInfo.swift

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ extension Document {
8989
watertight = "calculating…"
9090
}
9191

92+
let hasTriangles = triangles != "0"
9293
if let selectedGeometry {
9394
var locationString = ""
9495
if let location = selectedGeometry.sourceLocation {
@@ -100,17 +101,16 @@ extension Document {
100101
let nameString = selectedGeometry.name.flatMap {
101102
$0.isEmpty ? nil : "Name: \($0)"
102103
}
103-
let isMesh = selectedGeometry.hasMesh
104104
let childCount = selectedGeometry.childCount
105105
return [
106106
nameString,
107107
"Type: \(selectedGeometry.nestedLogDescription)",
108108
childCount == 0 ? nil : "Children: \(childCount)",
109109
triangles == polygons ? nil : "Polygons: \(polygons)",
110-
isMesh ? "Triangles: \(triangles)" : nil,
110+
hasTriangles ? "Triangles: \(triangles)" : nil,
111111
geometry.overestimatedBounds.isEmpty ? nil : "Dimensions: \(dimensions)",
112-
isMesh ? "Volume: \(volume)" : nil,
113-
isMesh ? "Watertight: \(watertight)" : nil,
112+
hasTriangles ? "Volume: \(volume)" : nil,
113+
hasTriangles ? "Watertight: \(watertight)" : nil,
114114
// "Size: \(selectedGeometry.transform.scale.logDescription)",
115115
// "Position: \(selectedGeometry.transform.offset.logDescription)",
116116
// "Orientation: \(selectedGeometry.transform.rotation.logDescription)",
@@ -119,14 +119,13 @@ extension Document {
119119
}
120120

121121
let objectCount = geometry.objectCount
122-
let hasMeshes = geometry.hasMesh
123122
return [
124123
"Objects: \(objectCount)",
125124
triangles == polygons ? nil : "Polygons: \(polygons)",
126-
hasMeshes ? "Triangles: \(triangles)" : nil,
125+
hasTriangles ? "Triangles: \(triangles)" : nil,
127126
geometry.overestimatedBounds.isEmpty ? nil : "Dimensions: \(dimensions)",
128-
hasMeshes ? "Volume: \(volume)" : nil,
129-
hasMeshes ? "Watertight: \(watertight)" : nil,
127+
hasTriangles ? "Volume: \(volume)" : nil,
128+
hasTriangles ? "Watertight: \(watertight)" : nil,
130129
"",
131130
importedFileCount == 0 ? nil : "Imports: \(importedFileCount)",
132131
textureCount == 0 ? nil : "Textures: \(textureCount)",

0 commit comments

Comments
 (0)