mirror of
https://github.com/JannisX11/blockbench.git
synced 2024-11-27 04:21:46 +08:00
Add "Display UV" option
Bump version to 4.0 beta 4 [ci-build] Fix panel selector on mobile
This commit is contained in:
parent
f7f1b53455
commit
3031b6db21
@ -25,7 +25,7 @@
|
|||||||
<script>
|
<script>
|
||||||
if (typeof module === 'object') {window.module = module; module = undefined;}//jQuery Fix
|
if (typeof module === 'object') {window.module = module; module = undefined;}//jQuery Fix
|
||||||
const isApp = typeof require !== 'undefined';
|
const isApp = typeof require !== 'undefined';
|
||||||
const appVersion = '4.0.0-beta.3';
|
const appVersion = '4.0.0-beta.4';
|
||||||
|
|
||||||
|
|
||||||
if (localStorage.getItem('theme')) {
|
if (localStorage.getItem('theme')) {
|
||||||
|
@ -1962,7 +1962,6 @@ const BARS = {
|
|||||||
'uv_transparent',
|
'uv_transparent',
|
||||||
'uv_rotation',
|
'uv_rotation',
|
||||||
//Box
|
//Box
|
||||||
'toggle_uv_overlay',
|
|
||||||
'toggle_mirror_uv',
|
'toggle_mirror_uv',
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
@ -23,6 +23,7 @@ class ModelProject {
|
|||||||
this.format = options.format instanceof ModelFormat ? options.format : Formats.free;
|
this.format = options.format instanceof ModelFormat ? options.format : Formats.free;
|
||||||
this.mode = 'edit';
|
this.mode = 'edit';
|
||||||
this.view_mode = 'textured';
|
this.view_mode = 'textured';
|
||||||
|
this.display_uv = 'selected_elements';
|
||||||
this.previews = {};
|
this.previews = {};
|
||||||
this.EditSession = null;
|
this.EditSession = null;
|
||||||
|
|
||||||
@ -208,6 +209,7 @@ class ModelProject {
|
|||||||
UVEditor.vue.selected_vertices = this.selected_vertices;
|
UVEditor.vue.selected_vertices = this.selected_vertices;
|
||||||
UVEditor.vue.selected_faces = this.selected_faces;
|
UVEditor.vue.selected_faces = this.selected_faces;
|
||||||
UVEditor.vue.box_uv = this.box_uv;
|
UVEditor.vue.box_uv = this.box_uv;
|
||||||
|
UVEditor.vue.display_uv = this.display_uv;
|
||||||
|
|
||||||
Interface.Panels.textures.inside_vue.textures = Texture.all;
|
Interface.Panels.textures.inside_vue.textures = Texture.all;
|
||||||
scene.add(this.model_3d);
|
scene.add(this.model_3d);
|
||||||
|
@ -1199,31 +1199,27 @@ const UVEditor = {
|
|||||||
cube_faces: ['north', 'south', 'west', 'east', 'up', 'down'],
|
cube_faces: ['north', 'south', 'west', 'east', 'up', 'down'],
|
||||||
forSelection(cb, event, ...args) {
|
forSelection(cb, event, ...args) {
|
||||||
UVEditor[cb](...args);
|
UVEditor[cb](...args);
|
||||||
/*
|
|
||||||
if (open_dialog === false) {
|
|
||||||
UVEditor[cb](event, ...args)
|
|
||||||
} else if (UVEditor.single) {
|
|
||||||
UVEditor.editors.single[cb](...args)
|
|
||||||
} else {
|
|
||||||
if (UVEditor.selection.length > 0) {
|
|
||||||
UVEditor.selection.forEach(function(s) {
|
|
||||||
UVEditor.editors[s][cb](...args)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
UVEditor.cube_faces.forEach(function(s) {
|
|
||||||
UVEditor.editors[s][cb](...args)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
menu: new Menu([
|
menu: new Menu([
|
||||||
{name: 'menu.view.zoom', id: 'zoom', condition: isApp, icon: 'search', children: [
|
{name: 'menu.view.zoom', id: 'zoom', icon: 'search', children: [
|
||||||
'zoom_in',
|
'zoom_in',
|
||||||
'zoom_out',
|
'zoom_out',
|
||||||
'zoom_reset'
|
'zoom_reset'
|
||||||
]},
|
]},
|
||||||
|
{name: 'menu.uv.display_uv', id: 'display_uv', icon: 'search', children: () => {
|
||||||
|
let options = ['selected_faces', 'selected_elements', 'all_elements'];
|
||||||
|
return options.map(option => {return {
|
||||||
|
id: option,
|
||||||
|
name: `menu.uv.display_uv.${option}`,
|
||||||
|
icon: UVEditor.vue.display_uv == option ? 'radio_button_checked' : 'radio_button_unchecked',
|
||||||
|
condition: !(option == 'selected_faces' && Project.box_uv && !Mesh.selected.length),
|
||||||
|
click() {
|
||||||
|
Project.display_uv = UVEditor.vue.display_uv = option;
|
||||||
|
}
|
||||||
|
}})
|
||||||
|
}},
|
||||||
'focus_on_selection',
|
'focus_on_selection',
|
||||||
'uv_checkerboard',
|
'uv_checkerboard',
|
||||||
'_',
|
'_',
|
||||||
@ -1591,16 +1587,6 @@ BARS.defineActions(function() {
|
|||||||
Undo.finishEdit('Set automatic cullface')
|
Undo.finishEdit('Set automatic cullface')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
new Toggle('toggle_uv_overlay', {
|
|
||||||
//condition: () => Project.box_uv,
|
|
||||||
icon: 'view_quilt',
|
|
||||||
category: 'uv',
|
|
||||||
onChange(value) {
|
|
||||||
UVEditor.vue.showing_overlays = value;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
Interface.definePanels(function() {
|
Interface.definePanels(function() {
|
||||||
@ -1648,7 +1634,7 @@ Interface.definePanels(function() {
|
|||||||
all_elements: [],
|
all_elements: [],
|
||||||
selected_vertices: {},
|
selected_vertices: {},
|
||||||
selected_faces: [],
|
selected_faces: [],
|
||||||
showing_overlays: false,
|
display_uv: 'selected_elements',
|
||||||
|
|
||||||
face_names: {
|
face_names: {
|
||||||
north: tl('face.north'),
|
north: tl('face.north'),
|
||||||
@ -2423,14 +2409,14 @@ Interface.definePanels(function() {
|
|||||||
|
|
||||||
<div id="uv_frame" @click.stop="reverseSelect($event)" ref="frame" :style="{width: inner_width + 'px', height: inner_height + 'px'}" v-if="texture !== null">
|
<div id="uv_frame" @click.stop="reverseSelect($event)" ref="frame" :style="{width: inner_width + 'px', height: inner_height + 'px'}" v-if="texture !== null">
|
||||||
|
|
||||||
<template v-if="mode == 'uv'" v-for="element in (showing_overlays ? all_mappable_elements : mappable_elements)">
|
<template v-if="mode == 'uv'" v-for="element in (display_uv === 'all_elements' ? all_mappable_elements : mappable_elements)">
|
||||||
|
|
||||||
<template v-if="element.type == 'cube' && !box_uv">
|
<template v-if="element.type == 'cube' && !box_uv">
|
||||||
<div class="cube_uv_face"
|
<div class="cube_uv_face"
|
||||||
v-for="(face, key) in element.faces" :key="element.uuid + ':' + key"
|
v-for="(face, key) in element.faces" :key="element.uuid + ':' + key"
|
||||||
v-if="face.getTexture() == texture || texture == 0"
|
v-if="(face.getTexture() == texture || texture == 0) && (display_uv !== 'selected_faces' || selected_faces.includes(key))"
|
||||||
:title="face_names[key]"
|
:title="face_names[key]"
|
||||||
:class="{selected: selected_faces.includes(key), unselected: showing_overlays && !mappable_elements.includes(element)}"
|
:class="{selected: selected_faces.includes(key), unselected: display_uv === 'all_elements' && !mappable_elements.includes(element)}"
|
||||||
@mousedown.prevent="dragFace(key, $event)"
|
@mousedown.prevent="dragFace(key, $event)"
|
||||||
:style="{
|
:style="{
|
||||||
left: toPixels(Math.min(face.uv[0], face.uv[2]), -1),
|
left: toPixels(Math.min(face.uv[0], face.uv[2]), -1),
|
||||||
@ -2439,7 +2425,7 @@ Interface.definePanels(function() {
|
|||||||
'--height': toPixels(Math.abs(face.uv_size[1]), 2),
|
'--height': toPixels(Math.abs(face.uv_size[1]), 2),
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<template v-if="selected_faces.includes(key) && !(showing_overlays && !mappable_elements.includes(element))">
|
<template v-if="selected_faces.includes(key) && !(display_uv === 'all_elements' && !mappable_elements.includes(element))">
|
||||||
{{ face_names[key] || '' }}
|
{{ face_names[key] || '' }}
|
||||||
<div class="uv_resize_side horizontal" @mousedown="resizeFace(key, $event, 0, -1)" style="width: var(--width)"></div>
|
<div class="uv_resize_side horizontal" @mousedown="resizeFace(key, $event, 0, -1)" style="width: var(--width)"></div>
|
||||||
<div class="uv_resize_side horizontal" @mousedown="resizeFace(key, $event, 0, 1)" style="top: var(--height); width: var(--width)"></div>
|
<div class="uv_resize_side horizontal" @mousedown="resizeFace(key, $event, 0, 1)" style="top: var(--height); width: var(--width)"></div>
|
||||||
@ -2465,7 +2451,7 @@ Interface.definePanels(function() {
|
|||||||
:key="element.uuid"
|
:key="element.uuid"
|
||||||
@mousedown.prevent="dragFace(null, $event)"
|
@mousedown.prevent="dragFace(null, $event)"
|
||||||
@click.prevent="selectCube(element, $event)"
|
@click.prevent="selectCube(element, $event)"
|
||||||
:class="{unselected: showing_overlays && !mappable_elements.includes(element)}"
|
:class="{unselected: display_uv === 'all_elements' && !mappable_elements.includes(element)}"
|
||||||
:style="{left: toPixels(element.uv_offset[0]), top: toPixels(element.uv_offset[1])}"
|
:style="{left: toPixels(element.uv_offset[0]), top: toPixels(element.uv_offset[1])}"
|
||||||
>
|
>
|
||||||
<div class="uv_fill" :style="{left: '-1px', top: toPixels(element.size(2, true), -1), width: toPixels(element.size(2, true)*2 + element.size(0, true)*2, 2), height: toPixels(element.size(1, true), 2)}" />
|
<div class="uv_fill" :style="{left: '-1px', top: toPixels(element.size(2, true), -1), width: toPixels(element.size(2, true)*2 + element.size(0, true)*2, 2), height: toPixels(element.size(1, true), 2)}" />
|
||||||
@ -2477,7 +2463,7 @@ Interface.definePanels(function() {
|
|||||||
<template v-if="element.type == 'mesh'">
|
<template v-if="element.type == 'mesh'">
|
||||||
<div class="mesh_uv_face"
|
<div class="mesh_uv_face"
|
||||||
v-for="(face, key) in filterMeshFaces(element.faces)" :key="element.uuid + ':' + key"
|
v-for="(face, key) in filterMeshFaces(element.faces)" :key="element.uuid + ':' + key"
|
||||||
v-if="face.vertices.length > 2 && face.getTexture() == texture"
|
v-if="face.vertices.length > 2 && (display_uv !== 'selected_faces' || selected_faces.includes(key)) && face.getTexture() == texture"
|
||||||
:class="{selected: selected_faces.includes(key)}"
|
:class="{selected: selected_faces.includes(key)}"
|
||||||
@mousedown.prevent="dragFace(key, $event)"
|
@mousedown.prevent="dragFace(key, $event)"
|
||||||
:style="{
|
:style="{
|
||||||
|
@ -105,7 +105,9 @@ function setupMobilePanelSelector() {
|
|||||||
}},
|
}},
|
||||||
])
|
])
|
||||||
menu.open(this.$refs.mobile_keyboard_menu)
|
menu.open(this.$refs.mobile_keyboard_menu)
|
||||||
}
|
},
|
||||||
|
Condition,
|
||||||
|
getIconNode: Blockbench.getIconNode
|
||||||
},
|
},
|
||||||
template: `
|
template: `
|
||||||
<div id="panel_selector_bar">
|
<div id="panel_selector_bar">
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1168,8 +1168,6 @@
|
|||||||
"action.face_tint.desc": "Enables the tint option for the current face",
|
"action.face_tint.desc": "Enables the tint option for the current face",
|
||||||
"action.slider_face_tint": "Tint Index",
|
"action.slider_face_tint": "Tint Index",
|
||||||
"action.slider_face_tint.desc": "Set the tint index of the current face. -1 means unset.",
|
"action.slider_face_tint.desc": "Set the tint index of the current face. -1 means unset.",
|
||||||
"action.toggle_uv_overlay": "Toggle UV Overlay",
|
|
||||||
"action.toggle_uv_overlay.desc": "When enabled, displays all UV mapping overlays above the texture.",
|
|
||||||
"action.snap_uv_to_pixels": "Snap UV to Pixels",
|
"action.snap_uv_to_pixels": "Snap UV to Pixels",
|
||||||
"action.snap_uv_to_pixels.desc": "Snaps the selected UV vertices to the pixel grid",
|
"action.snap_uv_to_pixels.desc": "Snaps the selected UV vertices to the pixel grid",
|
||||||
"action.remove_blank_faces": "Remove Blank Faces",
|
"action.remove_blank_faces": "Remove Blank Faces",
|
||||||
@ -1352,7 +1350,10 @@
|
|||||||
"menu.preview.maximize": "Maximize",
|
"menu.preview.maximize": "Maximize",
|
||||||
"menu.preview.stop_drag": "Stop Background Positioning",
|
"menu.preview.stop_drag": "Stop Background Positioning",
|
||||||
|
|
||||||
"menu.uv.select": "Select Cubes",
|
"menu.uv.display_uv": "Display UV",
|
||||||
|
"menu.uv.display_uv.selected_faces": "Selected Faces",
|
||||||
|
"menu.uv.display_uv.selected_elements": "All Faces",
|
||||||
|
"menu.uv.display_uv.all_elements": "All Faces on All Elements",
|
||||||
"menu.uv.mapping": "UV Mapping",
|
"menu.uv.mapping": "UV Mapping",
|
||||||
"menu.uv.mapping.export": "Export",
|
"menu.uv.mapping.export": "Export",
|
||||||
"menu.uv.mapping.rotation": "Rotation",
|
"menu.uv.mapping.rotation": "Rotation",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Blockbench",
|
"name": "Blockbench",
|
||||||
"description": "Low-poly modeling and animation software",
|
"description": "Low-poly modeling and animation software",
|
||||||
"version": "4.0.0-beta.3",
|
"version": "4.0.0-beta.4",
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "JannisX11",
|
"name": "JannisX11",
|
||||||
|
Loading…
Reference in New Issue
Block a user