Add Color option to selection window
Fix hoglin window
This commit is contained in:
parent
9ee8deb082
commit
11be98c1e8
35
index.html
35
index.html
@ -403,41 +403,6 @@
|
|||||||
<div class="dialog_close_button" onclick="$('.dialog#'+open_dialog).find('.cancel_btn:not([disabled])').click()"><i class="material-icons">clear</i></div>
|
<div class="dialog_close_button" onclick="$('.dialog#'+open_dialog).find('.cancel_btn:not([disabled])').click()"><i class="material-icons">clear</i></div>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
<dialog class="dialog draggable paddinged" id="selection_creator">
|
|
||||||
<div class="dialog_handle tl">dialog.select.title</div>
|
|
||||||
|
|
||||||
<div class="dialog_bar">
|
|
||||||
<input type="checkbox" id="selgen_new" checked>
|
|
||||||
<label class="name_space_left tl" for="selgen_new">dialog.select.new</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="dialog_bar">
|
|
||||||
<input type="checkbox" id="selgen_group">
|
|
||||||
<label class="name_space_left tl" for="selgen_group">dialog.select.group</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="dialog_bar">
|
|
||||||
<label class="name_space_left tl">dialog.select.name</label>
|
|
||||||
<input type="text" class="dark_bordered half" id="selgen_name">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="dialog_bar">
|
|
||||||
<label class="name_space_left tl">data.texture</label>
|
|
||||||
<input type="text" class="dark_bordered half" id="selgen_texture">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="dialog_bar">
|
|
||||||
<label class="name_space_left tl">dialog.select.random</label>
|
|
||||||
<input type="range" min="0" max="100" step="1" value="100" class="tool half" id="selgen_random">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="dialog_bar button_bar">
|
|
||||||
<button type="button" class="tl confirm_btn" onclick="createSelection()">dialog.select.select</button>
|
|
||||||
<button type="button" class="tl cancel_btn" onclick="hideDialog()">dialog.cancel</button>
|
|
||||||
</div>
|
|
||||||
<div class="dialog_close_button" onclick="$('.dialog#'+open_dialog).find('.cancel_btn:not([disabled])').click()"><i class="material-icons">clear</i></div>
|
|
||||||
</dialog>
|
|
||||||
|
|
||||||
<dialog class="dialog draggable paddinged" id="settings">
|
<dialog class="dialog draggable paddinged" id="settings">
|
||||||
<div class="dialog_handle tl">dialog.settings.settings</div>
|
<div class="dialog_handle tl">dialog.settings.settings</div>
|
||||||
<div class="dialog_bar borderless tab_bar" id="settings_tab_bar">
|
<div class="dialog_bar borderless tab_bar" id="settings_tab_bar">
|
||||||
|
@ -228,43 +228,6 @@ function unselectAll() {
|
|||||||
})
|
})
|
||||||
TickUpdates.selection = true;
|
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
|
//Backup
|
||||||
setInterval(function() {
|
setInterval(function() {
|
||||||
if (Outliner.root.length || textures.length) {
|
if (Outliner.root.length || textures.length) {
|
||||||
|
@ -43,7 +43,7 @@ const codec = new Codec('skin_model', {
|
|||||||
if (obj.export) {
|
if (obj.export) {
|
||||||
if (obj instanceof Cube) {
|
if (obj instanceof Cube) {
|
||||||
|
|
||||||
let template = Codecs.bedrock.compileCube(obj);
|
let template = Codecs.bedrock.compileCube(obj, g);
|
||||||
cubes.push(template)
|
cubes.push(template)
|
||||||
cube_count++;
|
cube_count++;
|
||||||
|
|
||||||
@ -2505,70 +2505,71 @@ skin_presets.guardian = `{
|
|||||||
skin_presets.hoglin = `{
|
skin_presets.hoglin = `{
|
||||||
"name": "hoglin",
|
"name": "hoglin",
|
||||||
"texturewidth": 128,
|
"texturewidth": 128,
|
||||||
"textureheight": 128,
|
"textureheight": 64,
|
||||||
"bones": [
|
"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",
|
"name": "head",
|
||||||
"pivot": [0, 19, -13],
|
"parent": "body",
|
||||||
|
"pivot": [0, 22, -5],
|
||||||
"rotation": [50, 0, 0],
|
"rotation": [50, 0, 0],
|
||||||
"cubes": [
|
"cubes": [
|
||||||
{"name": "head", "origin": [-7, 17, -29], "size": [14, 6, 19], "uv": [1, 42]},
|
{"origin": [-7, 21, -24], "size": [14, 6, 19], "uv": [61, 1]},
|
||||||
{"name": "head", "origin": [6, 18, -23], "size": [2, 11, 2], "uv": [6, 45]},
|
{"origin": [-8, 22, -19], "size": [2, 11, 2], "uv": [1, 13]},
|
||||||
{"name": "head", "origin": [-8, 18, -23], "size": [2, 11, 2], "uv": [6, 45]}
|
{"origin": [6, 22, -19], "size": [2, 11, 2], "uv": [1, 13]}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "ear_right",
|
"name": "right_ear",
|
||||||
"parent": "head",
|
"parent": "head",
|
||||||
"pivot": [-6, 23, -14],
|
"pivot": [-7, 27, -7],
|
||||||
"rotation": [0, 0, -35],
|
"rotation": [0, 0, -50],
|
||||||
"cubes": [
|
"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",
|
"parent": "head",
|
||||||
"pivot": [6, 23, -14],
|
"pivot": [7, 27, -7],
|
||||||
"rotation": [0, 0, 35],
|
"rotation": [0, 0, 50],
|
||||||
"cubes": [
|
"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",
|
"name": "leg_back_right",
|
||||||
"pivot": [0, 19, 2],
|
"pivot": [6, 8, 17],
|
||||||
"cubes": [
|
"cubes": [
|
||||||
{"name": "body", "origin": [-8, 10, -13], "size": [16, 14, 26], "uv": [1, 1]},
|
{"origin": [-8, 0, 13], "size": [5, 11, 5], "uv": [21, 45]}
|
||||||
{"name": "body", "origin": [0, 21, -16], "size": [0, 10, 21], "uv": [3, 65]}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "leg0",
|
"name": "leg_back_left",
|
||||||
"pivot": [-5, 11, 10],
|
"pivot": [-6, 8, 17],
|
||||||
"cubes": [
|
"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",
|
"name": "leg_front_right",
|
||||||
"pivot": [5, 11, 10],
|
"pivot": [-6, 12, -3],
|
||||||
"cubes": [
|
"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",
|
"name": "leg_front_left",
|
||||||
"pivot": [-3.5, 14, -8.5],
|
"pivot": [6, 12, -3],
|
||||||
"cubes": [
|
"cubes": [
|
||||||
{"name": "leg2", "origin": [-7, 0, -11.5], "size": [6, 14, 6], "uv": [46, 75]}
|
{"origin": [2, 0, -6], "size": [6, 14, 6], "uv": [41, 42]}
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "leg3",
|
|
||||||
"pivot": [3.5, 14, -8.5],
|
|
||||||
"cubes": [
|
|
||||||
{"name": "leg3", "origin": [1, 0, -11.5], "size": [6, 14, 6], "uv": [71, 75]}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1010,8 +1010,72 @@ BARS.defineActions(function() {
|
|||||||
keybind: new Keybind({key: 70, ctrl: true}),
|
keybind: new Keybind({key: 70, ctrl: true}),
|
||||||
condition: () => Modes.edit || Modes.paivnt,
|
condition: () => Modes.edit || Modes.paivnt,
|
||||||
click: function () {
|
click: function () {
|
||||||
showDialog('selection_creator')
|
let color_options = {
|
||||||
$('#selgen_name').focus()
|
'-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: [
|
||||||
|
`<div class="dialog_bar form_bar">
|
||||||
|
<label class="name_space_left tl">dialog.select.random</label>
|
||||||
|
<input type="range" min="0" max="100" step="1" value="100" class="tool half" style="width: 100%;" id="selgen_random">
|
||||||
|
</div>`
|
||||||
|
],
|
||||||
|
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', {
|
new Action('invert_selection', {
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
"generic.search": "Search",
|
"generic.search": "Search",
|
||||||
"generic.help": "Help",
|
"generic.help": "Help",
|
||||||
"generic.name": "Name",
|
"generic.name": "Name",
|
||||||
|
"generic.all": "All",
|
||||||
"generic.none": "None",
|
"generic.none": "None",
|
||||||
"generic.unset": "Unset",
|
"generic.unset": "Unset",
|
||||||
"generic.enable": "Enable",
|
"generic.enable": "Enable",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user