Skip to content

Commit e08491f

Browse files
committed
UV Overlay tool rework (part 2), with small revert from 'part 1'
1 parent 2c475b5 commit e08491f

19 files changed

+65
-31
lines changed

js/interface/settings.js

+9
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,17 @@ const Settings = {
534534
new Setting('display_uv', {category: 'defaults', value: 'none', type: 'select', description: '', options: {
535535
'selected_faces': tl('menu.uv.display_uv.selected_faces'),
536536
'selected_elements': tl('menu.uv.display_uv.selected_elements'),
537+
'all_elements': tl('menu.uv.display_uv.all_elements'),
537538
}, onChange(value) {
538539
Project.display_uv = UVEditor.vue.display_uv = value;
540+
// Affect other tools.
541+
BarItems.edit_mode_uv_overlay.value = value == 'all_elements';
542+
BarItems.edit_mode_uv_overlay.updateEnabledState();
543+
if (BarItems.paint_mode_uv_overlay.value && value == 'selected_faces') {
544+
UVEditor.vue.uv_overlay = false;
545+
BarItems.paint_mode_uv_overlay.value = false;
546+
BarItems.paint_mode_uv_overlay.updateEnabledState();
547+
}
539548
}});
540549
new Setting('default_path', {category: 'defaults', value: false, type: 'click', condition: isApp, icon: 'burst_mode', click: function() { openDefaultTexturePath() }});
541550
new Setting('animation_snap', {category: 'defaults', value: 24, type: 'number'});

js/texturing/uv.js

+38-14
Original file line numberDiff line numberDiff line change
@@ -1314,16 +1314,25 @@ const UVEditor = {
13141314
'zoom_reset'
13151315
]},
13161316
{name: 'menu.uv.display_uv', id: 'display_uv', icon: 'visibility', condition: () => (!Format.image_editor), children: () => {
1317-
let options = ['selected_faces', 'selected_elements'];
1317+
let options = ['selected_faces', 'selected_elements', 'all_elements'];
13181318
return options.map(option => {return {
13191319
id: option,
13201320
name: `menu.uv.display_uv.${option}`,
1321-
icon: UVEditor.vue.display_uv == option ? 'far.fa-dot-circle' : 'far.fa-circle',
1321+
icon: UVEditor.vue.display_uv == option ? 'far.fa-dot-circle' : 'far.fa-circle', // Affected by current.
13221322
condition: !(option == 'selected_faces' && UVEditor.isBoxUV() && !Mesh.selected.length),
13231323
click() {
13241324
Project.display_uv = UVEditor.vue.display_uv = option;
1325+
// Affect settings.
13251326
settings.display_uv.set(option);
13261327
Settings.saveLocalStorages();
1328+
// Affect other tools.
1329+
BarItems.edit_mode_uv_overlay.value = option == 'all_elements';
1330+
BarItems.edit_mode_uv_overlay.updateEnabledState();
1331+
if (BarItems.paint_mode_uv_overlay.value && option == 'selected_faces') {
1332+
UVEditor.vue.uv_overlay = false;
1333+
BarItems.paint_mode_uv_overlay.value = false;
1334+
BarItems.paint_mode_uv_overlay.updateEnabledState();
1335+
}
13271336
}
13281337
}})
13291338
}},
@@ -1349,6 +1358,7 @@ const UVEditor = {
13491358
'uv_maximize',
13501359
'uv_auto',
13511360
'uv_rel_auto',
1361+
'unwrap_mesh_faces',
13521362
'uv_project_from_view',
13531363
'connect_uv_faces',
13541364
'merge_uv_vertices',
@@ -1589,7 +1599,7 @@ BARS.defineActions(function() {
15891599
}
15901600
})
15911601
new Action('unwrap_mesh_faces', {
1592-
icon: 'view_in_ar',
1602+
icon: 'map',
15931603
category: 'uv',
15941604
condition: () => Mesh.selected.length,
15951605
click() {
@@ -2014,24 +2024,35 @@ BARS.defineActions(function() {
20142024
value: true
20152025
})
20162026
new Toggle('edit_mode_uv_overlay', {
2017-
name: 'action.paint_mode_uv_overlay',
20182027
icon: 'stack',
20192028
category: 'uv',
2020-
condition: {modes: ['edit']},
2029+
condition: {modes: ['edit', 'paint']},
20212030
onChange(value) {
20222031
if (value) {
20232032
Project.display_uv = UVEditor.vue.display_uv = 'all_elements';
2033+
// Affect settings.
2034+
settings.display_uv.set('all_elements');
2035+
Settings.saveLocalStorages();
20242036
} else {
2025-
Project.display_uv = UVEditor.vue.display_uv = settings.display_uv.value;
2037+
Project.display_uv = UVEditor.vue.display_uv = 'selected_elements';
2038+
// Affect settings.
2039+
settings.display_uv.set('selected_elements');
2040+
Settings.saveLocalStorages();
20262041
}
20272042
}
20282043
})
20292044
new Toggle('paint_mode_uv_overlay', {
2030-
icon: 'stack',
2045+
icon: 'preview',
20312046
category: 'uv',
20322047
condition: {modes: ['paint'], method: () => !Format.image_editor},
20332048
onChange(value) {
20342049
UVEditor.vue.uv_overlay = value;
2050+
if (value && UVEditor.vue.display_uv == 'selected_faces') {
2051+
Project.display_uv = UVEditor.vue.display_uv = 'selected_elements';
2052+
// Affect settings.
2053+
settings.display_uv.set('selected_elements');
2054+
Settings.saveLocalStorages();
2055+
}
20352056
}
20362057
})
20372058
new Toggle('move_texture_with_uv', {
@@ -3285,10 +3306,14 @@ Interface.definePanels(function() {
32853306
}
32863307
},
32873308
getDisplayedUVElements() {
3288-
if (this.mode == 'uv' || this.uv_overlay) {
3289-
return (this.display_uv === 'all_elements' || this.mode == 'paint')
3290-
? this.all_mappable_elements
3291-
: this.mappable_elements;
3309+
if (this.mode == 'uv') {
3310+
return (this.display_uv === 'all_elements')
3311+
? this.all_mappable_elements
3312+
: this.mappable_elements;
3313+
} else if (this.mode == 'paint' && this.uv_overlay) {
3314+
return (this.display_uv === 'all_elements')
3315+
? this.all_mappable_elements
3316+
: this.mappable_elements;
32923317
} else {
32933318
return [];
32943319
}
@@ -4197,11 +4222,11 @@ Interface.definePanels(function() {
41974222

41984223
Toolbars.uv_editor.toPlace()
41994224

4225+
// Force show tool in the 'locked toolbar'.
42004226
BarItems.paint_mode_uv_overlay.toElement('#toggle_uv_overlay_anchor');
4201-
BarItems.edit_mode_uv_overlay.toElement('#toggle_edit_uv_overlay_anchor');
42024227

4203-
let {slider_bar} = UVEditor.vue.$refs;
42044228

4229+
let {slider_bar} = UVEditor.vue.$refs;
42054230
var onBefore = function() {
42064231
Undo.initEdit({elements: UVEditor.getMappableElements()})
42074232
}
@@ -4335,5 +4360,4 @@ Interface.definePanels(function() {
43354360
onAfter
43364361

43374362
}).toElement(slider_bar);
4338-
BarItems.edit_mode_uv_overlay.toElement(slider_bar);
43394363
})

lang/cz.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@
14071407
"action.new_window.desc": "Opens a new Blockbench window",
14081408
"action.export_collada": "Export Collada Model (dae)",
14091409
"action.export_collada.desc": "Export model and animations as dae file to use it in other 3D applications",
1410-
"action.paint_mode_uv_overlay": "UV Show All",
1410+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14111411
"action.paint_mode_uv_overlay.desc": "Display the UV map as an overlay in paint mode",
14121412
"action.bake_animation_into_model": "Bake Animation into Model",
14131413
"action.bake_animation_into_model.desc": "Bake the currently displayed animation frame into the model. Only applies rotation and position, scale is ignored.",

lang/de.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@
14071407
"action.new_window.desc": "Öffnet ein neues Blockbench-Fenster",
14081408
"action.export_collada": "Collada-Modell (dae) exportieren",
14091409
"action.export_collada.desc": "Exportiert das Modell als dae-Datei zur Weiterverwendung in anderen 3D-Programmen",
1410-
"action.paint_mode_uv_overlay": "UV Show All",
1410+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14111411
"action.paint_mode_uv_overlay.desc": "Überlagert die UV-Maps der Elemente im Malen-Modus",
14121412
"action.bake_animation_into_model": "Animationen auf Modell anwenden",
14131413
"action.bake_animation_into_model.desc": "Wendet die aktuell angezeigte Animation auf das Modell an. Nur Position und Drehung werden verwendet, Größe wird ignoriert",

lang/en.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1741,7 +1741,8 @@
17411741
"action.uv_cycle.desc": "Cycle through the order of UV vertices without changing the UV positions",
17421742
"action.uv_cycle_invert": "Cycle Invert UV",
17431743
"action.uv_cycle_invert.desc": "Reverse the order of UV vertices without changing the UV positions",
1744-
"action.paint_mode_uv_overlay": "UV Show All",
1744+
"action.edit_mode_uv_overlay": "UV Show All",
1745+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
17451746
"action.paint_mode_uv_overlay.desc": "Display the UV map as an overlay in paint mode",
17461747
"action.snap_uv_to_image_bounds": "Snap UV to image bounds",
17471748
"action.remove_blank_faces": "Remove Blank Faces",

lang/es.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@
14071407
"action.new_window.desc": "Abrir una nueva ventana en Blockbench",
14081408
"action.export_collada": "Exportar modelo Collada (dae)",
14091409
"action.export_collada.desc": "Exportar modelo y animaciones como archivo dae para usarlo en otras aplicaciones 3D",
1410-
"action.paint_mode_uv_overlay": "UV Show All",
1410+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14111411
"action.paint_mode_uv_overlay.desc": "Muestra el mapa UV como una superposición en el modo de pintura",
14121412
"action.bake_animation_into_model": "Hornear animación en modelo",
14131413
"action.bake_animation_into_model.desc": "Hornea la animación mostrada actualmente al modelo. Solo aplica a la rotación y la posición, se ignora la escala.",

lang/fr.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@
14071407
"action.new_window.desc": "Ouvre une nouvelle fenêtre Blockbench",
14081408
"action.export_collada": "Exporter modèle Collada (dae)",
14091409
"action.export_collada.desc": "Exporte le modèle et les animations dans un fichier dae pour l'utiliser dans d'autres logiciels 3D",
1410-
"action.paint_mode_uv_overlay": "UV Show All",
1410+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14111411
"action.paint_mode_uv_overlay.desc": "Affiche la carte UV sous forme d'overlay en mode Dessin",
14121412
"action.bake_animation_into_model": "Intégrer l'animation au modèle",
14131413
"action.bake_animation_into_model.desc": "Intègre l'image d'animation actuellement affichée au modèle. Seules la rotation et la position s'appliquent, la mise à l'échelle est ignorée.",

lang/it.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@
14071407
"action.new_window.desc": "Opens a new Blockbench window",
14081408
"action.export_collada": "Export Collada Model (dae)",
14091409
"action.export_collada.desc": "Export model and animations as dae file to use it in other 3D applications",
1410-
"action.paint_mode_uv_overlay": "UV Show All",
1410+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14111411
"action.paint_mode_uv_overlay.desc": "Display the UV map as an overlay in paint mode",
14121412
"action.bake_animation_into_model": "Bake Animation into Model",
14131413
"action.bake_animation_into_model.desc": "Bake the currently displayed animation frame into the model. Only applies rotation and position, scale is ignored.",

lang/ja.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@
14071407
"action.new_window.desc": "新しい Blockbench ウィンドウを開きます",
14081408
"action.export_collada": "Collada Model (dae)",
14091409
"action.export_collada.desc": "モデルとアニメーションを dae ファイルとして書き出します",
1410-
"action.paint_mode_uv_overlay": "UV Show All",
1410+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14111411
"action.paint_mode_uv_overlay.desc": "ペイントモードで UV マップをオーバーレイとして表示します",
14121412
"action.bake_animation_into_model": "アニメーションをモデルに焼き付ける",
14131413
"action.bake_animation_into_model.desc": "現在表示されているアニメーションフレームをモデルにベイク処理します。回転と位置のみを適用し、スケールは無視されます。",

lang/ko.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@
14071407
"action.new_window.desc": "새로운 Blockbench 창 열기",
14081408
"action.export_collada": "Collada 모델 (dae) 내보내기",
14091409
"action.export_collada.desc": "모델 및 애니메이션을 dae 파일로 내보내서 다른 3D 응용 프로그램에서 사용",
1410-
"action.paint_mode_uv_overlay": "UV Show All",
1410+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14111411
"action.paint_mode_uv_overlay.desc": "페인트 모드에서 UV 맵을 오버레이로 표시",
14121412
"action.bake_animation_into_model": "애니메이션을 모델로 만들기",
14131413
"action.bake_animation_into_model.desc": "현재 표시된 애니메이션 프레임을 모델로 만듭니다. 회전 및 위치만 적용하고 크기는 무시됩니다.",

lang/nl.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@
14071407
"action.new_window.desc": "Opent een nieuw Blockbench venster",
14081408
"action.export_collada": "Exporteer Collada Model (dae)",
14091409
"action.export_collada.desc": "Exporteer modellen en animaties als .dae-bestand voor gebruik in andere 3D-applicaties",
1410-
"action.paint_mode_uv_overlay": "UV Show All",
1410+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14111411
"action.paint_mode_uv_overlay.desc": "De UV-map weergeven als een overlay in verfmodus",
14121412
"action.bake_animation_into_model": "Bak Animatie in Model",
14131413
"action.bake_animation_into_model.desc": "Bak het huidig weergegeven animatieframe in het model. Past alleen rotatie en positie toe, schaal wordt genegeerd.",

lang/pl.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@
14071407
"action.new_window.desc": "Otwiera nowe okno Blockbencha",
14081408
"action.export_collada": "Eksportuj model Collada (dae)",
14091409
"action.export_collada.desc": "Eksportuj model i animacje jako plik dae, aby używać ich w innych programach 3D",
1410-
"action.paint_mode_uv_overlay": "UV Show All",
1410+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14111411
"action.paint_mode_uv_overlay.desc": "Display the UV map as an overlay in paint mode",
14121412
"action.bake_animation_into_model": "Bake Animation into Model",
14131413
"action.bake_animation_into_model.desc": "Bake the currently displayed animation frame into the model. Only applies rotation and position, scale is ignored.",

lang/pt.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,7 @@
14081408
"action.new_window.desc": "abrir nova aba do blockbench",
14091409
"action.export_collada": "exportar collada modelo (dae)",
14101410
"action.export_collada.desc": "exportar collada modelo (dae) para usar em outras aplicações",
1411-
"action.paint_mode_uv_overlay": "UV Show All",
1411+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14121412
"action.paint_mode_uv_overlay.desc": "Display the UV map as an overlay in paint mode",
14131413
"action.bake_animation_into_model": "Bake Animation into Model",
14141414
"action.bake_animation_into_model.desc": "Bake the currently displayed animation frame into the model. Only applies rotation and position, scale is ignored.",

lang/ru.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@
14071407
"action.new_window.desc": "Открывает новое окно Blockbench",
14081408
"action.export_collada": "Экспортировать Collada модель (dae)",
14091409
"action.export_collada.desc": "Экспортировать модель или анимацию в dae файл, что бы использовать в других редакторах 3D",
1410-
"action.paint_mode_uv_overlay": "UV Show All",
1410+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14111411
"action.paint_mode_uv_overlay.desc": "Отображение UV-карты в виде наложения в режиме рисования",
14121412
"action.bake_animation_into_model": "Запечь анимацию в модель",
14131413
"action.bake_animation_into_model.desc": "Запеките текущий отображаемый кадр анимации в модель. Применяется только вращение и положение, масштаб игнорируется.",

lang/sv.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@
14071407
"action.new_window.desc": "Opens a new Blockbench window",
14081408
"action.export_collada": "Export Collada Model (dae)",
14091409
"action.export_collada.desc": "Export model and animations as dae file to use it in other 3D applications",
1410-
"action.paint_mode_uv_overlay": "UV Show All",
1410+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14111411
"action.paint_mode_uv_overlay.desc": "Display the UV map as an overlay in paint mode",
14121412
"action.bake_animation_into_model": "Bake Animation into Model",
14131413
"action.bake_animation_into_model.desc": "Bake the currently displayed animation frame into the model. Only applies rotation and position, scale is ignored.",

lang/uk.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@
14071407
"action.new_window.desc": "Відкриває нове вікно Blockbench",
14081408
"action.export_collada": "Експортувати модель Collada (DAE)",
14091409
"action.export_collada.desc": "Експортувати модель і анімацію як файл DAE, щоб використовувати його в інших 3D-застосунках",
1410-
"action.paint_mode_uv_overlay": "UV Show All",
1410+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14111411
"action.paint_mode_uv_overlay.desc": "Показати мапу UV як накладання в режимі малювання",
14121412
"action.bake_animation_into_model": "Bake Animation into Model",
14131413
"action.bake_animation_into_model.desc": "Bake the currently displayed animation frame into the model. Only applies rotation and position, scale is ignored.",

lang/vi.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@
14071407
"action.new_window.desc": "Mở một cửa sổ Blockbench mới",
14081408
"action.export_collada": "Xuất mô hình Collada (dae)",
14091409
"action.export_collada.desc": "Xuất mô hình và hoạt ảnh dưới dạng tệp dae để sử dụng nó trong các ứng dụng 3D khác",
1410-
"action.paint_mode_uv_overlay": "UV Show All",
1410+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14111411
"action.paint_mode_uv_overlay.desc": "Hiển thị bản đồ UV dưới dạng lớp phủ trong chế độ sơn",
14121412
"action.bake_animation_into_model": "Đưa hoạt ảnh vào mô hình",
14131413
"action.bake_animation_into_model.desc": "Đưa khung hoạt ảnh hiện đang hiển thị vào mô hình. Chỉ áp dụng xoay và vị trí, bỏ qua tỷ lệ.",

lang/zh.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@
14071407
"action.new_window.desc": "打开新的 Blockbench 窗口",
14081408
"action.export_collada": "导出Collada模型(dae)",
14091409
"action.export_collada.desc": "将模型导出为dae格式以用于其他3D软件",
1410-
"action.paint_mode_uv_overlay": "UV Show All",
1410+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14111411
"action.paint_mode_uv_overlay.desc": "在编辑模式下以覆盖形式显示 UV 贴图",
14121412
"action.bake_animation_into_model": "烘焙动画到模型",
14131413
"action.bake_animation_into_model.desc": "将当前显示的动画帧复制到模型中。只应用旋转和位置,忽略缩放。",

lang/zh_tw.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@
14071407
"action.new_window.desc": "開啟新Blockbench視窗",
14081408
"action.export_collada": "匯出為Collada Model (dae)",
14091409
"action.export_collada.desc": "將模型和動畫匯出為dae檔,以在其他3D應用程式中使用",
1410-
"action.paint_mode_uv_overlay": "UV Show All",
1410+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14111411
"action.paint_mode_uv_overlay.desc": "在繪圖模式中顯示UV覆蓋",
14121412
"action.bake_animation_into_model": "將動畫烘培成模型",
14131413
"action.bake_animation_into_model.desc": "將目前的動畫關鍵影格烘焙至模型上。僅包含旋轉和位置,不包含比例。",

0 commit comments

Comments
 (0)