Add toggle for UV overlay in edit mode

This commit is contained in:
JannisX11 2023-11-20 21:13:30 +01:00
parent 7425b2c8b4
commit 5340576196
4 changed files with 29 additions and 1 deletions

View File

@ -2341,6 +2341,10 @@ span.controller_state_section_info {
.bar.uv_editor_sliders > .tool {
flex-grow: 1;
}
.bar.uv_editor_sliders > .edit_mode_uv_overlay {
flex-grow: 0;
margin-left: auto;
}
.uv_painter_info {
display: flex;
}

View File

@ -198,6 +198,8 @@ class ModelProject {
UVEditor.vue.selected_faces = this.selected_faces;
UVEditor.vue.box_uv = this.box_uv;
UVEditor.vue.display_uv = this.display_uv;
BarItems.edit_mode_uv_overlay.value = this.display_uv == 'all_elements';
BarItems.edit_mode_uv_overlay.updateEnabledState();
for (let uuid in this.mesh_selection) {
UVEditor.vue.selected_vertices[uuid] = this.mesh_selection[uuid].vertices;
}

View File

@ -1896,9 +1896,28 @@ BARS.defineActions(function() {
Undo.finishEdit('Snap UV to pixel grid')
}
})
new Toggle('edit_mode_uv_overlay', {
name: 'action.paint_mode_uv_overlay',
description: 'action.edit_mode_uv_overlay.desc',
icon: 'stack',
category: 'uv',
condition: {modes: ['edit']},
onChange(value) {
if (value) {
Project.display_uv = UVEditor.vue.display_uv = 'all_elements';
settings.show_only_selected_uv.set(true);
} else {
if (settings.show_only_selected_uv.value) {
Project.display_uv = UVEditor.vue.display_uv = 'selected_faces';
} else {
Project.display_uv = UVEditor.vue.display_uv = 'selected_elements';
}
}
}
})
new Toggle('paint_mode_uv_overlay', {
icon: 'stack',
category: 'animation',
category: 'uv',
condition: {modes: ['paint'], method: () => !Format.image_editor},
onChange(value) {
UVEditor.vue.uv_overlay = value;
@ -3958,6 +3977,7 @@ Interface.definePanels(function() {
Toolbars.uv_editor.toPlace()
BarItems.paint_mode_uv_overlay.toElement('#toggle_uv_overlay_anchor');
BarItems.edit_mode_uv_overlay.toElement('#toggle_edit_uv_overlay_anchor');
let {slider_bar} = UVEditor.vue.$refs;
@ -4095,4 +4115,5 @@ Interface.definePanels(function() {
onAfter
}).toElement(slider_bar);
BarItems.edit_mode_uv_overlay.toElement(slider_bar);
})

View File

@ -1660,6 +1660,7 @@
"action.snap_uv_to_pixels.desc": "Snaps the selected UV vertices to the pixel grid",
"action.paint_mode_uv_overlay": "UV Overlay",
"action.paint_mode_uv_overlay.desc": "Display the UV map as an overlay in paint mode",
"action.edit_mode_uv_overlay.desc": "Display the UV map as an overlay in edit mode",
"action.remove_blank_faces": "Remove Blank Faces",
"action.remove_blank_faces.desc": "Deletes all untextured faces of the selection",
"action.auto_set_cullfaces": "Set Cullfaces Automatically",