diff --git a/index.html b/index.html index 4c658dac..a271ca49 100644 --- a/index.html +++ b/index.html @@ -403,41 +403,6 @@
clear
- -
dialog.select.title
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
-
clear
-
-
dialog.settings.settings
diff --git a/js/blockbench.js b/js/blockbench.js index a986f4f3..08aa5b8e 100644 --- a/js/blockbench.js +++ b/js/blockbench.js @@ -228,43 +228,6 @@ function unselectAll() { }) TickUpdates.selection = true; } -function createSelection() { - if ($('#selgen_new').is(':checked')) { - selected.length = 0 - } - if (Group.selected) { - Group.selected.unselect() - } - var name_seg = $('#selgen_name').val().toUpperCase() - var tex_seg = $('#selgen_texture').val().toLowerCase() - var rdm = $('#selgen_random').val()/100 - - var array = elements - if ($('#selgen_group').is(':checked') && Group.selected) { - array = Group.selected.children - } - - array.forEach(function(obj) { - if (obj.name.toUpperCase().includes(name_seg) === false) return; - if (obj instanceof Cube && tex_seg && !Format.single_texture) { - var has_tex = false; - for (var key in obj.faces) { - var tex = obj.faces[key].getTexture(); - if (tex && tex.name.includes(tex_seg)) { - has_tex = true - } - } - if (!has_tex) return; - } - if (Math.random() > rdm) return; - selected.push(obj) - }) - updateSelection() - if (selected.length) { - selected[0].showInOutliner() - } - hideDialog() -} //Backup setInterval(function() { if (Outliner.root.length || textures.length) { diff --git a/js/io/formats/skin.js b/js/io/formats/skin.js index 3db26686..bf6255bf 100644 --- a/js/io/formats/skin.js +++ b/js/io/formats/skin.js @@ -43,7 +43,7 @@ const codec = new Codec('skin_model', { if (obj.export) { if (obj instanceof Cube) { - let template = Codecs.bedrock.compileCube(obj); + let template = Codecs.bedrock.compileCube(obj, g); cubes.push(template) cube_count++; @@ -2505,70 +2505,71 @@ skin_presets.guardian = `{ skin_presets.hoglin = `{ "name": "hoglin", "texturewidth": 128, - "textureheight": 128, + "textureheight": 64, "bones": [ + { + "name": "body", + "pivot": [0, 19, -3], + "cubes": [ + {"origin": [-8, 11, -7], "size": [16, 14, 26], "inflate": 0.02, "uv": [1, 1]}, + {"origin": [0, 22, -10], "size": [0, 10, 19], "inflate": 0.02, "uv": [90, 33]} + ] + }, { "name": "head", - "pivot": [0, 19, -13], + "parent": "body", + "pivot": [0, 22, -5], "rotation": [50, 0, 0], "cubes": [ - {"name": "head", "origin": [-7, 17, -29], "size": [14, 6, 19], "uv": [1, 42]}, - {"name": "head", "origin": [6, 18, -23], "size": [2, 11, 2], "uv": [6, 45]}, - {"name": "head", "origin": [-8, 18, -23], "size": [2, 11, 2], "uv": [6, 45]} + {"origin": [-7, 21, -24], "size": [14, 6, 19], "uv": [61, 1]}, + {"origin": [-8, 22, -19], "size": [2, 11, 2], "uv": [1, 13]}, + {"origin": [6, 22, -19], "size": [2, 11, 2], "uv": [1, 13]} ] }, { - "name": "ear_right", + "name": "right_ear", "parent": "head", - "pivot": [-6, 23, -14], - "rotation": [0, 0, -35], + "pivot": [-7, 27, -7], + "rotation": [0, 0, -50], "cubes": [ - {"name": "cube", "origin": [-13, 22, -17], "size": [6, 1, 4], "uv": [4, 16]} + {"origin": [-13, 26, -10], "size": [6, 1, 4], "uv": [1, 1]} ] }, { - "name": "ear_left", + "name": "left_ear", "parent": "head", - "pivot": [6, 23, -14], - "rotation": [0, 0, 35], + "pivot": [7, 27, -7], + "rotation": [0, 0, 50], "cubes": [ - {"name": "cube", "origin": [7, 22, -17], "size": [6, 1, 4], "uv": [4, 21]} + {"origin": [7, 26, -10], "size": [6, 1, 4], "uv": [1, 6]} ] }, { - "name": "body", - "pivot": [0, 19, 2], + "name": "leg_back_right", + "pivot": [6, 8, 17], "cubes": [ - {"name": "body", "origin": [-8, 10, -13], "size": [16, 14, 26], "uv": [1, 1]}, - {"name": "body", "origin": [0, 21, -16], "size": [0, 10, 21], "uv": [3, 65]} + {"origin": [-8, 0, 13], "size": [5, 11, 5], "uv": [21, 45]} ] }, { - "name": "leg0", - "pivot": [-5, 11, 10], + "name": "leg_back_left", + "pivot": [-6, 8, 17], "cubes": [ - {"name": "leg0", "origin": [-7.5, 0, 7.5], "size": [5, 11, 5], "uv": [51, 43]} + {"origin": [3, 0, 13], "size": [5, 11, 5], "uv": [0, 45]} ] }, { - "name": "leg1", - "pivot": [5, 11, 10], + "name": "leg_front_right", + "pivot": [-6, 12, -3], "cubes": [ - {"name": "leg1", "origin": [2.5, 0, 7.5], "size": [5, 11, 5], "uv": [72, 43]} + {"origin": [-8, 0, -6], "size": [6, 14, 6], "uv": [66, 42]} ] }, { - "name": "leg2", - "pivot": [-3.5, 14, -8.5], + "name": "leg_front_left", + "pivot": [6, 12, -3], "cubes": [ - {"name": "leg2", "origin": [-7, 0, -11.5], "size": [6, 14, 6], "uv": [46, 75]} - ] - }, - { - "name": "leg3", - "pivot": [3.5, 14, -8.5], - "cubes": [ - {"name": "leg3", "origin": [1, 0, -11.5], "size": [6, 14, 6], "uv": [71, 75]} + {"origin": [2, 0, -6], "size": [6, 14, 6], "uv": [41, 42]} ] } ] diff --git a/js/outliner/outliner.js b/js/outliner/outliner.js index 1e9760ba..802106a6 100644 --- a/js/outliner/outliner.js +++ b/js/outliner/outliner.js @@ -1010,8 +1010,72 @@ BARS.defineActions(function() { keybind: new Keybind({key: 70, ctrl: true}), condition: () => Modes.edit || Modes.paivnt, click: function () { - showDialog('selection_creator') - $('#selgen_name').focus() + let color_options = { + '-1': 'generic.all' + } + markerColors.forEach((color, i) => { + color_options[i] = 'cube.color.' + color.name; + }) + let dialog = new Dialog({ + id: 'selection_creator', + title: 'dialog.select.title', + form_first: true, + form: { + new: {label: 'dialog.select.new', type: 'checkbox', value: true}, + group: {label: 'dialog.select.group', type: 'checkbox'}, + name: {label: 'dialog.select.name', type: 'text'}, + texture: {label: 'data.texture', type: 'text'}, + color: {label: 'menu.cube.color', type: 'select', value: '-1', options: color_options} + }, + lines: [ + `
+ + +
` + ], + onConfirm(formData) { + if (formData.new) { + selected.length = 0 + } + let selected_group = Group.selected; + if (Group.selected) { + Group.selected.unselect() + } + var name_seg = formData.name.toUpperCase() + var tex_seg = formData.texture.toLowerCase() + var rdm = $('#selgen_random').val()/100 + + var array = Outliner.elements; + if ($('#selgen_group').is(':checked') && selected_group) { + array = selected_group.children + } + + array.forEach(function(obj) { + if (obj.name.toUpperCase().includes(name_seg) === false) return; + if (obj instanceof Cube && tex_seg && !Format.single_texture) { + var has_tex = false; + for (var key in obj.faces) { + var tex = obj.faces[key].getTexture(); + if (tex && tex.name.includes(tex_seg)) { + has_tex = true + } + } + if (!has_tex) return; + } + if (formData.color != '-1') { + if (obj instanceof Cube == false || obj.color.toString() != formData.color) return; + } + if (Math.random() > rdm) return; + selected.push(obj) + }) + updateSelection() + if (selected.length) { + selected[0].showInOutliner() + } + this.hide() + } + }).show() + $('.dialog#selection_creator .form_bar_name > input').focus() } }) new Action('invert_selection', { diff --git a/lang/en.json b/lang/en.json index 26689a7d..567c844c 100644 --- a/lang/en.json +++ b/lang/en.json @@ -37,6 +37,7 @@ "generic.search": "Search", "generic.help": "Help", "generic.name": "Name", + "generic.all": "All", "generic.none": "None", "generic.unset": "Unset", "generic.enable": "Enable",