Skip to content

Commit e38d464

Browse files
author
Christopher Remde
committed
Fixed bounds being not correctly generated
1 parent 1e10fbb commit e38d464

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

Converter/Sequence_Metadata.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ class MetaData():
2121
hasNormals = False
2222
maxVertexCount = 0
2323
maxIndiceCount = 0
24-
minMaxBounds = [0,0,0,0,0,0]
24+
boundsCenter = [0,0,0]
25+
boundsSize = [1,1,1]
2526
textureWidth = 0
2627
textureHeight = 0
2728
textureSizeDDS = 0
@@ -44,7 +45,8 @@ def get_as_dict(self):
4445
"hasNormals" : self.hasNormals,
4546
"maxVertexCount": self.maxVertexCount,
4647
"maxIndiceCount" : self.maxIndiceCount,
47-
"maxBounds" : self.minMaxBounds,
48+
"boundsCenter" : self.boundsCenter,
49+
"boundsSize" : self.boundsSize,
4850
"textureWidth" : self.textureWidth,
4951
"textureHeight" : self.textureHeight,
5052
"textureSizeDDS" : self.textureSizeDDS,
@@ -70,17 +72,12 @@ def set_metadata_Model(self, vertexCount, indiceCount, headerSize, bounds, geome
7072
if(indiceCount > self.maxIndiceCount):
7173
self.maxIndiceCount = indiceCount
7274

73-
for maxBound in range(3):
74-
if abs(self.minMaxBounds[maxBound]) < abs(bounds.max()[maxBound]):
75-
self.minMaxBounds[maxBound] = bounds.max()[maxBound]
76-
77-
for minBound in range(3):
78-
if abs(self.minMaxBounds[minBound + 3]) < abs(bounds.min()[minBound]):
79-
self.minMaxBounds[minBound + 3] = bounds.min()[minBound]
75+
self.boundsCenter = bounds.center().tolist()
76+
self.boundsSize = [bounds.dim_x(), bounds.dim_y(), bounds.dim_z()]
8077

8178
# Flip bounds x axis, as we also flip the model's x axis to match Unity's coordinate system
82-
self.minMaxBounds[0] *= -1 # Min X
83-
self.minMaxBounds[3] *= -1 # Max X
79+
self.boundsCenter[0] *= -1 # Min X
80+
self.boundsSize[0] *= -1 # Max X
8481

8582
self.headerSizes[listIndex] = headerSize
8683
self.verticeCounts[listIndex] = vertexCount

0 commit comments

Comments
 (0)