Skip to content

Commit

Permalink
v3.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
JannisX11 committed Jul 26, 2019
1 parent ae6a261 commit fd3085b
Show file tree
Hide file tree
Showing 26 changed files with 139 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[!] Before you report an issue, check if if has already been reported. Also check if you are using the latest version of Blockbench.
[!] Prefix the title if your issue with [Issue] or [Suggestion]
[!] Prefix the title of your issue with [Issue] or [Suggestion]
[!] If you are having an issue, please press "Ctrl + Shift + i" and click on console. If there are any error messages, please attach a screenshot of it to your issue.

Supply the following information:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/dist/
index.php
package-lock.json
2 changes: 1 addition & 1 deletion css/panels.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*Layout*/
#page_wrapper {
display: grid;
grid-template-columns: 332px auto 300px;
grid-template-columns: 332px auto 314px;
grid-template-rows: 30px minmax(200px, 5000px) 26px;
grid-template-areas:
"left_bar toolbar toolbar"
Expand Down
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#181a1f">
<meta name="robots" content="noindex">
<link rel="manifest" href="manifest.json">
<!--link rel="manifest" href="manifest.json"-->
<link rel="shortcut icon" href="favicon.png" type="image/x-icon" />
<link rel="stylesheet" href="css/w3.css">
<link rel="stylesheet" href="css/jquery-ui.min.css">
Expand All @@ -27,7 +27,7 @@
<script>
if (typeof module === 'object') {window.module = module; module = undefined;}//jQuery Fix
const isApp = typeof require !== 'undefined';
const appVersion = '3.0.3';
const appVersion = '3.0.4';
</script>
<script src="lib/vue.min.js"></script>
<script src="lib/vue_sortable.js"></script>
Expand Down Expand Up @@ -1036,7 +1036,7 @@ <h2 class="tl i_b">dialog.settings.about</h2>
<left>
<h2 class="tl">mode.start.new</h2>
<ul>
<li v-for="format in formats" v-if="format.allow_new" v-on:click="newProject(format)">
<li v-for="format in formats" v-if="format.show_on_start_screen" v-on:click="format.new()">
<span class="icon_wrapper f_left" v-html="Blockbench.getIconNode(format.icon).outerHTML"></span>
<h3>{{ format.name }}</h3>
<p>{{ format.description }}</p>
Expand Down
4 changes: 2 additions & 2 deletions js/animations.js
Original file line number Diff line number Diff line change
Expand Up @@ -1268,10 +1268,10 @@ Molang.global_variables = {
get 'query.anim_time'() {
return Timeline.second;
},
get 'global.anim_time'() {
get 'query.life_time'() {
return Timeline.second;
},
get 'query.life_time'() {
get 'time'() {
return Timeline.second;
}
}
Expand Down
5 changes: 3 additions & 2 deletions js/blockbench.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ function updateSelection() {
$('.selection_only').css('visibility', 'visible')
} else {
if (Format.bone_rig && Group.selected) {
$('.selection_only').css('visibility', 'visible')
$('.selection_only').css('visibility', 'hidden')
$('.selection_only#element').css('visibility', 'visible')
} else {
$('.selection_only').css('visibility', 'hidden')
if (Locator.selected.length) {
Expand Down Expand Up @@ -697,7 +698,7 @@ const Clipbench = {
var img = clipboard.readImage()
if (img) {
var dataUrl = img.toDataURL()
var texture = new Texture({name: 'pasted', folder: 'blocks' }).fromDataURL(dataUrl).fillParticle().add(true)
var texture = new Texture({name: 'pasted', folder: 'block' }).fromDataURL(dataUrl).fillParticle().add(true)
setTimeout(function() {
texture.openMenu()
},40)
Expand Down
2 changes: 1 addition & 1 deletion js/edit_sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ EditSession.Client = class {
this.conn.close()
console.error(e)
})
Blockbench.dispatchEvent('user_joins_session', {conn: this.conn})
Blockbench.dispatchEvent('user_joins_session', this)
}
}
send(tag) {
Expand Down
2 changes: 1 addition & 1 deletion js/interface/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1379,7 +1379,7 @@ const BARS = {
default_place: !Blockbench.isMobile
})
//3.0.3 update
if (Toolbars.element_size.children.includes(BarItems.slider_inflate)) {
if (!Toolbars.element_size.children.includes(BarItems.slider_inflate)) {
Toolbars.element_size.add(BarItems.slider_inflate, -1);
}
Toolbars.element_origin = new Toolbar({
Expand Down
4 changes: 2 additions & 2 deletions js/interface/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class ResizeLine {
var Interface = {
default_data: {
left_bar_width: 332,
right_bar_width: 300,
right_bar_width: 314,
quad_view_x: 50,
quad_view_y: 50,
left_bar: ['uv', 'textures', 'display', 'animations', 'keyframe', 'variable_placeholders'],
Expand All @@ -180,7 +180,7 @@ var Interface = {
condition: function() {
var i = 0;
Interface.data.left_bar.forEach(p => {
if (BARS.condition(Interface.Panels[p].condition)) {i++;}
if (Interface.Panels[p] && BARS.condition(Interface.Panels[p].condition)) {i++;}
})
return i;
},
Expand Down
2 changes: 1 addition & 1 deletion js/interface/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ const MenuBar = {
icon: format.icon,
description: format.description,
click: (e) => {
newProject(format)
format.new()
}
})
})()
Expand Down
2 changes: 1 addition & 1 deletion js/io/bedrock.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ var codec = new Codec('bedrock', {
var bones = []
var visible_box = new THREE.Box3()

var groups = Group.all.slice()
var groups = getAllGroups();
var loose_cubes = [];
Outliner.root.forEach(obj => {
if (obj.type === 'cube') {
Expand Down
20 changes: 18 additions & 2 deletions js/io/bedrock_old.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ function parseGeometry(data) {
cg.addTo(group)
})
}
if (b.locators) {
for (var key in b.locators) {
var coords = b.locators[key];
coords[0] *= -1
var locator = new Locator({from: coords, name: key}).addTo(group).init();
}
}
var parent_group = 'root';
if (b.parent) {
if (bones[b.parent]) {
Expand Down Expand Up @@ -122,7 +129,7 @@ var codec = new Codec('bedrock_old', {
var cube_count = 0;
var visible_box = new THREE.Box3()

var groups = Group.all.slice()
var groups = getAllGroups();
var loose_cubes = [];
Outliner.root.forEach(obj => {
if (obj.type === 'cube') {
Expand Down Expand Up @@ -167,6 +174,7 @@ var codec = new Codec('bedrock_old', {
}
//Cubes
var cubes = []
var locators = {};

for (var obj of g.children) {
if (obj.export) {
Expand All @@ -191,12 +199,19 @@ var codec = new Codec('bedrock_old', {
cubes.push(cube)
cube_count++;

} else if (obj instanceof Locator) {

locators[obj.name] = obj.from.slice();
locators[obj.name][0] *= -1;
}
}
}
if (cubes.length) {
bone.cubes = cubes
}
if (Object.keys(locators).length) {
bone.locators = locators
}
bones.push(bone)
})

Expand Down Expand Up @@ -477,11 +492,12 @@ var format = new ModelFormat({
id: 'bedrock_old',
extension: 'json',
icon: 'icon-format_bedrock',
allow_new: false,
show_on_start_screen: false,
box_uv: true,
single_texture: true,
bone_rig: true,
animation_mode: true,
locators: true,
codec,
onActivation: function () {

Expand Down
42 changes: 26 additions & 16 deletions js/io/io.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ModelFormat {
this.id = data.id;
this.name = tl('format.'+this.id);
this.description = tl('format.'+this.id+'.desc');
this.allow_new = true;
this.show_on_start_screen = true;

this.box_uv = false;
this.optional_box_uv = false;
Expand All @@ -40,7 +40,7 @@ class ModelFormat {
this.onActivation = data.onActivation;
this.onDeactivation = data.onDeactivation;
Merge.string(this, data, 'icon');
Merge.boolean(this, data, 'allow_new');
Merge.boolean(this, data, 'show_on_start_screen');

Merge.boolean(this, data, 'box_uv');
Merge.boolean(this, data, 'optional_box_uv');
Expand Down Expand Up @@ -72,17 +72,22 @@ class ModelFormat {
} else {
scene.position.set(-8, -8, -8);
}
/*
var center = Format.bone_rig ? -8 : 0;
var center = Format.bone_rig ? 8 : 0;
previews.forEach(preview => {
preview.controls.target.set(center, -3, center);
preview.controls.target.set(0, center, 0);
preview.camOrtho.position.add(preview.controls.target);
})*/
BARS.updateConditions()
})
updateSelection()
Modes.vue.$forceUpdate()
Canvas.updateRenderSides()
return this;
}
new() {
if (newProject(this)) {
BarItems.project_window.click();
return true;
}
}
convertTo() {

Undo.history.length = 0;
Expand Down Expand Up @@ -278,12 +283,7 @@ class Codec {
}
afterSave(path) {
var name = pathToName(path, true)
if (this.remember) {
addRecentProject({
name,
path: path,
icon: this.id == 'project' ? 'icon-blockbench_file' : Format.icon
});
if (Format.codec == this || this.id == 'project') {
if (this.id == 'project') {
ModelMeta.save_path = path;
} else {
Expand All @@ -292,6 +292,13 @@ class Codec {
ModelMeta.name = pathToName(path, false);
Prop.project_saved = true;
}
if (this.remember) {
addRecentProject({
name,
path: path,
icon: this.id == 'project' ? 'icon-blockbench_file' : Format.icon
});
}
Blockbench.showQuickMessage(tl('message.save_file', [name]));
}
}
Expand Down Expand Up @@ -387,7 +394,9 @@ function setupDragHandlers() {
)
}
function loadModelFile(file) {
if (newProject()) {
if (showSaveDialog()) {
resetProject();

var extension = pathToExtension(file.path);
var model = autoParseJSON(file.content);
if (extension == 'bbmodel') {
Expand Down Expand Up @@ -827,7 +836,7 @@ BARS.defineActions(function() {
parent: {label: 'dialog.project.parent', value: Project.parent, condition: !Format.bone_rig},
geometry_name: {label: 'dialog.project.geoname', value: Project.geometry_name, condition: Format.bone_rig},
ambientocclusion: {label: 'dialog.project.ao', type: 'checkbox', value: Project.ambientocclusion, condition: !Format.bone_rig},
box_uv: {label: 'dialog.project.box_uv', type: 'checkbox', value: Project.box_uv},
box_uv: {label: 'dialog.project.box_uv', type: 'checkbox', value: Project.box_uv, condition: Format.optional_box_uv},
texture_width: {
label: 'dialog.project.width',
type: 'number',
Expand All @@ -851,8 +860,9 @@ BARS.defineActions(function() {
save = Undo.initEdit({uv_mode: true})
Project.texture_width = formResult.texture_width;
Project.texture_height = formResult.texture_height;
Project.box_uv = formResult.box_uv;
if (Format.optional_box_uv) Project.box_uv = formResult.box_uv;
Canvas.updateAllUVs()
updateSelection()
}

Project.name = formResult.name;
Expand Down
2 changes: 1 addition & 1 deletion js/io/modded_entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var codec = new Codec('modded_entity', {

var bone_nr = 1
var model_id = Project.geometry_name;
var all_groups = Group.all.slice()
var all_groups = getAllGroups()
var renderers = {}

var loose_cubes = []
Expand Down
7 changes: 6 additions & 1 deletion js/outliner/cube.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ class Cube extends NonGroup {
}
}
copy.uuid = this.uuid
copy.type = this.type;
delete copy.parent;
return copy;
}
Expand Down Expand Up @@ -702,11 +703,15 @@ class Cube extends NonGroup {
var pos = limitToBox(val + this.from[axis] + before);
if (pos >= this.from[axis] || settings.negative_size.value || allow_negative) {
this.to[axis] = pos;
} else {
this.to[axis] = this.from[axis];
}
} else {
var pos = limitToBox(val + this.to[axis] - before);
if (pos <= this.to[axis] || settings.negative_size.value || allow_negative) {
this.from[axis] = pos;
} else {
this.from[axis] = this.to[axis];
}
}
this.mapAutoUV();
Expand Down Expand Up @@ -739,7 +744,7 @@ class Cube extends NonGroup {
{icon: 'bubble_chart', color: cubeColors[6].hex, name: 'cube.color.'+cubeColors[6].name, click: function(cube) {cube.forSelected(function(obj){obj.setColor(6)}, 'change color')}},
{icon: 'bubble_chart', color: cubeColors[7].hex, name: 'cube.color.'+cubeColors[7].name, click: function(cube) {cube.forSelected(function(obj){obj.setColor(7)}, 'change color')}}
]},
{name: 'menu.cube.texture', icon: 'collections', condition: function() {return !Project.box_uv}, children: function() {
{name: 'menu.cube.texture', icon: 'collections', condition: () => !Project.single_texture, children: function() {
var arr = [
{icon: 'crop_square', name: 'menu.cube.texture.blank', click: function(cube) {
cube.forSelected(function(obj) {
Expand Down
24 changes: 18 additions & 6 deletions js/outliner/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,19 @@ function getCurrentGroup() {
}
}
}
function getAllGroups() {
var ta = []
function iterate(array) {
for (var obj of array) {
if (obj instanceof Group) {
ta.push(obj)
iterate(obj.children)
}
}
}
iterate(Outliner.root)
return ta;
}
function addGroup() {
Undo.initEdit({outliner: true});
var add_group = Group.selected
Expand All @@ -460,12 +473,11 @@ function addGroup() {
if (Format.bone_rig) {
base_group.createUniqueName()
}
selected.forEach(function(s, i) {
s.addTo(base_group)
if (i === 0) {
//s.selected = false
}
})
if (add_group instanceof NonGroup) {
selected.forEach(function(s, i) {
s.addTo(base_group)
})
}
base_group.init().select()
Undo.finishEdit('add_group');
loadOutlinerDraggable()
Expand Down
1 change: 1 addition & 0 deletions js/outliner/locator.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Locator extends NonGroup {
getUndoCopy() {
var copy = new Locator(this)
copy.uuid = this.uuid
copy.type = this.type;
delete copy.parent;
return copy;
}
Expand Down
Loading

0 comments on commit fd3085b

Please sign in to comment.