Skip to content

Commit 40bf448

Browse files
committed
🐛 Textures are always saved as internal, even when they should be external.
1 parent 28f61be commit 40bf448

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

src/blueprintFormat.ts

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import * as blueprintSettings from './blueprintSettings'
2-
import { BillboardMode, BoneConfig, LocatorConfig } from './nodeConfigs'
2+
import FormatPageSvelte from './components/formatPage.svelte'
33
import ProjectTitleSvelte from './components/projectTitle.svelte'
44
import { PACKAGE } from './constants'
5+
import { BillboardMode, BoneConfig, LocatorConfig } from './nodeConfigs'
6+
import { process } from './systems/modelDataFixerUpper'
57
import { events } from './util/events'
68
import { injectSvelteCompomponent } from './util/injectSvelteComponent'
79
import { toSafeFuntionName } from './util/minecraftUtil'
810
import { addProjectToRecentProjects } from './util/misc'
911
import { Valuable } from './util/stores'
10-
import { Variant } from './variants'
11-
import FormatPageSvelte from './components/formatPage.svelte'
1212
import { translate } from './util/translation'
13-
import { process } from './systems/modelDataFixerUpper'
13+
import { Variant } from './variants'
1414

1515
/**
1616
* The serialized Variant Bone Config
@@ -355,7 +355,7 @@ export const BLUEPRINT_CODEC = new Blockbench.Codec('animated_java_blueprint', {
355355
}
356356

357357
if (model.animation_variable_placeholders) {
358-
Interface.Panels.variable_placeholders.inside_vue._data.text =
358+
Interface.Panels.variable_placeholders.inside_vue.$data.text =
359359
model.animation_variable_placeholders
360360
}
361361

@@ -435,15 +435,23 @@ export const BLUEPRINT_CODEC = new Blockbench.Codec('animated_java_blueprint', {
435435

436436
model.textures = []
437437
for (const texture of Texture.all) {
438-
const save = texture.getUndoCopy() as Texture
438+
const save = texture.getSaveCopy() as Texture
439439
delete save.selected
440-
if (Project.save_path && texture.path) {
441-
const relative = PathModule.relative(Project.save_path, texture.path)
442-
texture.relative_path = relative.replace(/\\/g, '/')
440+
if (isApp && Project.save_path && texture.path && PathModule.isAbsolute(texture.path)) {
441+
const relative = PathModule.relative(
442+
PathModule.dirname(Project.save_path),
443+
texture.path
444+
)
445+
save.relative_path = relative.replace(/\\/g, '/')
446+
}
447+
if (
448+
options.bitmaps != false &&
449+
(Settings.get('embed_textures') || options.backup || options.bitmaps == true)
450+
) {
451+
save.source = texture.getDataURL()
452+
save.internal = true
443453
}
444-
save.source = 'data:image/png;base64,' + texture.getBase64()
445-
save.mode = 'bitmap'
446-
if (options.absolute_paths === false) delete save.path
454+
if (options.absolute_paths == false) delete save.path
447455
model.textures.push(save)
448456
}
449457

@@ -465,9 +473,9 @@ export const BLUEPRINT_CODEC = new Blockbench.Codec('animated_java_blueprint', {
465473
model.animation_controllers.push(controller.getUndoCopy(animationOptions, true))
466474
}
467475

468-
if (Interface.Panels.variable_placeholders.inside_vue._data.text) {
476+
if (Interface.Panels.variable_placeholders.inside_vue.$data.text) {
469477
model.animation_variable_placeholders =
470-
Interface.Panels.variable_placeholders.inside_vue._data.text
478+
Interface.Panels.variable_placeholders.inside_vue.$data.text
471479
}
472480

473481
if (!options.backup) {

0 commit comments

Comments
 (0)