mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-04-06 17:31:09 +08:00
Fix #1334 Mesh wireframes sometimes do not update
This commit is contained in:
parent
2c0d8f11b3
commit
71b0bd77ea
@ -1136,6 +1136,10 @@ new NodePreviewController(Mesh, {
|
||||
|
||||
Mesh.preview_controller.updatePixelGrid(element);
|
||||
|
||||
if (Project.view_mode == 'wireframe' && this.fixWireframe) {
|
||||
this.fixWireframe(element);
|
||||
}
|
||||
|
||||
this.dispatchEvent('update_geometry', {element});
|
||||
},
|
||||
updateFaces(element) {
|
||||
@ -1447,5 +1451,20 @@ new NodePreviewController(Mesh, {
|
||||
mesh.add(box);
|
||||
|
||||
this.dispatchEvent('update_painting_grid', {element});
|
||||
},
|
||||
fixWireframe(element) {
|
||||
let geometry_orig = element.mesh.geometry;
|
||||
if (!geometry_orig) return;
|
||||
let geometry_clone = element.mesh.geometry.clone();
|
||||
element.mesh.geometry = geometry_clone;
|
||||
geometry_orig.dispose();
|
||||
}
|
||||
})
|
||||
|
||||
Blockbench.dispatchEvent('change_view_mode', ({view_mode}) => {
|
||||
if (view_mode == 'wireframe') {
|
||||
for (let mesh of Mesh.selected) {
|
||||
Mesh.preview_controller.fixWireframe(mesh);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -2209,6 +2209,7 @@ BARS.defineActions(function() {
|
||||
material: {name: true, icon: 'pages', condition: () => ((!Toolbox.selected.allowed_view_modes || Toolbox.selected.allowed_view_modes.includes('material')) && TextureGroup.all.find(tg => tg.is_material))},
|
||||
},
|
||||
onChange() {
|
||||
let previous_view_mode = Project.view_mode;
|
||||
Project.view_mode = this.value;
|
||||
Canvas.updateViewMode();
|
||||
if (Modes.id === 'animate') {
|
||||
@ -2221,6 +2222,9 @@ BARS.defineActions(function() {
|
||||
if (icon_node) icon_node.replaceWith(icon);
|
||||
}
|
||||
})
|
||||
if (Project.view_mode != previous_view_mode) {
|
||||
Blockbench.dispatchEvent('change_view_mode', {view_mode: Project.view_mode, previous_view_mode});
|
||||
}
|
||||
//Blockbench.showQuickMessage(tl('action.view_mode') + ': ' + tl('action.view_mode.' + this.value));
|
||||
}
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user