From 0a594799cc588414b9f8a0b4900ec128f30bef60 Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Thu, 23 Nov 2023 13:29:29 +0100 Subject: [PATCH] Enable "Open in Blockbench" in web app --- js/interface/interface.js | 3 ++- js/texturing/textures.js | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/js/interface/interface.js b/js/interface/interface.js index 4f720c64..3f3484a1 100644 --- a/js/interface/interface.js +++ b/js/interface/interface.js @@ -93,7 +93,8 @@ const Interface = { slot: 'right_bar', float_position: [300, 0], float_size: [300, 300], - height: 300 + height: 300, + folded: true } } } diff --git a/js/texturing/textures.js b/js/texturing/textures.js index 2bab75de..d991fb94 100644 --- a/js/texturing/textures.js +++ b/js/texturing/textures.js @@ -1805,11 +1805,18 @@ class Texture { { icon: 'draw', name: 'menu.texture.edit_in_blockbench', - condition: (texture) => !Format.image_editor && texture.path, + condition: (texture) => !Format.image_editor, click(texture) { - let existing_tab = ModelProject.all.find(project => project.format.image_editor && project.textures.find(t => t.path && t.path == texture.path)); + let existing_tab, tex2; + for (let project of ModelProject.all) { + if (!project.format.image_editor) continue; + tex2 = project.textures.find(t => t.uuid == texture.uuid || (t.path && t.path == texture.path)); + if (tex2) { + existing_tab = project; + break; + } + } if (existing_tab) { - let tex2 = existing_tab.textures.find(t => t.path && t.path == texture.path); existing_tab.select(); tex2.select(); } else {