Skip to content

Commit

Permalink
v3.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
JannisX11 committed Apr 29, 2020
1 parent ae75a1f commit 41abfda
Show file tree
Hide file tree
Showing 23 changed files with 101 additions and 2,016 deletions.
28 changes: 20 additions & 8 deletions css/panels.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 2 additions & 1 deletion js/animations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 6 additions & 4 deletions js/interface/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand All @@ -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') {
Expand All @@ -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)
}
})
Expand Down
7 changes: 7 additions & 0 deletions js/io/bedrock.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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;
}
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions js/io/gltf.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function() {

function buildAnimationTracks() {
let tracks = [];
let anims = [];
Animator.animations.forEach(animation => {

let tracks = [];
Expand Down Expand Up @@ -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', {
Expand All @@ -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});
Expand Down
46 changes: 21 additions & 25 deletions js/io/modded_entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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;


Expand Down
6 changes: 1 addition & 5 deletions js/outliner/cube.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
Expand Down
6 changes: 3 additions & 3 deletions js/plugin_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
8 changes: 4 additions & 4 deletions js/texturing/texture_generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand Down
Loading

0 comments on commit 41abfda

Please sign in to comment.