Skip to content

Commit

Permalink
v3.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
JannisX11 committed May 31, 2020
1 parent 41abfda commit 6a4d37e
Show file tree
Hide file tree
Showing 38 changed files with 1,644 additions and 1,420 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/dist/
index.php
package-lock.json
node_modules/
5 changes: 4 additions & 1 deletion css/window.css
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,11 @@
margin-left: auto;
}
#windows_window_menu li {
display: inline-block;
display: block;
width: 42px;
height: 100%;
text-align: center;
float: left;
}
#windows_window_menu li:hover {
color: var(--color-light);
Expand Down Expand Up @@ -390,6 +391,7 @@
}
#start_screen .recent_project_date {
flex-shrink: 0;
position: relative;
}
span.recent_project_date:before {
content: "";
Expand Down Expand Up @@ -468,6 +470,7 @@
}
#start_screen right {
flex-grow: 1;
width: 62%;
}
#start_screen i.start_screen_close_button {
position: absolute;
Expand Down
4 changes: 2 additions & 2 deletions 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.2';
const appVersion = '3.5.3';
</script>
<div id="loading_error_message" style="display: none;">
<div>An error occurred while loading Blockbench</div>
Expand Down Expand Up @@ -197,7 +197,7 @@ <h1></h1>
</div>
<div class="edit_session_inactive">
<p class="tl">edit_session.about</p>
<p>This feature is in BETA. Bugs may occur while using it.</p>
<p>This feature is in BETA. Bugs may occur while using it. The connection server is currently unstable, please check <a href="https://github.com/JannisX11/blockbench/issues/641">Issue #641</a> for status updates.</p>
</div>
<div class="edit_session_active hidden">
<p><b class="tl">edit_session.status</b>: <span class="tl" id="edit_session_status">edit_session.connected</span></p>
Expand Down
15 changes: 11 additions & 4 deletions js/animations.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,9 +551,9 @@ class BoneAnimator extends GeneralAnimator {
displayPosition(arr) {
var bone = this.group.mesh
if (arr) {
var offset = new THREE.Vector3().fromArray(arr);
offset.x *= -1;
bone.position.add(offset)
bone.position.x += -arr[0];
bone.position.y += arr[1];
bone.position.z += arr[2];
}
return this;
}
Expand Down Expand Up @@ -1045,6 +1045,7 @@ class Keyframe {
$('#keyframe_bar_x, #keyframe_bar_y, #keyframe_bar_z, #keyframe_bar_w').hide()
}
BARS.updateConditions()
Blockbench.dispatchEvent('update_keyframe_selection');
}
function selectAllKeyframes() {
if (!Animator.selected) return;
Expand Down Expand Up @@ -1534,9 +1535,15 @@ const Timeline = {
kf.selected = false;
if (kf.time > min_time &&
kf.time < max_time &&
(kf.channel == focus || !focus)
(kf.channel == focus || !focus || focus == 'used')
) {
var channel_index = focus ? 0 : animator.channels.indexOf(kf.channel);
if (focus == 'used') {
for (var channel of animator.channels) {
if (kf.channel == channel) break;
channel_index++;
}
}
height = offset + channel_index*24 + 36;
if (height > rect.ay && height < rect.by) {
kf.selected = true;
Expand Down
1 change: 1 addition & 0 deletions js/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ const Blockbench = {
this.events[event_name] = []
}
this.events[event_name].safePush(cb)
return Blockbench;
},
on(event_name, cb) {
return Blockbench.addListener(event_name, cb)
Expand Down
5 changes: 4 additions & 1 deletion js/edit_sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const EditSession = {
Prop.session = true;
EditSession.setState(true);

var client = EditSession.self = new EditSession.Client({
EditSession.self = new EditSession.Client({
id: EditSession.peer.id,
name: EditSession.username,
hosting: true
Expand Down Expand Up @@ -52,6 +52,9 @@ const EditSession = {
})
})
})
peer.on('error', error => {
console.log('Error creating edit session:', error)
})
},
join() {
if (EditSession.active) return;
Expand Down
10 changes: 7 additions & 3 deletions js/interface/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ class NumSlider extends Widget {
}
scope.sliding = true;
scope.pre = 0;
scope.left = ui.position.left
scope.sliding_start_pos = event.clientX;
scope.last_value = scope.value
},
drag: function(event, ui) {
Expand Down Expand Up @@ -519,7 +519,7 @@ class NumSlider extends Widget {
}
}
slide(event, ui) {
var offset = Math.round((event.clientX-this.left)/30)-1
var offset = Math.round((event.clientX - this.sliding_start_pos)/30)
var difference = (offset - this.pre) * this.getInterval(event);
this.pre = offset;

Expand Down Expand Up @@ -803,11 +803,15 @@ class BarSelect extends Widget {
let val = this.options[key];
let name = tl(val === true || (val && val.name === true)
? ('action.'+this.id+'.'+key)
: (val.name || val)
: ((val && val.name) || val)
);
return name;
}
set(key) {
if (this.options[key] == undefined) {
console.warn(`Option ${key} does not exist in BarSelect ${this.id}`)
return this;
}
this.value = key;
let name = this.getNameFor(key);
$(this.node).find('bb-select').text(name)
Expand Down
17 changes: 17 additions & 0 deletions js/interface/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,23 @@ const Settings = {
new Setting('shading', {category: 'preview', value: true, onChange() {
setShading()
}});
new Setting('render_sides', {category: 'preview', value: 'auto', type: 'select', options: {
'auto': tl('settings.render_sides.auto'),
'front': tl('settings.render_sides.front'),
'double': tl('settings.render_sides.double'),
}, onChange() {
Canvas.updateRenderSides();
}});
/*
new Setting('transparency', {category: 'preview', value: true, onChange() {
for (var uuid in Canvas.materials) {
let material = Canvas.materials[uuid]
if (material instanceof THREE.Material) {
material.transparent = settings.transparency.value
}
}
}});
*/
new Setting('texture_fps', {category: 'preview', value: 2, type: 'number', onChange() {
TextureAnimator.updateSpeed()
}});
Expand Down
3 changes: 3 additions & 0 deletions js/io/io.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ class ModelFormat {
updateSelection()
EditSession.initNewModel()
}
delete() {
delete Formats[this.id];
}
}
const Codecs = {};
class Codec {
Expand Down
17 changes: 8 additions & 9 deletions js/io/modded_entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,11 @@ var codec = new Codec('modded_entity', {
if (cube.parent == 'root') loose_cubes.push(cube)
})
if (loose_cubes.length) {
all_groups.push({
all_groups.push(new Group({
name: 'bb_main',
rotation: [0, 0, 0],
origin: [0, 0, 0],
parent: 'root',
children: loose_cubes
})
children: loose_cubes,
is_catch_bone: true
}))
}

let model = Templates.get('file');
Expand All @@ -193,7 +191,7 @@ var codec = new Codec('modded_entity', {
model = model.replace(R('fields'), () => {
let group_snippets = [];
for (var group of all_groups) {
if (group instanceof Group === false || !group.export) continue;
if ((group instanceof Group === false && !group.is_catch_bone) || !group.export) continue;
let snippet = Templates.get('field')
.replace(R('bone'), group.name)
group_snippets.push(snippet);
Expand All @@ -206,7 +204,7 @@ var codec = new Codec('modded_entity', {
let group_snippets = [];
for (var group of all_groups) {

if (group instanceof Group === false || !group.export) continue;
if ((group instanceof Group === false && !group.is_catch_bone) || !group.export) continue;
let snippet = Templates.get('bone')

.replace(R('bone'), group.name)
Expand Down Expand Up @@ -294,7 +292,7 @@ var codec = new Codec('modded_entity', {
model = model.replace(R('renderers'), () => {
let group_snippets = [];
for (var group of all_groups) {
if (group instanceof Group === false || !group.export) continue;
if ((group instanceof Group === false && !group.is_catch_bone) || !group.export) continue;
if (!Templates.get('render_subgroups') && group.parent instanceof Group) continue;

let snippet = Templates.get('renderer')
Expand Down Expand Up @@ -613,6 +611,7 @@ var codec = new Codec('modded_entity', {
}
}
})
Project.geometry_name = geo_name;
Canvas.updateAll();
},
fileName() {
Expand Down
2 changes: 1 addition & 1 deletion js/io/optifine_jem.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ var format = new ModelFormat({
centered_grid: true,
codec
})
Object.defineProperty(format, 'integer_size', {get: _ => Format.box_uv})
Object.defineProperty(format, 'integer_size', {get: _ => Project.box_uv})
codec.format = format;


Expand Down
5 changes: 3 additions & 2 deletions js/io/optifine_jpm.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var part_codec = new Codec('optifine_part', {
if (s.export === false) return;
var box = {};
var originalOrigin = s.origin.slice();
s.transferOrigin([0, 0, 0])
s.transferOrigin([0, 0, 0], false)
box.coordinates = [
-s.to[0],
-s.from[1] - s.size(1),
Expand Down Expand Up @@ -58,7 +58,7 @@ var part_codec = new Codec('optifine_part', {
} else {
boxes.push(box)
}
s.transferOrigin(originalOrigin)
s.transferOrigin(originalOrigin, false)
})
if (boxes.length) {
jpm.boxes = boxes
Expand Down Expand Up @@ -220,6 +220,7 @@ var part_format = new ModelFormat({
optional_box_uv: true,
codec: part_codec
})
Object.defineProperty(part_format, 'integer_size', {get: _ => Project.box_uv})
part_codec.format = part_format;


Expand Down
20 changes: 11 additions & 9 deletions js/outliner/cube.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Face {
} else if (typeof object.texture === 'string') {
Merge.string(this, object, 'texture')
}
Merge.string(this, object, 'cullface')
Merge.string(this, object, 'cullface', (val) => uv_dialog.allFaces.includes(val))
Merge.number(this, object, 'rotation')
Merge.number(this, object, 'tint')
if (object.uv) {
Expand Down Expand Up @@ -186,7 +186,7 @@ class Cube extends NonGroup {
Merge.number(this.origin, object.origin, 2)
}
Merge.boolean(this, object, 'rescale')
Merge.string(this, object, 'rotation_axis')
Merge.string(this, object, 'rotation_axis', (v) => (v === 'x' || v === 'y' || v === 'z'))
if (object.faces) {
for (var face in this.faces) {
if (this.faces.hasOwnProperty(face) && object.faces.hasOwnProperty(face)) {
Expand Down Expand Up @@ -476,7 +476,7 @@ class Cube extends NonGroup {
Canvas.adaptObjectFaces(this)
Canvas.updateUV(this)
}
transferOrigin(origin) {
transferOrigin(origin, update = true) {
if (!this.mesh) return;
var q = new THREE.Quaternion().copy(this.mesh.quaternion)
var shift = new THREE.Vector3(
Expand All @@ -488,8 +488,8 @@ class Cube extends NonGroup {
dq.applyQuaternion(q)
shift.sub(dq)
shift.applyQuaternion(q.inverse())

this.moveVector(shift)
this.moveVector(shift, null, update)

this.origin.V3_set(origin);

Expand Down Expand Up @@ -559,7 +559,6 @@ class Cube extends NonGroup {
var all_faces = ['north', 'south', 'west', 'east', 'up', 'down']
all_faces.forEach(function(side) {
var uv = scope.faces[side].uv.slice()
var texture = scope.faces[side]
switch (side) {
case 'north':
uv = [
Expand Down Expand Up @@ -610,6 +609,7 @@ class Cube extends NonGroup {
];
break;
}
//var texture = scope.faces[side]
//var fr_u = 16 / Project.texture_width;
//var fr_v = 16 / Project.texture_height;
//uv.forEach(function(s, uvi) {
Expand Down Expand Up @@ -667,7 +667,7 @@ class Cube extends NonGroup {
Canvas.updateUV(scope)
}
}
moveVector(arr, axis) {
moveVector(arr, axis, update = true) {
if (typeof arr == 'number') {
var n = arr;
arr = [0, 0, 0];
Expand All @@ -690,8 +690,10 @@ class Cube extends NonGroup {
scope.from[i] += val;
scope.to[i] += val;
})
this.mapAutoUV()
Canvas.adaptObjectPosition(this);
if (update) {
this.mapAutoUV()
Canvas.adaptObjectPosition(this);
}
TickUpdates.selection = true;
return in_box;
}
Expand Down
3 changes: 2 additions & 1 deletion js/outliner/outliner.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ class OutlinerElement {
others.safePush(g)
})
}
let zero_based = this.name.match(/[^\d]0$/) !== null;
var name = this.name.replace(/\d+$/, '').replace(/\s+/g, '_');
function check(n) {
for (var i = 0; i < others.length; i++) {
Expand All @@ -305,7 +306,7 @@ class OutlinerElement {
if (check(this.name)) {
return this.name;
}
for (var num = 2; num < 8e3; num++) {
for (var num = zero_based ? 1 : 2; num < 8e3; num++) {
if (check(name+num)) {
scope.name = name+num;
return scope.name;
Expand Down
2 changes: 1 addition & 1 deletion js/preview/OrbitControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ THREE.OrbitControls = function ( object, preview ) {

case 1: // one-fingered touch: rotate

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

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

Expand Down
Loading

0 comments on commit 6a4d37e

Please sign in to comment.