mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-01-18 15:26:19 +08:00
parent
4260c659b8
commit
a19c1a55ea
@ -280,8 +280,10 @@ var codec = new Codec('java_block', {
|
|||||||
if (model.textures) {
|
if (model.textures) {
|
||||||
//Create Path Array to fetch textures
|
//Create Path Array to fetch textures
|
||||||
var path_arr = path.split(osfs)
|
var path_arr = path.split(osfs)
|
||||||
|
if (!path_arr.includes('cit')) {
|
||||||
var index = path_arr.length - path_arr.indexOf('models')
|
var index = path_arr.length - path_arr.indexOf('models')
|
||||||
path_arr.splice(-index)
|
path_arr.splice(-index)
|
||||||
|
}
|
||||||
|
|
||||||
var texture_arr = model.textures
|
var texture_arr = model.textures
|
||||||
|
|
||||||
|
@ -223,8 +223,15 @@ class Texture {
|
|||||||
link = spaces[1]
|
link = spaces[1]
|
||||||
path_array[path_array.length-1] = this.namespace
|
path_array[path_array.length-1] = this.namespace
|
||||||
}
|
}
|
||||||
path_array.push('textures', link.replace(/\//g, osfs))
|
|
||||||
var path = path_array.join(osfs)+'.png'
|
if (path_array.includes('cit')) {
|
||||||
|
path_array.pop();
|
||||||
|
path_array.push(link.replace(/^\.*\//, '').replace(/\//g, osfs)+'.png')
|
||||||
|
} else {
|
||||||
|
path_array.push('textures', link.replace(/\//g, osfs)+'.png');
|
||||||
|
}
|
||||||
|
var path = path_array.join(osfs);
|
||||||
|
|
||||||
if (path && can_load) {
|
if (path && can_load) {
|
||||||
this.fromPath(path)
|
this.fromPath(path)
|
||||||
} else {
|
} else {
|
||||||
@ -449,19 +456,33 @@ class Texture {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
generateFolder(path) {
|
generateFolder(path) {
|
||||||
var scope = this
|
if (path.includes(osfs+'optifine'+osfs+'cit'+osfs)) {
|
||||||
if (path.includes(osfs+'textures'+osfs)) {
|
|
||||||
var arr = path.split(osfs+'textures'+osfs)
|
|
||||||
|
|
||||||
var arr1 = arr[0].split(osfs)
|
if (ModelMeta.export_path) {
|
||||||
scope.namespace = arr1[arr1.length-1]
|
let model_arr = ModelMeta.export_path.split(osfs).slice(0, -1);
|
||||||
|
let tex_arr = path.split(osfs).slice(0, -1);
|
||||||
|
let index = 0;
|
||||||
|
tex_arr.find((dir, i) => {
|
||||||
|
if (dir != model_arr[i]) return true;
|
||||||
|
index++;
|
||||||
|
})
|
||||||
|
this.folder = ['.', ...tex_arr.slice(index)].join('/');
|
||||||
|
} else {
|
||||||
|
this.folder = '.';
|
||||||
|
}
|
||||||
|
|
||||||
var arr2 = arr[arr.length-1].split(osfs)
|
} else if (path.includes(osfs+'textures'+osfs)) {
|
||||||
arr2.pop()
|
var arr = path.split(osfs+'textures'+osfs);
|
||||||
scope.folder = arr2.join('/')
|
|
||||||
|
var arr1 = arr[0].split(osfs);
|
||||||
|
this.namespace = arr1[arr1.length-1];
|
||||||
|
|
||||||
|
var arr2 = arr[arr.length-1].split(osfs);
|
||||||
|
arr2.pop();
|
||||||
|
this.folder = arr2.join('/');
|
||||||
} else {
|
} else {
|
||||||
var arr = path.split(osfs)
|
var arr = path.split(osfs)
|
||||||
scope.folder = arr[arr.length-2]
|
this.folder = arr[arr.length-2]
|
||||||
if (Format.id === 'java_block' && isApp) {
|
if (Format.id === 'java_block' && isApp) {
|
||||||
Blockbench.showMessageBox({
|
Blockbench.showMessageBox({
|
||||||
translateKey: 'loose_texture',
|
translateKey: 'loose_texture',
|
||||||
@ -469,9 +490,9 @@ class Texture {
|
|||||||
buttons: [tl('message.loose_texture.change'), tl('dialog.ok')],
|
buttons: [tl('message.loose_texture.change'), tl('dialog.ok')],
|
||||||
confirm: 0,
|
confirm: 0,
|
||||||
cancel: 1
|
cancel: 1
|
||||||
}, function(result) {
|
}, result => {
|
||||||
if (result === 0) {
|
if (result === 0) {
|
||||||
scope.reopen()
|
this.reopen()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user