This commit is contained in:
JannisX11 2020-04-29 23:35:47 +02:00
parent ae75a1f474
commit 41abfda314
23 changed files with 101 additions and 2016 deletions

View File

@ -793,6 +793,18 @@
width: 7px;
background-color: var(--color-text);
}
#uv_size .ui-resizable-se,
#uv_size .ui-resizable-sw,
#uv_size .ui-resizable-ne,
#uv_size .ui-resizable-nw {
height: 9px;
width: 9px;
}
#uv_size .ui-resizable-se {right: -6px; bottom: -6px; z-index: 91 !important;}
#uv_size .ui-resizable-sw {left: -6px; bottom: -6px;}
#uv_size .ui-resizable-ne {right: -6px; top: -6px;}
#uv_size .ui-resizable-nw {left: -6px; top: -6px;}
#uv_frame:hover #uv_size .ui-resizable-handle:before {
background-color: white;
}
@ -803,20 +815,20 @@
background-color: var(--color-accent);
}
#uv_size .ui-resizable-se:before {
bottom: 1px;
right: 1px;
bottom: 2px;
right: 2px;
}
#uv_size .ui-resizable-sw:before {
bottom: 1px;
left: 1px;
bottom: 2px;
left: 2px;
}
#uv_size .ui-resizable-ne:before {
top: 1px;
right: 1px;
top: 2px;
right: 2px;
}
#uv_size .ui-resizable-nw:before {
top: 1px;
left: 1px;
top: 2px;
left: 2px;
}
#texture_selection_rect {

View File

@ -24,7 +24,7 @@
<script>
if (typeof module === 'object') {window.module = module; module = undefined;}//jQuery Fix
const isApp = typeof require !== 'undefined';
const appVersion = '3.5.1';
const appVersion = '3.5.2';
</script>
<div id="loading_error_message" style="display: none;">
<div>An error occurred while loading Blockbench</div>

View File

@ -306,7 +306,6 @@ class GeneralAnimator {
})
}
select() {
if (this.getGroup().locked) return;
var scope = this;
TickUpdates.keyframes = true;
for (var key in Animator.selected.animators) {
@ -436,6 +435,8 @@ class BoneAnimator extends GeneralAnimator {
return this.group
}
select(group_is_selected) {
if (this.getGroup().locked) return this;
var duplicates;
for (var key in this.animation.animators) {
this.animation.animators[key].selected = false;

View File

@ -159,7 +159,9 @@ class Menu {
entry.off('click')
entry.off('mouseenter mousedown')
entry.on('mouseenter mousedown', function(e) {
scope.hover(this, e)
if (this == e.target) {
scope.hover(this, e)
}
})
//Submenu
if (typeof s.children == 'function' || typeof s.children == 'object') {
@ -171,7 +173,7 @@ class Menu {
parent.append(entry)
}
} else if (typeof s === 'object') {
if (BARS.condition(s.condition, context)) {
let child_count;
if (typeof s.icon === 'function') {
@ -182,8 +184,8 @@ class Menu {
entry = $(`<li title="${s.description||''}">${tl(s.name)}</li>`)
entry.prepend(icon)
if (typeof s.click === 'function') {
entry.click(function(e) {
if (e.target == this) {
entry.click(e => {
if (e.target == entry.get(0)) {
s.click(context, e)
}
})

View File

@ -357,6 +357,9 @@ function parseGeometry(data) {
if (key == 'up') {
face.uv = [face.uv[2], face.uv[3], face.uv[0], face.uv[1]]
}
if (key == 'down') {
face.uv = [face.uv[0], face.uv[3], face.uv[2], face.uv[1]]
}
} else {
face.texture = null;
face.uv = [0, 0, 0, 0]
@ -531,6 +534,10 @@ var codec = new Codec('bedrock', {
template.uv[key].uv_size[0] *= -1;
template.uv[key].uv_size[1] *= -1;
}
if (key == 'down') {
template.uv[key].uv[1] += template.uv[key].uv_size[1];
template.uv[key].uv_size[1] *= -1;
}
}
}
}

View File

@ -1,7 +1,7 @@
(function() {
function buildAnimationTracks() {
let tracks = [];
let anims = [];
Animator.animations.forEach(animation => {
let tracks = [];
@ -87,12 +87,12 @@ function buildAnimationTracks() {
}
if (tracks.length) {
let clip = new THREE.AnimationClip(animation.name, animation.length, tracks)
tracks.push(clip);
anims.push(clip);
} else {
console.log(`Skip export of animation ${animation.name} - No tracks generated`)
}
})
return tracks;
return anims;
}
var codec = new Codec('gltf', {
@ -116,7 +116,6 @@ var codec = new Codec('gltf', {
if (options.animations !== false) {
animations = buildAnimationTracks();
}
exporter.parse(gl_scene, (json) => {
scope.dispatchEvent('compile', {model: json, options});

View File

@ -99,7 +99,6 @@ const Templates = {
name: '1.15',
flip_y: true,
integer_size: false,
radians: true,
file:
`// Made with Blockbench %(bb_version)
// Exported for Minecraft version 1.15
@ -214,17 +213,11 @@ var codec = new Codec('modded_entity', {
.replace(/\n\?\(has_rotation\).+/, group.rotation.allEqual(0) ? '' : Templates.keepLine)
if (Templates.get('radians')) {
snippet = snippet
.replace(R('rx'), F(Math.degToRad(-group.rotation[0])))
.replace(R('ry'), F(Math.degToRad(-group.rotation[1])))
.replace(R('rz'), F(Math.degToRad(group.rotation[2])))
} else {
snippet = snippet
.replace(R('rx'), F(-group.rotation[0]))
.replace(R('ry'), F(-group.rotation[1]))
.replace(R('rz'), F(group.rotation[2]))
}
snippet = snippet
.replace(R('rx'), F(Math.degToRad(-group.rotation[0])))
.replace(R('ry'), F(Math.degToRad(-group.rotation[1])))
.replace(R('rz'), F(Math.degToRad(group.rotation[2])))
var origin = group.origin.slice();
@ -282,9 +275,9 @@ var codec = new Codec('modded_entity', {
} else {
c_snippet = c_snippet
.replace(R('dx'), F(cube.size(0)) )
.replace(R('dy'), F(cube.size(1)) )
.replace(R('dz'), F(cube.size(2)) )
.replace(R('dx'), F(cube.size(0, true)) )
.replace(R('dy'), F(cube.size(1, true)) )
.replace(R('dz'), F(cube.size(2, true)) )
}
cube_snippets.push(c_snippet);
@ -302,6 +295,8 @@ var codec = new Codec('modded_entity', {
let group_snippets = [];
for (var group of all_groups) {
if (group instanceof Group === false || !group.export) continue;
if (!Templates.get('render_subgroups') && group.parent instanceof Group) continue;
let snippet = Templates.get('renderer')
.replace(R('bone'), group.name)
group_snippets.push(snippet);
@ -485,9 +480,9 @@ var codec = new Codec('modded_entity', {
})
cube.extend({
to: [
cube.from[0] + match[7],
cube.from[1] + match[8],
cube.from[2] + match[9],
cube.from[0] + Math.floor(match[7]),
cube.from[1] + Math.floor(match[8]),
cube.from[2] + Math.floor(match[9]),
]
});
cube.addTo(bones[match[0]]).init();
@ -511,9 +506,9 @@ var codec = new Codec('modded_entity', {
})
cube.extend({
to: [
cube.from[0] + match[4],
cube.from[1] + match[5],
cube.from[2] + match[6],
cube.from[0] + Math.floor(match[4]),
cube.from[1] + Math.floor(match[5]),
cube.from[2] + Math.floor(match[6]),
]
});
cube.addTo(bones[match[0]]).init();
@ -535,9 +530,9 @@ var codec = new Codec('modded_entity', {
})
cube.extend({
to: [
cube.from[0] + match[6],
cube.from[1] + match[7],
cube.from[2] + match[8],
cube.from[0] + Math.floor(match[6]),
cube.from[1] + Math.floor(match[7]),
cube.from[2] + Math.floor(match[8]),
]
});
cube.addTo(bones[match[0]]).init();
@ -634,8 +629,9 @@ var format = new ModelFormat({
single_texture: true,
bone_rig: true,
centered_grid: true,
integer_size: true
})
Object.defineProperty(format, 'integer_size', {get: _ => Templates.get('integer_size')})
//Object.defineProperty(format, 'integer_size', {get: _ => Templates.get('integer_size')})
codec.format = format;

View File

@ -218,12 +218,8 @@ class Cube extends NonGroup {
var scope = this;
let epsilon = 0.0000001;
function getA(axis) {
if (floored == TextureGenerator && Format.id === 'modded_entity') {
return Math.ceil(scope.to[axis] - scope.from[axis] - epsilon);
} else if (floored && Format.id !== 'modded_entity') {
if (floored) {
return Math.floor(scope.to[axis] - scope.from[axis] + epsilon);
} else {
return scope.to[axis] - scope.from[axis]
}

View File

@ -355,13 +355,13 @@ function loadInstalledPlugins() {
StateMemory.save('installed_plugins')
localStorage.removeItem('installed_plugins')
}
Plugins.installed.replace(Plugins.installed.filter(p => p !== null))
if (Plugins.json instanceof Object) {
//From Store
for (var id in Plugins.json) {
var plugin = new Plugin(id, Plugins.json[id])
if (Plugins.installed.find(plugin => {
return plugin.id == id && plugin.source == 'store'
if (Plugins.installed.find(p => {
return p && p.id == id && p.source == 'store'
})) {
plugin.download()
}

View File

@ -138,13 +138,13 @@ const TextureGenerator = {
},
//constructor
boxUVCubeTemplate: function(obj, min_size) {
this.x = obj.size(0, TextureGenerator) || min_size;
this.x = obj.size(0, true) || min_size;
this.y = obj.size(1, 'template') || min_size;
this.z = obj.size(2, TextureGenerator) || min_size;
this.z = obj.size(2, true) || min_size;
this.posx = obj.uv_offset[0];
this.posy = obj.uv_offset[1];
this.obj = obj;
this.template_size = (obj.size(2, TextureGenerator) + obj.size(1, 'template'))+ (obj.size(2, TextureGenerator) + obj.size(0, TextureGenerator))*2;
this.template_size = (obj.size(2, true) + obj.size(1, 'template'))+ (obj.size(2, true) + obj.size(0, true))*2;
this.height = this.z + this.y;
this.width = 2* (this.x + this.z);
@ -170,7 +170,7 @@ const TextureGenerator = {
if (obj.visibility === true) {
var template = new TextureGenerator.boxUVCubeTemplate(obj, min_size);
if (options.double_use && Project.box_uv && textures.length) {
var double_key = [...obj.uv_offset, ...obj.size(undefined, TextureGenerator), ].join('_')
var double_key = [...obj.uv_offset, ...obj.size(undefined, true), ].join('_')
if (doubles[double_key]) {
// improve chances that original is not mirrored
if (doubles[double_key][0].obj.mirror_uv && !obj.mirror_uv) {

View File

@ -185,6 +185,8 @@ class UVEditor {
handles: "all",
maxHeight: 320,
maxWidth: 320,
minWidth: 0,
minHeight: 0,
containment: 'parent',
start: function(event, ui) {
Undo.initEdit({elements: Cube.selected, uv_only: true})
@ -430,7 +432,11 @@ class UVEditor {
// Copy Paste Tool
startSelection(texture, x, y, event) {
if (Painter.selection.overlay && event.target && event.target.id === 'uv_frame') {
this.removePastingOverlay()
if (open_interface) {
open_interface.confirm()
} else {
this.removePastingOverlay()
}
}
delete Painter.selection.calcrect;
if (!Painter.selection.overlay) {
@ -495,6 +501,7 @@ class UVEditor {
let overlay = $(`<div id="texture_pasting_overlay">
<div class="control">
<div class="button_place" title="${tl('uv_editor.copy_paste_tool.place')}"><i class="material-icons">check_circle</i></div>
<div class="button_cancel" title="${tl('dialog.cancel')}"><i class="material-icons">cancel</i></div>
<div class="button_cut" title="${tl('uv_editor.copy_paste_tool.cut')}"><i class="fas fa-cut"></i></div>
<div class="button_mirror_x" title="${tl('uv_editor.copy_paste_tool.mirror_x')}"><i class="icon-mirror_x icon"></i></div>
<div class="button_mirror_y" title="${tl('uv_editor.copy_paste_tool.mirror_y')}"><i class="icon-mirror_y icon"></i></div>
@ -517,7 +524,7 @@ class UVEditor {
}
}
overlay.find('.button_place').click(open_interface.confirm);
//overlay.find('.button_cancel').click(open_interface.hide);
overlay.find('.button_cancel').click(open_interface.hide);
function getCanvasCopy() {
var temp_canvas = document.createElement('canvas')
@ -586,14 +593,21 @@ class UVEditor {
this.updateSize()
function hideOverlay(event) {
function clickElsewhere(event) {
if (!Painter.selection.overlay) {
removeEventListeners(document, 'mousedown touchstart', hideOverlay)
removeEventListeners(document, 'mousedown touchstart', clickElsewhere)
} else if (Painter.selection.overlay.has(event.target).length == 0) {
scope.removePastingOverlay()
open_interface.confirm()
}
/*
if (!Painter.selection.overlay) {
removeEventListeners(document, 'mousedown touchstart', clickElsewhere)
} else if (Painter.selection.overlay.has(event.target).length == 0) {
open_interface.confirm()
}
*/
}
addEventListeners(document, 'mousedown touchstart', hideOverlay)
addEventListeners(document, 'mousedown touchstart', clickElsewhere)
}
removePastingOverlay() {
Painter.selection.overlay.detach();
@ -1025,7 +1039,7 @@ class UVEditor {
displayAllMappingOverlays(force_reload) {
var scope = this;
var cycle = bbuid(4)
if (this.showing_overlays) {
if (this.showing_overlays && Project.box_uv) {
Cube.all.forEach(cube => {
var size = cube.size(undefined, true)
var hash = `${cube.uv_offset[0]}_${cube.uv_offset[1]}_${size[0]}_${size[1]}_${size[2]}`
@ -1714,7 +1728,7 @@ function switchBoxUV(state) {
})
}
$('#uv_panel_sides').toggle(!state)
main_uv.setGrid(1).setSize(main_uv.size)
main_uv.setGrid(1).setSize(main_uv.size).displayAllMappingOverlays();
Canvas.updateAllUVs()
}

View File

@ -1092,7 +1092,7 @@
"action.load_plugin_from_url": "Load Plugin from URL",
"action.load_plugin_from_url.desc": "Load a plugin from a server by specifying the URL",
"action.cube_counter.desc": "Displays the current number of cubes and other statistics",
"action.unlock_everything": "Unlock Everything",
"action.unlock_everything": "Unlock All",
"action.unlock_everything.desc": "Unlock all groups and elements in the outliner.",
"action.load_palette": "Load Palette",
"action.load_palette.desc": "Load one of the built-in palette presets",

View File

@ -1092,7 +1092,7 @@
"action.load_plugin_from_url": "Load Plugin from URL",
"action.load_plugin_from_url.desc": "Load a plugin from a server by specifying the URL",
"action.cube_counter.desc": "Displays the current number of cubes and other statistics",
"action.unlock_everything": "Unlock Everything",
"action.unlock_everything": "Unlock All",
"action.unlock_everything.desc": "Unlock all groups and elements in the outliner.",
"action.load_palette": "Load Palette",
"action.load_palette.desc": "Load one of the built-in palette presets",

View File

@ -1092,7 +1092,7 @@
"action.load_plugin_from_url": "Load Plugin from URL",
"action.load_plugin_from_url.desc": "Load a plugin from a server by specifying the URL",
"action.cube_counter.desc": "Displays the current number of cubes and other statistics",
"action.unlock_everything": "Unlock Everything",
"action.unlock_everything": "Unlock All",
"action.unlock_everything.desc": "Unlock all groups and elements in the outliner.",
"action.load_palette": "Load Palette",
"action.load_palette.desc": "Load one of the built-in palette presets",

View File

@ -1092,7 +1092,7 @@
"action.load_plugin_from_url": "Load Plugin from URL",
"action.load_plugin_from_url.desc": "Load a plugin from a server by specifying the URL",
"action.cube_counter.desc": "Displays the current number of cubes and other statistics",
"action.unlock_everything": "Unlock Everything",
"action.unlock_everything": "Unlock All",
"action.unlock_everything.desc": "Unlock all groups and elements in the outliner.",
"action.load_palette": "Load Palette",
"action.load_palette.desc": "Load one of the built-in palette presets",

View File

@ -1092,7 +1092,7 @@
"action.load_plugin_from_url": "Load Plugin from URL",
"action.load_plugin_from_url.desc": "Load a plugin from a server by specifying the URL",
"action.cube_counter.desc": "Displays the current number of cubes and other statistics",
"action.unlock_everything": "Unlock Everything",
"action.unlock_everything": "Unlock All",
"action.unlock_everything.desc": "Unlock all groups and elements in the outliner.",
"action.load_palette": "Load Palette",
"action.load_palette.desc": "Load one of the built-in palette presets",

View File

@ -1092,7 +1092,7 @@
"action.load_plugin_from_url": "Load Plugin from URL",
"action.load_plugin_from_url.desc": "Load a plugin from a server by specifying the URL",
"action.cube_counter.desc": "Displays the current number of cubes and other statistics",
"action.unlock_everything": "Unlock Everything",
"action.unlock_everything": "Unlock All",
"action.unlock_everything.desc": "Unlock all groups and elements in the outliner.",
"action.load_palette": "Load Palette",
"action.load_palette.desc": "Load one of the built-in palette presets",

View File

@ -1092,7 +1092,7 @@
"action.load_plugin_from_url": "Load Plugin from URL",
"action.load_plugin_from_url.desc": "Load a plugin from a server by specifying the URL",
"action.cube_counter.desc": "Displays the current number of cubes and other statistics",
"action.unlock_everything": "Unlock Everything",
"action.unlock_everything": "Unlock All",
"action.unlock_everything.desc": "Unlock all groups and elements in the outliner.",
"action.load_palette": "Load Palette",
"action.load_palette.desc": "Load one of the built-in palette presets",

View File

@ -1092,7 +1092,7 @@
"action.load_plugin_from_url": "Load Plugin from URL",
"action.load_plugin_from_url.desc": "Load a plugin from a server by specifying the URL",
"action.cube_counter.desc": "Displays the current number of cubes and other statistics",
"action.unlock_everything": "Unlock Everything",
"action.unlock_everything": "Unlock All",
"action.unlock_everything.desc": "Unlock all groups and elements in the outliner.",
"action.load_palette": "Load Palette",
"action.load_palette.desc": "Load one of the built-in palette presets",

View File

@ -1092,7 +1092,7 @@
"action.load_plugin_from_url": "Load Plugin from URL",
"action.load_plugin_from_url.desc": "Load a plugin from a server by specifying the URL",
"action.cube_counter.desc": "Displays the current number of cubes and other statistics",
"action.unlock_everything": "Unlock Everything",
"action.unlock_everything": "Unlock All",
"action.unlock_everything.desc": "Unlock all groups and elements in the outliner.",
"action.load_palette": "Load Palette",
"action.load_palette.desc": "Load one of the built-in palette presets",

View File

@ -1092,7 +1092,7 @@
"action.load_plugin_from_url": "Load Plugin from URL",
"action.load_plugin_from_url.desc": "Load a plugin from a server by specifying the URL",
"action.cube_counter.desc": "Displays the current number of cubes and other statistics",
"action.unlock_everything": "Unlock Everything",
"action.unlock_everything": "Unlock All",
"action.unlock_everything.desc": "Unlock all groups and elements in the outliner.",
"action.load_palette": "Load Palette",
"action.load_palette.desc": "Load one of the built-in palette presets",

1941
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
{
"name": "Blockbench",
"description": "Model editing and animation software",
"version": "3.5.1",
"version": "3.5.2",
"license": "MIT",
"author": {
"name": "JannisX11",
@ -80,7 +80,6 @@
"beta": "electron-builder --windows portable"
},
"devDependencies": {
"async": "^2.4.1",
"electron": "8.2.1",
"electron-builder": "^21.2.0"
}