Skip to content

Commit 5a654be

Browse files
committed
Update modelFormatMod.js
1 parent ea160e8 commit 5a654be

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/bbmods/modelFormatMod.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import * as EVENTS from '../constants/events'
22
import { format, format as modelFormat } from '../modelFormat'
3+
import { settings } from '../settings'
34
import { bus } from '../util/bus'
4-
import { wrapNumber } from '../util/misc'
5+
import { safeFunctionName } from '../util/replace'
6+
import * as pathjs from 'path'
7+
import { normalizePath } from '../util/misc'
58

69
const oldConvertFunc = ModelFormat.prototype.convertTo
710

@@ -17,6 +20,9 @@ ModelFormat.prototype.convertTo = function convertTo() {
1720
if (Format.id === format.id) {
1821
Project.UUID = guid()
1922
}
23+
// Set project name
24+
settings.animatedJava.projectName = safeFunctionName(Project.name)
25+
2026
// Box UV
2127
if (!this.optional_box_uv) Project.box_uv = this.box_uv
2228

@@ -133,7 +139,8 @@ ModelFormat.prototype.convertTo = function convertTo() {
133139
Cube.all.forEach((cube) => {
134140
if (!cube.rotation.allEqual(0)) {
135141
var axis =
136-
(cube.rotation_axis && getAxisNumber(cube.rotation_axis)) ||
142+
(cube.rotationAxis() &&
143+
getAxisNumber(cube.rotation_axis)) ||
137144
0
138145
var angle = limitNumber(
139146
Math.round(cube.rotation[axis] / 22.5) * 22.5,
@@ -150,6 +157,14 @@ ModelFormat.prototype.convertTo = function convertTo() {
150157
if (!Format.animation_mode && old_format.animation_mode) {
151158
Animator.animations.length = 0
152159
}
160+
161+
Project.saved = false
162+
hideDialog()
163+
164+
let file = pathjs.parse(Project.save_path)
165+
Project.export_path = normalizePath(`${file.dir}.${Project.format.codec.extension}`)
166+
// Project.format.codec.export()
167+
153168
Canvas.updateAllPositions()
154169
Canvas.updateAllBones()
155170
Canvas.updateAllFaces()

0 commit comments

Comments
 (0)