mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-01-18 15:26:19 +08:00
Fix OBJ export of rotated cube faces
Rename mesh "Line" to "Edge" Fix dialog title offset in text prompt dialog Fix plugin install registration not working in web app Fix modded entity models not exporting after conversion, closes #1124
This commit is contained in:
parent
e3ac34f4c5
commit
fa98a3f28d
@ -276,7 +276,7 @@ const Blockbench = {
|
||||
},
|
||||
textPrompt(title, value, callback, placeholder = null) {
|
||||
showDialog('text_input')
|
||||
$('#text_input .dialog_handle').text(tl(title || 'dialog.input.title'))
|
||||
$('#text_input .dialog_handle .dialog_title').text(tl(title || 'dialog.input.title'))
|
||||
$('#text_input input#text_input_field').val(value).trigger('select').attr('placeholder', placeholder);
|
||||
$('#text_input button.confirm_btn').off()
|
||||
$('#text_input button.confirm_btn').on('click', function() {
|
||||
|
@ -1556,7 +1556,7 @@ const BARS = {
|
||||
delete mesh.vertices[vertex_key];
|
||||
}
|
||||
})
|
||||
} else if (BarItems.selection_mode.value == 'line' && selected_vertices.length) {
|
||||
} else if (BarItems.selection_mode.value == 'edge' && selected_vertices.length) {
|
||||
for (let key in mesh.faces) {
|
||||
let face = mesh.faces[key];
|
||||
let sorted_vertices = face.getSortedVertices();
|
||||
|
@ -813,7 +813,7 @@ onVueSetup(function() {
|
||||
Mesh.selected.forEach(mesh => mesh.forAllFaces(face => selected += (face.isSelected() ? 1 : 0)));
|
||||
this.selection_info = tl('status_bar.selection.faces', `${selected} / ${total}`);
|
||||
}
|
||||
if (selection_mode == 'line') {
|
||||
if (selection_mode == 'edge') {
|
||||
let total = 0, selected = 0;
|
||||
Mesh.selected.forEach(mesh => {
|
||||
let selected_vertices = mesh.getSelectedVertices();
|
||||
@ -832,7 +832,7 @@ onVueSetup(function() {
|
||||
})
|
||||
})
|
||||
})
|
||||
this.selection_info = tl('status_bar.selection.lines', `${selected} / ${total}`);
|
||||
this.selection_info = tl('status_bar.selection.edges', `${selected} / ${total}`);
|
||||
}
|
||||
if (selection_mode == 'vertex') {
|
||||
let total = 0, selected = 0;
|
||||
|
@ -86,10 +86,17 @@ var codec = new Codec('obj', {
|
||||
for (let key in element.faces) {
|
||||
if (element.faces[key].texture !== null) {
|
||||
let face = element.faces[key];
|
||||
output.push(`vt ${face.uv[0] / Project.texture_width} ${1 - face.uv[1] / Project.texture_height}`);
|
||||
output.push(`vt ${face.uv[2] / Project.texture_width} ${1 - face.uv[1] / Project.texture_height}`);
|
||||
output.push(`vt ${face.uv[2] / Project.texture_width} ${1 - face.uv[3] / Project.texture_height}`);
|
||||
output.push(`vt ${face.uv[0] / Project.texture_width} ${1 - face.uv[3] / Project.texture_height}`);
|
||||
let uv_outputs = [];
|
||||
uv_outputs.push(`vt ${face.uv[0] / Project.texture_width} ${1 - face.uv[1] / Project.texture_height}`);
|
||||
uv_outputs.push(`vt ${face.uv[2] / Project.texture_width} ${1 - face.uv[1] / Project.texture_height}`);
|
||||
uv_outputs.push(`vt ${face.uv[2] / Project.texture_width} ${1 - face.uv[3] / Project.texture_height}`);
|
||||
uv_outputs.push(`vt ${face.uv[0] / Project.texture_width} ${1 - face.uv[3] / Project.texture_height}`);
|
||||
var rot = element.faces[key].rotation || 0;
|
||||
while (rot > 0) {
|
||||
uv_outputs.splice(0, 0, uv_outputs.pop());
|
||||
rot -= 90;
|
||||
}
|
||||
output.push(...uv_outputs);
|
||||
nbVertexUvs += 4;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
class ModelProject {
|
||||
constructor(options = {}) {
|
||||
for (var key in ModelProject.properties) {
|
||||
ModelProject.properties[key].reset(this);
|
||||
ModelProject.properties[key].reset(this, true);
|
||||
}
|
||||
this.uuid = guid();
|
||||
this.selected = false;
|
||||
|
@ -1212,7 +1212,7 @@ BARS.defineActions(function() {
|
||||
options: {
|
||||
object: {name: true, icon: 'far.fa-gem'},
|
||||
face: {name: true, icon: 'crop_portrait'},
|
||||
line: {name: true, icon: 'fa-grip-lines-vertical'},
|
||||
edge: {name: true, icon: 'fa-grip-lines-vertical'},
|
||||
vertex: {name: true, icon: 'fiber_manual_record'},
|
||||
},
|
||||
icon_mode: true,
|
||||
|
@ -117,7 +117,17 @@ class Plugin {
|
||||
}
|
||||
async download(first) {
|
||||
var scope = this;
|
||||
function register() {
|
||||
jQuery.ajax({
|
||||
url: 'https://blckbn.ch/api/event/install_plugin',
|
||||
type: 'POST',
|
||||
data: {
|
||||
plugin: scope.id
|
||||
}
|
||||
})
|
||||
}
|
||||
if (!isApp) {
|
||||
if (first) register();
|
||||
return await scope.install(first)
|
||||
}
|
||||
return await new Promise((resolve, reject) => {
|
||||
@ -129,15 +139,7 @@ class Plugin {
|
||||
await scope.install(first);
|
||||
resolve()
|
||||
}, 20)
|
||||
if (first) {
|
||||
jQuery.ajax({
|
||||
url: 'https://blckbn.ch/api/event/install_plugin',
|
||||
type: 'POST',
|
||||
data: {
|
||||
plugin: scope.id
|
||||
}
|
||||
})
|
||||
}
|
||||
if (first) register();
|
||||
})
|
||||
});
|
||||
});
|
||||
|
@ -357,7 +357,7 @@ class Preview {
|
||||
if (element.mesh.vertex_points && element.mesh.vertex_points.visible) {
|
||||
objects.push(element.mesh.vertex_points);
|
||||
}
|
||||
if (element instanceof Mesh && element.mesh.outline.visible && BarItems.selection_mode.value == 'line') {
|
||||
if (element instanceof Mesh && element.mesh.outline.visible && BarItems.selection_mode.value == 'edge') {
|
||||
objects.push(element.mesh.outline);
|
||||
}
|
||||
}
|
||||
@ -1089,7 +1089,7 @@ class Preview {
|
||||
}
|
||||
}
|
||||
|
||||
} else if (selection_mode == 'line') {
|
||||
} else if (selection_mode == 'edge') {
|
||||
for (let fkey in element.faces) {
|
||||
let face = element.faces[fkey];
|
||||
let vertices = face.getSortedVertices();
|
||||
|
@ -105,8 +105,8 @@ class Property {
|
||||
target[this.name] = instance[this.name];
|
||||
}
|
||||
}
|
||||
reset(instance) {
|
||||
if (instance[this.name] == undefined && !Condition(this.condition, instance)) return;
|
||||
reset(instance, force) {
|
||||
if (instance[this.name] == undefined && !Condition(this.condition, instance) && !force) return;
|
||||
var dft = this.getDefault(instance)
|
||||
|
||||
if (this.isArray || this.isVector || this.isVector2) {
|
||||
|
14
lang/en.json
14
lang/en.json
@ -146,7 +146,7 @@
|
||||
"status_bar.processing_gif":"Processing GIF",
|
||||
"status_bar.toggle_sidebar": "Toggle Sidebar",
|
||||
"status_bar.selection.faces": "%0 Faces",
|
||||
"status_bar.selection.lines": "%0 Lines",
|
||||
"status_bar.selection.edges": "%0 Edges",
|
||||
"status_bar.selection.vertices": "%0 Vertices",
|
||||
|
||||
"message.canvas_limit_error.title": "Canvas Limit Error",
|
||||
@ -765,9 +765,7 @@
|
||||
"action.slider_brush_size": "Size",
|
||||
"action.slider_brush_size.desc": "Radius of the brush in pixels",
|
||||
"action.slider_brush_opacity": "Opacity",
|
||||
"action.slider_brush_opacity.desc": "Opacity of the brush in percent",
|
||||
"action.slider_brush_min_opacity": "Minimum Opacity",
|
||||
"action.slider_brush_min_opacity.desc": "Minimum opacity of the noise brush in percent",
|
||||
"action.slider_brush_opacity.desc": "Opacity of the brush from 0 to 255",
|
||||
"action.slider_brush_softness": "Softness",
|
||||
"action.slider_brush_softness.desc": "Softness of the brush in percent",
|
||||
|
||||
@ -1034,10 +1032,10 @@
|
||||
"action.selection_mode.desc": "Change how elements can be selected in the viewport",
|
||||
"action.selection_mode.object": "Object",
|
||||
"action.selection_mode.face": "Face",
|
||||
"action.selection_mode.line": "Line",
|
||||
"action.selection_mode.edge": "Edge",
|
||||
"action.selection_mode.vertex": "Vertex",
|
||||
"action.create_face": "Create Face or Line",
|
||||
"action.create_face.desc": "Creates a new face or line between the selected vertices",
|
||||
"action.create_face": "Create Face or Edge",
|
||||
"action.create_face.desc": "Creates a new face or edge between the selected vertices",
|
||||
"action.convert_to_mesh": "Convert to Mesh",
|
||||
"action.convert_to_mesh.desc": "Convert the selected elements into meshes",
|
||||
"action.invert_face": "Invert Face",
|
||||
@ -1047,7 +1045,7 @@
|
||||
"action.inset_mesh_selection": "Inset Selection",
|
||||
"action.inset_mesh_selection.desc": "Inset the selected parts of the mesh",
|
||||
"action.loop_cut": "Loop Cut",
|
||||
"action.loop_cut.desc": "Split the mesh in a loop across the selected line",
|
||||
"action.loop_cut.desc": "Split the mesh in a loop across the selected edge",
|
||||
"action.dissolve_edges": "Dissolve Edges",
|
||||
"action.dissolve_edges.desc": "Dissolve selected edges in a mesh and merge the faces they divide",
|
||||
"action.split_mesh": "Split Mesh",
|
||||
|
Loading…
Reference in New Issue
Block a user