Skip to content

Commit

Permalink
Fix #1087 View angles unlock when switching tabs
Browse files Browse the repository at this point in the history
Fix #1086 UV rotation does not work on java block item format
Update to Electron 14
[ci-build]
  • Loading branch information
JannisX11 committed Oct 9, 2021
1 parent feaafd7 commit 0d61416
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 77 deletions.
2 changes: 1 addition & 1 deletion css/dialogs.css
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@
position: relative;
height: 108px;
width: 100%;
background-color: var(--color-accent);
background-color: var(--color-frame);
border: 2px solid var(--color-frame);
border-top: none;
}
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<script>
if (typeof module === 'object') {window.module = module; module = undefined;}//jQuery Fix
const isApp = typeof require !== 'undefined';
const appVersion = '4.0.0-beta.4';
const appVersion = '4.0.0-beta.5';


if (localStorage.getItem('theme')) {
Expand Down
2 changes: 1 addition & 1 deletion js/desktop.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const electron = require('electron').remote;
const electron = require('@electron/remote');
const {clipboard, shell, nativeImage, ipcRenderer, dialog} = require('electron');
const app = electron.app;
const fs = require('fs');
Expand Down
59 changes: 2 additions & 57 deletions js/io/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,63 +101,6 @@ class ModelProject {
getDisplayName() {
return this.name || this.geometry_name || this.format.name;
}
reset() {
return;
//if (isApp) updateRecentProjectThumbnail();

//Blockbench.dispatchEvent('reset_project');

//if (isApp) BedrockEntityManager.reset();

//if (Toolbox.selected.id !== 'move_tool') BarItems.move_tool.select();

Screencam.stopTimelapse();

//Format = 0;
/*
for (var uuid in OutlinerNode.uuids) {
delete OutlinerNode.uuids[uuid];
}
Outliner.elements.empty();
Outliner.root.purge();
for (var key in Canvas.materials) {
delete Canvas.materials[key];
}
for (var key in Project.nodes_3d) {
delete Project.nodes_3d[key];
}*/
//selected.empty();
//Group.all.empty();
//Group.selected = undefined;
//Cube.all.empty();
//Cube.selected.empty();
//Locator.all.empty();
//Locator.selected.empty();
//Texture.all.empty();
//Texture.selected = undefined;

//for (var key in ModelProject.properties) {
// ModelProject.properties[key].reset(this)
//}
//this.texture_width = this.texture_height = 16;
//this.overrides = null;

//Blockbench.display_settings = display = {};
//Project.save_path = Project.export_path = Project.name = '';
//Project.saved = true;
//Canvas.updateAll();
//Outliner.vue.$forceUpdate();
//Interface.Panels.textures.inside_vue.$forceUpdate();
//Undo.history.empty();
//Undo.index = 0;
//Undo.current_save = null;
//Painter.current = {};
//Animator.animations.purge();
//Timeline.animators.purge();
//Animation.selected = undefined;
//delete Animator.motion_trail_lock;
//$('#var_placeholder_area').val('');
}
openSettings() {
if (this.selected) BarItems.project_window.click();
}
Expand Down Expand Up @@ -225,6 +168,7 @@ class ModelProject {
preview.controls.target.fromArray(data.target);
preview.setProjectionMode(data.orthographic);
if (data.zoom) preview.camOrtho.zoom = data.zoom;
if (data.angle) preview.setLockedAngle(data.angle);
} else if (preview.default_angle !== undefined) {
setTimeout(() => preview.loadAnglePreset(preview.default_angle), 0);
}
Expand Down Expand Up @@ -262,6 +206,7 @@ class ModelProject {
target: preview.controls.target.toArray(),
orthographic: preview.isOrtho,
zoom: preview.camOrtho.zoom,
angle: preview.angle,
}
})

Expand Down
2 changes: 1 addition & 1 deletion js/preview/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ class Preview {
error_element.innerHTML = error_element.innerHTML +
'\nAlternatively, try to <a href onclick="restartWithoutHardwareAcceleration()">Restart without Hardware Acceleration.</a>'

var {BrowserWindow} = require('electron').remote
var {BrowserWindow} = require('@electron/remote');
new BrowserWindow({
icon:'icon.ico',
backgroundColor: '#ffffff',
Expand Down
21 changes: 10 additions & 11 deletions js/texturing/uv.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,11 +493,6 @@ const UVEditor = {
this.getMappableElements().forEach(cb);
},
//Load
loadSelectedFace() {
this.face = $('#uv_panel_sides input:checked').attr('id').replace('_radio', '')
this.loadData()
return false;
},
loadData() {
this.vue.updateTexture();
this.displaySliders();
Expand Down Expand Up @@ -667,7 +662,7 @@ const UVEditor = {
scope.getFaces(obj, event).forEach(function(side) {
obj.faces[side].uv = [0, 0, scope.getResolution(0, obj.faces[side]), scope.getResolution(1, obj.faces[side])]
})
obj.autouv = 0
obj.autouv = 0;
Canvas.updateUV(obj)
})
this.message('uv_editor.maximized')
Expand Down Expand Up @@ -1028,11 +1023,15 @@ const UVEditor = {
this.displayTools()
},
rotate(mesh_angle) {
var scope = this;
var value = parseInt(BarItems.uv_rotation.get())
var value = parseInt(BarItems.uv_rotation.get());
if (Cube.selected[0] && Cube.selected[0].faces[this.selected_faces] && Math.abs(Cube.selected[0].faces[this.selected_faces].rotation - value) % 180 == 90) {
UVEditor.turnMapping();
}
this.forCubes(obj => {
obj.faces[scope.face].rotation = value
Canvas.updateUV(obj)
this.selected_faces.forEach(face => {
obj.faces[face].rotation = value;
})
Canvas.updateUV(obj);
})
Mesh.selected.forEach(mesh => {
mesh.forAllFaces((face, fkey) => {
Expand Down Expand Up @@ -1374,7 +1373,7 @@ BARS.defineActions(function() {
Undo.initEdit({elements: Cube.selected, uv_only: true})
},
onChange: function(slider) {
//UVEditor.forSelection('rotate')
UVEditor.rotate();
},
onAfter: () => {
Undo.finishEdit('Rotate UV')
Expand Down
4 changes: 4 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const url = require('url')
const { autoUpdater } = require('electron-updater');
const fs = require('fs');
const {getColorHexRGB} = require('electron-color-picker')
require('@electron/remote/main').initialize()

let orig_win;
let all_wins = [];
Expand Down Expand Up @@ -57,6 +58,9 @@ function createWindow(second_instance) {
})
if (!orig_win) orig_win = win;
all_wins.push(win);

require('@electron/remote/main').enable(win.webContents)

var index_path = path.join(__dirname, 'index.html')
if (process.platform === 'darwin') {

Expand Down
11 changes: 8 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Blockbench",
"description": "Low-poly modeling and animation software",
"version": "4.0.0-beta.4",
"version": "4.0.0-beta.5",
"license": "GPL-3.0-or-later",
"author": {
"name": "JannisX11",
Expand Down Expand Up @@ -104,14 +104,15 @@
},
"devDependencies": {
"blockbench-types": "^3.9.0",
"electron": "^13.5.1",
"electron": "^14.1.1",
"electron-builder": "^22.14.4",
"electron-notarize": "^1.0.0",
"webpack": "^5.21.2",
"webpack-cli": "^4.5.0",
"workbox-build": "^6.1.5"
},
"dependencies": {
"@electron/remote": "^2.0.1",
"electron-color-picker": "^0.2.0",
"electron-updater": "^4.3.1"
}
Expand Down

0 comments on commit 0d61416

Please sign in to comment.