Skip to content

Commit

Permalink
Merge branch 'master' into gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
JannisX11 committed Jan 16, 2025
2 parents a972764 + 3039c28 commit 1aec46f
Show file tree
Hide file tree
Showing 8 changed files with 247 additions and 71 deletions.
8 changes: 4 additions & 4 deletions js/interface/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ const Settings = {
Canvas.updateShading()
}});
new Setting('antialiasing', {category: 'preview', value: true, requires_restart: true});
new Setting('antialiasing_bleed_fix', {category: 'preview', value: true, requires_restart: true});
new Setting('antialiasing_bleed_fix', {category: 'preview', value: false, requires_restart: true});
new Setting('fov', {category: 'preview', value: 45, type: 'number', min: 1, max: 120, onChange(val) {
Preview.all.forEach(preview => preview.setFOV(val));
}});
Expand Down Expand Up @@ -490,6 +490,7 @@ const Settings = {
Preview.all.forEach(viewport => viewport.controls.zoomSpeed = value / 100 * 1.5)
}});
new Setting('editor_2d_zoom_speed', {category: 'controls', value: 100, min: 10, max: 1000, type: 'number'});
new Setting('gamepad_controls', {category: 'controls', value: false, name: 'Gamepad Controls', description: 'Use a gamepad or 3D mouse to navigate the viewport'});
new Setting('double_click_switch_tools',{category: 'controls', value: true});
new Setting('canvas_unselect', {category: 'controls', value: false});
new Setting('selection_tolerance', {category: 'controls', value: 10, type: 'number', min: 1, max: 50});
Expand Down Expand Up @@ -626,9 +627,8 @@ const Settings = {
new Setting('sketchfab_token', {category: 'export', value: '', type: 'password'});
new Setting('credit', {category: 'export', value: 'Made with Blockbench', type: 'text'});

Blockbench.onUpdateTo('4.7.1', () => {
settings.brush_opacity_modifier.set('none');
settings.brush_size_modifier.set('none');
Blockbench.onUpdateTo('4.12.1', () => {
settings.antialiasing_bleed_fix.set(false);
})
},
setupProfiles() {
Expand Down
2 changes: 1 addition & 1 deletion js/io/formats/optifine_jem.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ var codec = new Codec('optifine_entity', {
let texture = importTexture(b.texture, b.textureSize);
let group = 0;
if (!model._is_jpm) {
let group = new Group({
group = new Group({
name: b.part,
origin: b.translate,
rotation: b.rotate,
Expand Down
2 changes: 1 addition & 1 deletion js/outliner/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ Object.defineProperty(Collection, 'all', {
})
Object.defineProperty(Collection, 'selected', {
get() {
return Project.collections.filter(c => c.selected);
return Project ? Project.collections.filter(c => c.selected) : [];
}
})

Expand Down
8 changes: 3 additions & 5 deletions js/outliner/outliner.js
Original file line number Diff line number Diff line change
Expand Up @@ -844,20 +844,18 @@ function moveOutlinerSelectionTo(item, target, event, order) {
iterate(target)
if (is_parent) return;
}
if (item instanceof OutlinerElement && Outliner.selected.includes( item )) {
if (item instanceof OutlinerNode && item.selected) {
var items = [];
// ensure elements are in displayed order
Outliner.root.forEach(node => {
if (node instanceof Group) {
node.forEachChild(child => {
if (child.selected && child instanceof Group == false) items.push(child);
})
if (child.selected && !child.parent.selected) items.push(child);
}, null, true);
} else if (node.selected) {
items.push(node);
}
})
} else if (item instanceof Group) {
var items = Group.multi_selected.filter(g => !g.parent.selected);
} else {
var items = [item];
}
Expand Down
8 changes: 7 additions & 1 deletion js/preview/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,9 @@ class Preview {

let z_offset = world_normal.clone().multiplyScalar(z_fight_offset);
let matrix_offset = new THREE.Matrix4().makeTranslation(z_offset.x, z_offset.y, z_offset.z);
if (!Format.centered_grid) {
matrix_offset.makeTranslation(-Canvas.scene.position.x, -Canvas.scene.position.y, -Canvas.scene.position.z);
}
brush_matrix.multiplyMatrices(matrix_offset, brush_matrix);

Canvas.brush_outline.matrix = brush_matrix;
Expand Down Expand Up @@ -1939,12 +1942,15 @@ class OrbitGizmo {
window.addEventListener("gamepadconnected", function(event) {
let is_space_mouse = event.gamepad.id.includes('SpaceMouse') || event.gamepad.id.includes('SpaceNavigator') || event.gamepad.id.includes('3Dconnexion');

console.log('Gamepad Connected', event);

let zoom_timer = 0;

let interval = setInterval(() => {
let gamepad = navigator.getGamepads()[event.gamepad.index];
let preview = Preview.selected;
if (!document.hasFocus() || !preview || !gamepad || !gamepad.axes || gamepad.axes.allEqual(0) || gamepad.axes.find(v => isNaN(v)) != undefined) return;
if (settings.gamepad_controls.value == false) return;
if (!document.hasFocus() || !preview || !gamepad || !gamepad.axes || !gamepad.connected || gamepad.axes.allEqual(0) || gamepad.axes.find(v => isNaN(v)) != undefined) return;

if (is_space_mouse) {
let offset = new THREE.Vector3(
Expand Down
2 changes: 1 addition & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@
"settings.antialiasing": "Anti-aliasing",
"settings.antialiasing.desc": "Toggle anti-aliasing in the preview",
"settings.antialiasing_bleed_fix": "Fix anti-aliasing bleeding",
"settings.antialiasing_bleed_fix.desc": "Fixes texture bleeding when using anti-aliasing",
"settings.antialiasing_bleed_fix.desc": "Fixes texture bleeding when using anti-aliasing. Potentially unsupported on older hardware.",
"settings.render_sides": "Render Sides",
"settings.tone_mapping": "Tone Mapping",
"settings.tone_mapping.desc": "Approximation method for displaying high dynamic range on a standard screen for PBR rendering.",
Expand Down
Loading

0 comments on commit 1aec46f

Please sign in to comment.