Skip to content

Commit 3aa8a97

Browse files
committed
🐛 Fix rotation limits not being enforced when converting to a Blueprint
1 parent 0cfb047 commit 3aa8a97

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/formats/blueprint/index.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,7 @@ export interface IBlueprintFormatJSON {
149149
export function fixCubeRotation(cube: Cube) {
150150
const maxRotation = Math.max(...cube.rotation)
151151
const minRotation = Math.min(...cube.rotation)
152-
if (maxRotation <= 45 && minRotation >= -45) {
153-
console.log('Cube rotation is fine, no need to fix', cube.rotation)
154-
return
155-
}
152+
if (maxRotation <= 45 && minRotation >= -45) return
156153
// Use the rotation with the largest absolute value
157154
const rotation = Math.abs(maxRotation) >= Math.abs(minRotation) ? maxRotation : minRotation
158155
const axis = cube.rotation.indexOf(rotation)
@@ -173,13 +170,19 @@ export function convertToBlueprint() {
173170
group.createUniqueName(Group.all.filter(g => g !== group))
174171
group.sanitizeName()
175172
}
173+
176174
for (const animation of Blockbench.Animation.all) {
177175
animation.createUniqueName(Blockbench.Animation.all.filter(a => a !== animation))
178176
animation.name = sanitizeStorageKey(animation.name)
179177
}
178+
180179
for (const cube of Cube.all) {
181180
cube.setUVMode(false)
181+
182+
fixCubeRotation(cube)
182183
}
184+
185+
Canvas.updateAll()
183186
}
184187

185188
export function getDefaultProjectSettings() {

0 commit comments

Comments
 (0)