Skip to content

Commit

Permalink
v3.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
JannisX11 committed Dec 17, 2019
1 parent d776c4e commit bdc69c4
Show file tree
Hide file tree
Showing 30 changed files with 449 additions and 369 deletions.
7 changes: 5 additions & 2 deletions css/panels.css
Original file line number Diff line number Diff line change
Expand Up @@ -687,15 +687,18 @@
}
#timeline_body .keyframe {
position: absolute;
margin-left: -11px;
margin-left: -6px;
z-index: 3;
text-align: center;
width: 24px;
width: 13.5px;
height: 22px;
}
#timeline_body .keyframe i {
margin-top: 2px;
transform: rotate(45deg);
font-size: 14pt;
margin-left: -3px;
pointer-events: none;
}
#timeline_body .animator_head_bar .keyframe {
z-index: 1;
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<script>
if (typeof module === 'object') {window.module = module; module = undefined;}//jQuery Fix
const isApp = typeof require !== 'undefined';
const appVersion = '3.2.0';
const appVersion = '3.2.1';
</script>
<script src="lib/vue.min.js"></script>
<script src="lib/vue_sortable.js"></script>
Expand Down Expand Up @@ -481,7 +481,7 @@ <h3 v-on:click="toggleCategory(category)">

<li v-for="(setting, key) in category.items" v-if="Condition(setting.condition)" v-on="setting.click ? {click: setting.click} : {}">
<template v-if="setting.type === 'number'">
<div class="setting_element"><input type="number" v-model.number="setting.value" :min="setting.min" :min="setting.max" :min="setting.step" v-on:input="saveSettings()"></div>
<div class="setting_element"><input type="number" v-model.number="setting.value" :min="setting.min" :max="setting.max" :step="setting.step" v-on:input="saveSettings()"></div>
</template>
<template v-else-if="setting.type === 'click'">
<div class="setting_element setting_icon" v-html="Blockbench.getIconNode(setting.icon).outerHTML"></div>
Expand Down
2 changes: 1 addition & 1 deletion js/display_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,7 @@ class refModel {
}
buildBlock() {
this.buildModel(JSON.parse(`[
{"size": [16,16,16], "pos": [0, 0, 0], "origin": [0, 0, 0], "north":{"uv":[0,0,16,16]},"east":{"uv":[0,0,16,16]},"south":{"uv":[0,0,16,16]},"west":{"uv":[0,0,16,16]},"up":{"uv":[0,0,16,16]},"down":{"uv":[0,0,16,16]}}, //Right Arm
{"size": [16,16,16], "pos": [0, 0, 0], "origin": [0, 0, 0], "north":{"uv":[0,0,16,16]},"east":{"uv":[0,0,16,16]},"south":{"uv":[0,0,16,16]},"west":{"uv":[0,0,16,16]},"up":{"uv":[0,0,16,16]},"down":{"uv":[0,0,16,16]}}
]`), 'assets/missing.png')
}
buildFrame() {
Expand Down
12 changes: 7 additions & 5 deletions js/interface/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ class BarSelect extends Widget {
index++;
}
if (index >= 0 && index < this.values.length) {
this.set(this.values[index])
this.set(this.values[index]).change(event);
}

scope.uses++;
Expand All @@ -711,17 +711,19 @@ class BarSelect extends Widget {
return false;
}
change(event) {
this.set( $(event.target).find('option:selected').prop('id') )
this.set( $(event.target).find('option:selected').prop('id') );
if (this.onChange) {
this.onChange(this, event)
this.onChange(this, event);
}
return this;
}
set(id) {
this.value = id
$(this.nodes).find('option#'+id).prop('selected', true).siblings().prop('selected', false)
$(this.nodes).find('option#'+id).prop('selected', true).siblings().prop('selected', false);
return this;
}
get() {
return this.value
return this.value;
}
}
class BarText extends Widget {
Expand Down
42 changes: 31 additions & 11 deletions js/interface/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,14 @@ class Setting {
})

}

}
delete() {
if (settings[this.id]) {
delete settings[this.id];
}
if (Settings.structure[this.category] && Settings.structure[this.category].items[this.id]) {
delete Settings.structure[this.category].items[this.id];
}
}
}

Expand Down Expand Up @@ -89,6 +96,9 @@ const Settings = {
new Setting('undo_limit', {category: 'edit', value: 256, type: 'number'});
new Setting('local_move', {category: 'edit', value: true});
new Setting('canvas_unselect', {category: 'edit', value: false});
new Setting('highlight_cubes', {category: 'edit', value: true, onChange() {
updateCubeHighlights();
}});
new Setting('deactivate_size_limit',{category: 'edit', value: false});

//Grid
Expand All @@ -111,12 +121,12 @@ const Settings = {
new Setting('brush_opacity_modifier', {category: 'paint', value: 'pressure', type: 'select', options: {
'pressure': tl('settings.brush_modifier.pressure'),
'tilt': tl('settings.brush_modifier.tilt'),
'none': tl('generic.none'),
'none': tl('settings.brush_modifier.none'),
}});
new Setting('brush_size_modifier', {category: 'paint', value: 'tilt', type: 'select', options: {
'pressure': tl('settings.brush_modifier.pressure'),
'tilt': tl('settings.brush_modifier.tilt'),
'none': tl('generic.none'),
'none': tl('settings.brush_modifier.none'),
}});
new Setting('image_editor', {category: 'paint', value: false, type: 'click', condition: isApp, icon: 'fas.fa-pen-square', click: function() {changeImageEditor(null, true) }});

Expand All @@ -139,7 +149,14 @@ const Settings = {
}});
new Setting('sketchfab_token', {category: 'export', value: '', type: 'text'});
new Setting('credit', {category: 'export', value: 'Made with Blockbench', type: 'text'});

},
addCategory(id, data) {
if (!data) data = 0;
Settings.structure[id] = {
name: data.name || tl('settings.category.'+id),
open: data.open != undefined ? !!data.open : id === 'general',
items: {}
}
},
open() {
for (var sett in settings) {
Expand Down Expand Up @@ -232,19 +249,22 @@ const Settings = {
structure.search_results.hidden = true;
}
},
get(id) {
if (id && settings[id]) {
return settings[id].value;
}
},
old: {}
}
$(window).on('unload', Settings.saveLocalStorages)
Settings.setup()

onVueSetup(function() {
Settings.structure = {
search_results: {
name: tl('dialog.settings.search_results'),
hidden: true,
open: true,
items: {}
}
Settings.structure.search_results = {
name: tl('dialog.settings.search_results'),
hidden: true,
open: true,
items: {}
}
for (var key in settings) {
var category = settings[key].category
Expand Down
1 change: 0 additions & 1 deletion js/interface/themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ const CustomTheme = {
var hex = CustomTheme.data.colors[scope_key];
var last_color = hex;
var field = wrapper.find('#color_field_'+scope_key);
console.log(field);

field.spectrum({
preferredFormat: "hex",
Expand Down
1 change: 0 additions & 1 deletion js/io/bedrock.js
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,6 @@ var format = new ModelFormat({
centered_grid: true,
animation_mode: true,
locators: true,
outliner_name_pattern: 'a-zA-Z0-9_',
codec,
onActivation: function () {

Expand Down
39 changes: 24 additions & 15 deletions js/io/java_block.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ var codec = new Codec('java_block', {
if (s.faces[face].texture !== null) {
var tag = new oneLiner()
if (s.faces[face].enabled !== false) {
tag.uv = s.faces[face].uv
tag.uv = s.faces[face].uv.slice();
tag.uv.forEach((n, i) => {
tag.uv[i] = n * 16 / main_uv.getResolution(i%2);
})
}
if (s.faces[face].rotation) {
tag.rotation = s.faces[face].rotation
Expand Down Expand Up @@ -296,25 +299,31 @@ var codec = new Codec('java_block', {
if (obj.__comment) base_cube.name = obj.__comment
//Faces
var uv_stated = false;
for (var face in base_cube.faces) {
if (obj.faces[face] === undefined) {
for (var key in base_cube.faces) {
var read_face = obj.faces[key];
var new_face = base_cube.faces[key];
if (read_face === undefined) {

base_cube.faces[face].texture = null
base_cube.faces[face].uv = [0,0,0,0]
new_face.texture = null
new_face.uv = [0,0,0,0]
} else {
if (typeof obj.faces[face].uv === 'object') {
if (typeof read_face.uv === 'object') {
uv_stated = true

new_face.uv.forEach((n, i) => {
new_face.uv[i] *= main_uv.getResolution(i%2) / 16;
})
}
if (obj.faces[face].texture === '#missing') {
base_cube.faces[face].texture = false;
if (read_face.texture === '#missing') {
new_face.texture = false;

} else if (obj.faces[face].texture) {
var id = obj.faces[face].texture.replace(/^#/, '')
} else if (read_face.texture) {
var id = read_face.texture.replace(/^#/, '')
var t = texture_ids[id]

if (t instanceof Texture === false) {
if (texture_paths[obj.faces[face].texture]) {
var t = texture_paths[obj.faces[face].texture]
if (texture_paths[read_face.texture]) {
var t = texture_paths[read_face.texture]
if (t.id === 'particle') {
t.extend({id: id, name: '#'+id}).loadEmpty(3)
}
Expand All @@ -324,10 +333,10 @@ var codec = new Codec('java_block', {
new_textures.push(t);
}
}
base_cube.faces[face].texture = t.uuid;
new_face.texture = t.uuid;
}
if (obj.faces[face].tintindex !== undefined) {
base_cube.faces[face].tint = true;
if (read_face.tintindex !== undefined) {
new_face.tint = true;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion js/outliner/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ class Group extends OutlinerElement {
Group.prototype.type = 'group';
Group.prototype.icon = 'fa fa-folder';
Group.prototype.isParent = true;
Group.prototype.name_regex = 'a-zA-Z0-9_'
Group.prototype.name_regex = () => Format.bone_rig ? 'a-zA-Z0-9_' : false;
Group.prototype.buttons = [
Outliner.buttons.remove,
Outliner.buttons.visibility,
Expand Down
28 changes: 12 additions & 16 deletions js/outliner/outliner.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,18 @@ class OutlinerElement {
return this;
}
sanitizeName() {
if (this.name_regex) {
var name_regex = typeof this.name_regex == 'function' ? this.name_regex(this) : this.name_regex;
var regex = new RegExp(`[^${name_regex}]`);
this.name = this.name.replace(regex, '');
var name_regex = typeof this.name_regex == 'function' ? this.name_regex(this) : this.name_regex;
if (name_regex) {
var regex = new RegExp(`[^${name_regex}]`, 'g');
this.name = this.name.replace(regex, c => {
if (c == '-' && '_'.search(regex) == -1) {
return '_';
}
if (c.toLowerCase().search(regex) == -1) {
return c.toLowerCase();
}
return '';
});
}
}
createUniqueName(arr) {
Expand All @@ -263,18 +271,6 @@ class OutlinerElement {
others.safePush(g)
})
}
if (Format.outliner_name_pattern) {
var rgx = new RegExp(`[^${Format.outliner_name_pattern}]`, 'g');
this.name = this.name.replace(rgx, c => {
if (c == '-' && '_'.search(rgx) == -1) {
return '_';
}
if (c.toLowerCase().search(rgx) == -1) {
return c.toLowerCase();
}
return '';
})
}
var name = this.name.replace(/\d+$/, '').replace(/\s+/g, '_');
function check(n) {
for (var i = 0; i < others.length; i++) {
Expand Down
10 changes: 7 additions & 3 deletions js/plugin_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,13 @@ class Plugin {
}
uninstall() {
var scope = this;
this.unload();
if (this.onuninstall) {
this.onuninstall()
try {
this.unload();
if (this.onuninstall) {
this.onuninstall();
}
} catch (err) {
console.log('Error in unload or uninstall method: ', err);
}
delete Plugins.registered[this.id];
Plugins.installed.remove(this.fromFile ? this.path : this.id);
Expand Down
2 changes: 1 addition & 1 deletion js/preview/OrbitControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ THREE.OrbitControls = function ( object, preview ) {

//if ( scope.enableRotate === false ) return;

if (event.touches[0].touchType == 'stylus') return;
if (event.touches[0].touchType == 'stylus' && Modes.paint) return;

handleTouchStartRotate( event );

Expand Down
6 changes: 4 additions & 2 deletions js/preview/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ const Canvas = {
if (display_mode && ground_animation) {
ground_animation = false
}
updateCubeHighlights(null, true);

cb()

Expand All @@ -111,6 +112,7 @@ const Canvas = {
if (display_mode && ground_anim_before) {
ground_animation = ground_anim_before
}
updateCubeHighlights();
},
//Main updaters
clear() {
Expand Down Expand Up @@ -768,7 +770,7 @@ const Canvas = {
if (step < epsilon) step = epsilon;

for (var col = start[0] - uv_offset[0]; col <= end[0]; col += step) {
if (col > start[0]) {
if (col >= start[0]) {
addVector(col, start[1], axis, w);
addVector(col, end[1], axis, w);
}
Expand All @@ -782,7 +784,7 @@ const Canvas = {
if (step < epsilon) step = epsilon;

for (var line = start[1] - uv_offset[1]; line <= end[1]; line += step) {
if (line > start[1]) {
if (line >= start[1]) {
addVector(start[0], line, axis, w);
addVector(end[0], line, axis, w);
}
Expand Down
Loading

0 comments on commit bdc69c4

Please sign in to comment.