Fix typo in splash screen

Fix Update Notification button not working
Split event for new project / setup project
Fix issue where deleting theme files would cause error pop up on start
Fix issue with field in texture generator dialog toggling on input
(caused by underlying bug in Condition system)
Fix wrong icon in "Display UV" option
Fix new cubes not updating position
This commit is contained in:
JannisX11 2021-10-20 22:55:54 +02:00
parent 389f233e2e
commit e3ac34f4c5
13 changed files with 35 additions and 25 deletions

View File

@ -23,7 +23,7 @@
{
"image": "https://web.blockbench.net/content/poly_mesh.png",
"title": "Poly Mesh Editing!",
"text": "Blockbench now supports poly mesh editing, which let's you create and modify any type of shape in generic models."
"text": "Blockbench now supports poly mesh editing, which lets you create and modify any type of shape in generic models."
},
{
"image": "https://web.blockbench.net/content/theme_browser.png",

View File

@ -438,10 +438,10 @@ ipcRenderer.on('update-available', (event, arg) => {
color: 'var(--color-back)',
graphic: {type: 'icon', icon: 'update'},
text: [
{type: 'h1', text: tl('message.update_notification.title')},
{type: 'h2', text: tl('message.update_notification.title')},
{text: tl('message.update_notification.message')},
{type: 'button', text: tl('generic.enable'), click: (e) => {
Settings.open({search: 'automatic_updates'})
settings.automatic_updates.set(true);
}}
]
})

View File

@ -255,7 +255,7 @@ class EditSession {
} else if (tag.type === 'init_model') {
newProject(data.meta.type||'free', data.flag === 'force');
setupProject(data.meta.type||'free', data.flag === 'force');
Codecs.project.parse(data);
this.Project = Project;
this.Project.EditSession = this;

View File

@ -44,7 +44,13 @@ const CustomTheme = {
let sideloaded = JSON.parse(localStorage.getItem('themes_sideloaded'));
if (sideloaded instanceof Array && sideloaded.length) {
CustomTheme.sideloaded_themes = sideloaded;
Blockbench.read(CustomTheme.sideloaded_themes, {}, files => {
CustomTheme.sideloaded_themes.forEachReverse(path => {
if (!fs.existsSync(path)) {
CustomTheme.sideloaded_themes.remove(path);
}
})
localStorage.setItem('themes_sideloaded', JSON.stringify(CustomTheme.sideloaded_themes));
Blockbench.read(CustomTheme.sideloaded_themes, {errorbox: false}, files => {
files.forEach(file => {
let data = JSON.parse(file.content);
data.id = file.name.replace(/\.\w+$/, '');

View File

@ -25,7 +25,7 @@ class Codec {
load(model, file, add) {
if (!this.parse) return false;
if (!add) {
newProject(this.format)
setupProject(this.format)
}
if (file.path && isApp && this.remember && !file.no_file ) {
var name = pathToName(file.path, true);

View File

@ -61,7 +61,7 @@ var codec = new Codec('project', {
},
load(model, file, add) {
newProject(Formats[model.meta.model_format] || Formats.free);
setupProject(Formats[model.meta.model_format] || Formats.free);
var name = pathToName(file.path, true);
if (file.path && isApp && !file.no_file ) {
Project.save_path = file.path;

View File

@ -1021,10 +1021,7 @@ var format = new ModelFormat({
animation_mode: true,
locators: true,
texture_meshes: true,
codec,
onActivation: function () {
}
codec
})
//Object.defineProperty(format, 'single_texture', {get: _ => !settings.layered_textures.value})
codec.format = format;

View File

@ -484,9 +484,6 @@ var format = new ModelFormat({
animation_mode: true,
locators: true,
codec,
onActivation: function () {
}
})
//Object.defineProperty(format, 'single_texture', {get: _ => !settings.layered_textures.value})
codec.format = format;

View File

@ -163,10 +163,7 @@ const format = new ModelFormat({
single_texture: true,
integer_size: true,
rotate_cubes: true,
codec,
onActivation() {
Modes.options.paint.select();
}
codec
})
format.new = function() {
skin_dialog.show();

View File

@ -200,6 +200,10 @@ class ModelProject {
this.thumbnail = Preview.selected.canvas.toDataURL();
Interface.tab_bar.last_opened_project = this.uuid;
if (Format && typeof Format.onDeactivation == 'function') {
Format.onDeactivation()
}
Preview.all.forEach(preview => {
this.previews[preview.id] = {
position: preview.camera.position.toArray(),
@ -340,6 +344,16 @@ let Project = 0;
let ProjectData = {};
// Setup ModelProject for loaded project
function setupProject(format) {
if (typeof format == 'string' && Formats[format]) format = Formats[format];
new ModelProject({format}).select();
Modes.options.edit.select();
Blockbench.dispatchEvent('setup_project');
return true;
}
// Setup brand new project
function newProject(format) {
if (typeof format == 'string' && Formats[format]) format = Formats[format];
new ModelProject({format}).select();

View File

@ -504,10 +504,8 @@ class Cube extends OutlinerElement {
if (selected.indexOf(this) === 0) {
UVEditor.loadData()
}
if (Project.view_mode === 'textured') {
this.preview_controller.updateFaces(this);
this.preview_controller.updateUV(this);
}
this.preview_controller.updateFaces(this);
this.preview_controller.updateUV(this);
}
mapAutoUV() {
if (Blockbench.box_uv) return;
@ -1186,6 +1184,7 @@ BARS.defineActions(function() {
if (Group.selected) Group.selected.unselect()
base_cube.select()
Canvas.updateView({elements: [base_cube], element_aspects: {transform: true}})
Undo.finishEdit('Add cube', {outliner: true, elements: selected, selection: true});
Blockbench.dispatchEvent( 'add_cube', {object: base_cube} )

View File

@ -1221,7 +1221,7 @@ const UVEditor = {
'zoom_out',
'zoom_reset'
]},
{name: 'menu.uv.display_uv', id: 'display_uv', icon: 'search', children: () => {
{name: 'menu.uv.display_uv', id: 'display_uv', icon: 'visibility', children: () => {
let options = ['selected_faces', 'selected_elements', 'all_elements'];
return options.map(option => {return {
id: option,

View File

@ -34,7 +34,7 @@ const Condition = function(condition, context) {
if (condition === undefined) {
return true;
} else if (typeof condition === 'function') {
return condition(context)
return !!condition(context)
} else if (typeof condition === 'object') {
if (condition.modes instanceof Array && condition.modes.includes(Modes.id) === false) return false;
if (condition.formats instanceof Array && condition.formats.includes(Format.id) === false) return false;
@ -42,7 +42,7 @@ const Condition = function(condition, context) {
if (condition.features instanceof Array && Format && condition.features.find(feature => !Format[feature])) return false;
if (condition.method instanceof Function) {
return condition.method(context);
return !!condition.method(context);
}
return true;
} else {