Add option to toggle all grids

Make camel skin presets compatible with Toggle Layer
This commit is contained in:
JannisX11 2023-07-08 13:43:41 +02:00
parent 2d73775615
commit 6014ea0880
6 changed files with 28 additions and 16 deletions

View File

@ -423,6 +423,7 @@ const MenuBar = {
'view_mode',
'toggle_shading',
'toggle_motion_trails',
'toggle_all_grids',
'toggle_ground_plane',
'preview_checkerboard',
'painting_grid',

View File

@ -462,7 +462,8 @@ const Settings = {
new Setting('stretch_linked', {category: 'edit', value: true});
//Grid
new Setting('base_grid', {category: 'grid', value: true,});
new Setting('grids', {category: 'grid', value: true, onChange() {Canvas.buildGrid()}});
new Setting('base_grid', {category: 'grid', value: true});
new Setting('large_grid', {category: 'grid', value: true});
new Setting('full_grid', {category: 'grid', value: false});
new Setting('large_box', {category: 'grid', value: false});

View File

@ -1620,9 +1620,9 @@ skin_presets.camel = {
"parent": "body",
"pivot": [0.5, 20, 9.5],
"cubes": [
{"origin": [-4.5, 32, -6], "size": [9, 5, 11], "inflate": 0.1, "layer": true, "visibility": false, "uv": [74, 64]},
{"origin": [-3.5, 37, -6], "size": [7, 3, 11], "inflate": 0.1, "layer": true, "visibility": false, "uv": [92, 114]},
{"origin": [-7.5, 20, -14], "size": [15, 12, 27], "inflate": 0.1, "layer": true, "visibility": false, "uv": [0, 89]}
{"name": "saddle layer", "origin": [-4.5, 32, -6], "size": [9, 5, 11], "inflate": 0.1, "layer": true, "visibility": false, "uv": [74, 64]},
{"name": "saddle layer", "origin": [-3.5, 37, -6], "size": [7, 3, 11], "inflate": 0.1, "layer": true, "visibility": false, "uv": [92, 114]},
{"name": "saddle layer", "origin": [-7.5, 20, -14], "size": [15, 12, 27], "inflate": 0.1, "layer": true, "visibility": false, "uv": [0, 89]}
]
},
{
@ -1648,9 +1648,9 @@ skin_presets.camel = {
"parent": "head",
"pivot": [0.5, 25, -10],
"cubes": [
{"origin": [-3.5, 22, -25], "size": [7, 8, 19], "inflate": 0.1, "uv": [60, 87], "layer": true, "visibility": false},
{"origin": [-3.5, 30, -25], "size": [7, 14, 7], "inflate": 0.1, "uv": [21, 64], "layer": true, "visibility": false},
{"origin": [-2.5, 39, -31.1], "size": [5, 5, 6], "inflate": 0.1, "uv": [50, 64], "layer": true, "visibility": false},
{"name": "bridle layer", "origin": [-3.5, 22, -25], "size": [7, 8, 19], "inflate": 0.1, "uv": [60, 87], "layer": true, "visibility": false},
{"name": "bridle layer", "origin": [-3.5, 30, -25], "size": [7, 14, 7], "inflate": 0.1, "uv": [21, 64], "layer": true, "visibility": false},
{"name": "bridle layer", "origin": [-2.5, 39, -31.1], "size": [5, 5, 6], "inflate": 0.1, "uv": [50, 64], "layer": true, "visibility": false},
{"origin": [2.5, 40, -28], "size": [1, 2, 2], "uv": [74, 70]},
{"origin": [-3.5, 40, -28], "size": [1, 2, 2], "uv": [74, 70], "mirror": true}
]
@ -1676,9 +1676,9 @@ skin_presets.camel = {
"parent": "head",
"pivot": [3.7, 41, -27],
"cubes": [
{"origin": [3.7, 34, -27], "size": [0, 7, 15], "uv": [98, 42], "layer": true, "visibility": false},
{"origin": [-3.7, 34, -12], "size": [7.4, 7, 0], "uv": [84, 57], "layer": true, "visibility": false},
{"origin": [-3.7, 34, -27], "size": [0, 7, 15], "uv": [98, 42], "layer": true, "visibility": false}
{"name": "reins layer", "origin": [3.7, 34, -27], "size": [0, 7, 15], "uv": [98, 42], "layer": true, "visibility": false},
{"name": "reins layer", "origin": [-3.7, 34, -12], "size": [7.4, 7, 0], "uv": [84, 57], "layer": true, "visibility": false},
{"name": "reins layer", "origin": [-3.7, 34, -27], "size": [0, 7, 15], "uv": [98, 42], "layer": true, "visibility": false}
]
},
{

View File

@ -416,11 +416,12 @@ const Canvas = {
gridMaterial: new THREE.LineBasicMaterial({color: gizmo_colors.grid}),
buildGrid() {
three_grid.children.length = 0;
three_grid.children.empty();
if (Canvas.side_grids) {
Canvas.side_grids.x.children.length = 0;
Canvas.side_grids.z.children.length = 0;
Canvas.side_grids.x.children.empty();
Canvas.side_grids.z.children.empty();
}
if (!settings.grids.value) return;
if (Modes.display) return;
three_grid.name = 'grid_group'
@ -588,7 +589,7 @@ const Canvas = {
lights.top.position.set(0, 100, 0)
lights.add(lights.top);
lights.top.intensity = 0.41
lights.top.intensity = 0.46
lights.bottom = new THREE.DirectionalLight();
lights.bottom.name = 'light_bottom'
@ -724,8 +725,8 @@ const Canvas = {
edit(object);
})
edit(three_grid)
edit(Canvas.side_grids.x)
edit(Canvas.side_grids.z)
if (Canvas.side_grids) edit(Canvas.side_grids.x)
if (Canvas.side_grids) edit(Canvas.side_grids.z)
Outliner.elements.forEach(element => {
let {mesh} = element;
if (element.selected && mesh.outline) edit(mesh.outline);

View File

@ -2008,6 +2008,13 @@ BARS.defineActions(function() {
node.classList.add('one_is_enough')
preview.node.querySelector('.preview_menu .shading_placeholder').replaceWith(node);
})
new Toggle('toggle_all_grids', {
name: tl('settings.grids'),
description: tl('settings.grids.desc'),
icon: 'grid',
category: 'view',
linked_setting: 'grids'
})
new Toggle('toggle_ground_plane', {
name: tl('settings.ground_plane'),
description: tl('settings.ground_plane.desc'),

View File

@ -851,6 +851,8 @@
"settings.stretch_linked": "Link Stretching",
"settings.stretch_linked.desc": "Stretch the cube in all directions with the same value",
"settings.grids": "Show Grids",
"settings.grids.desc": "Show or hide all 3D grids",
"settings.base_grid": "Small Grid",
"settings.base_grid.desc": "Show small grid and axes",
"settings.large_grid": "Block Grid",