Skip to content

Commit 19cb4cd

Browse files
committed
UV Overlay tool rework (part 2), with small revert from 'part 1'
# Conflicts: # lang/vi.json # lang/zh.json # lang/zh_tw.json
1 parent 671bc75 commit 19cb4cd

File tree

16 files changed

+62
-28
lines changed

16 files changed

+62
-28
lines changed

js/interface/settings.js

+9
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,17 @@ const Settings = {
542542
new Setting('display_uv', {category: 'defaults', value: 'none', type: 'select', description: '', options: {
543543
'selected_faces': tl('menu.uv.display_uv.selected_faces'),
544544
'selected_elements': tl('menu.uv.display_uv.selected_elements'),
545+
'all_elements': tl('menu.uv.display_uv.all_elements'),
545546
}, onChange(value) {
546547
Project.display_uv = UVEditor.vue.display_uv = value;
548+
// Affect other tools.
549+
BarItems.edit_mode_uv_overlay.value = value == 'all_elements';
550+
BarItems.edit_mode_uv_overlay.updateEnabledState();
551+
if (BarItems.paint_mode_uv_overlay.value && value == 'selected_faces') {
552+
UVEditor.vue.uv_overlay = false;
553+
BarItems.paint_mode_uv_overlay.value = false;
554+
BarItems.paint_mode_uv_overlay.updateEnabledState();
555+
}
547556
}});
548557
new Setting('default_path', {category: 'defaults', value: false, type: 'click', condition: isApp, icon: 'burst_mode', click: function() { openDefaultTexturePath() }});
549558
new Setting('animation_snap', {category: 'defaults', value: 24, type: 'number'});

js/texturing/uv.js

+38-14
Original file line numberDiff line numberDiff line change
@@ -1404,16 +1404,25 @@ const UVEditor = {
14041404
'zoom_reset'
14051405
]},
14061406
{name: 'menu.uv.display_uv', id: 'display_uv', icon: 'visibility', condition: () => (!Format.image_editor), children: () => {
1407-
let options = ['selected_faces', 'selected_elements'];
1407+
let options = ['selected_faces', 'selected_elements', 'all_elements'];
14081408
return options.map(option => {return {
14091409
id: option,
14101410
name: `menu.uv.display_uv.${option}`,
1411-
icon: UVEditor.vue.display_uv == option ? 'far.fa-dot-circle' : 'far.fa-circle',
1411+
icon: UVEditor.vue.display_uv == option ? 'far.fa-dot-circle' : 'far.fa-circle', // Affected by current.
14121412
condition: !(option == 'selected_faces' && UVEditor.isBoxUV() && !Mesh.selected.length),
14131413
click() {
14141414
Project.display_uv = UVEditor.vue.display_uv = option;
1415+
// Affect settings.
14151416
settings.display_uv.set(option);
14161417
Settings.saveLocalStorages();
1418+
// Affect other tools.
1419+
BarItems.edit_mode_uv_overlay.value = option == 'all_elements';
1420+
BarItems.edit_mode_uv_overlay.updateEnabledState();
1421+
if (BarItems.paint_mode_uv_overlay.value && option == 'selected_faces') {
1422+
UVEditor.vue.uv_overlay = false;
1423+
BarItems.paint_mode_uv_overlay.value = false;
1424+
BarItems.paint_mode_uv_overlay.updateEnabledState();
1425+
}
14171426
}
14181427
}})
14191428
}},
@@ -1439,6 +1448,7 @@ const UVEditor = {
14391448
'uv_maximize',
14401449
'uv_auto',
14411450
'uv_rel_auto',
1451+
'unwrap_mesh_faces',
14421452
'uv_project_from_view',
14431453
'connect_uv_faces',
14441454
'merge_uv_vertices',
@@ -1698,7 +1708,7 @@ BARS.defineActions(function() {
16981708
}
16991709
})
17001710
new Action('unwrap_mesh_faces', {
1701-
icon: 'view_in_ar',
1711+
icon: 'map',
17021712
category: 'uv',
17031713
condition: () => Mesh.selected.length,
17041714
click() {
@@ -2171,24 +2181,35 @@ BARS.defineActions(function() {
21712181
value: true
21722182
})
21732183
new Toggle('edit_mode_uv_overlay', {
2174-
name: 'action.paint_mode_uv_overlay',
21752184
icon: 'stack',
21762185
category: 'uv',
2177-
condition: {modes: ['edit']},
2186+
condition: {modes: ['edit', 'paint']},
21782187
onChange(value) {
21792188
if (value) {
21802189
Project.display_uv = UVEditor.vue.display_uv = 'all_elements';
2190+
// Affect settings.
2191+
settings.display_uv.set('all_elements');
2192+
Settings.saveLocalStorages();
21812193
} else {
2182-
Project.display_uv = UVEditor.vue.display_uv = settings.display_uv.value;
2194+
Project.display_uv = UVEditor.vue.display_uv = 'selected_elements';
2195+
// Affect settings.
2196+
settings.display_uv.set('selected_elements');
2197+
Settings.saveLocalStorages();
21832198
}
21842199
}
21852200
})
21862201
new Toggle('paint_mode_uv_overlay', {
2187-
icon: 'stack',
2202+
icon: 'preview',
21882203
category: 'uv',
21892204
condition: {modes: ['paint'], method: () => !Format.image_editor},
21902205
onChange(value) {
21912206
UVEditor.vue.uv_overlay = value;
2207+
if (value && UVEditor.vue.display_uv == 'selected_faces') {
2208+
Project.display_uv = UVEditor.vue.display_uv = 'selected_elements';
2209+
// Affect settings.
2210+
settings.display_uv.set('selected_elements');
2211+
Settings.saveLocalStorages();
2212+
}
21922213
}
21932214
})
21942215
new Toggle('move_texture_with_uv', {
@@ -3455,10 +3476,14 @@ Interface.definePanels(function() {
34553476
}
34563477
},
34573478
getDisplayedUVElements() {
3458-
if (this.mode == 'uv' || this.uv_overlay) {
3459-
return (this.display_uv === 'all_elements' || this.mode == 'paint')
3460-
? this.all_mappable_elements
3461-
: this.mappable_elements;
3479+
if (this.mode == 'uv') {
3480+
return (this.display_uv === 'all_elements')
3481+
? this.all_mappable_elements
3482+
: this.mappable_elements;
3483+
} else if (this.mode == 'paint' && this.uv_overlay) {
3484+
return (this.display_uv === 'all_elements')
3485+
? this.all_mappable_elements
3486+
: this.mappable_elements;
34623487
} else {
34633488
return [];
34643489
}
@@ -4373,11 +4398,11 @@ Interface.definePanels(function() {
43734398

43744399
Toolbars.uv_editor.toPlace()
43754400

4401+
// Force show tool in the 'locked toolbar'.
43764402
BarItems.paint_mode_uv_overlay.toElement('#toggle_uv_overlay_anchor');
4377-
BarItems.edit_mode_uv_overlay.toElement('#toggle_edit_uv_overlay_anchor');
43784403

4379-
let {slider_bar} = UVEditor.vue.$refs;
43804404

4405+
let {slider_bar} = UVEditor.vue.$refs;
43814406
var onBefore = function() {
43824407
Undo.initEdit({elements: UVEditor.getMappableElements()})
43834408
}
@@ -4511,5 +4536,4 @@ Interface.definePanels(function() {
45114536
onAfter
45124537

45134538
}).toElement(slider_bar);
4514-
BarItems.edit_mode_uv_overlay.toElement(slider_bar);
45154539
})

lang/cz.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1405,7 +1405,7 @@
14051405
"action.new_window.desc": "Opens a new Blockbench window",
14061406
"action.export_collada": "Export Collada Model (dae)",
14071407
"action.export_collada.desc": "Export model and animations as dae file to use it in other 3D applications",
1408-
"action.paint_mode_uv_overlay": "UV Show All",
1408+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14091409
"action.paint_mode_uv_overlay.desc": "Display the UV map as an overlay in paint mode",
14101410
"action.bake_animation_into_model": "Bake Animation into Model",
14111411
"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
@@ -1405,7 +1405,7 @@
14051405
"action.new_window.desc": "Öffnet ein neues Blockbench-Fenster",
14061406
"action.export_collada": "Collada-Modell (dae) exportieren",
14071407
"action.export_collada.desc": "Exportiert das Modell als dae-Datei zur Weiterverwendung in anderen 3D-Programmen",
1408-
"action.paint_mode_uv_overlay": "UV Show All",
1408+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14091409
"action.paint_mode_uv_overlay.desc": "Überlagert die UV-Maps der Elemente im Malen-Modus",
14101410
"action.bake_animation_into_model": "Animationen auf Modell anwenden",
14111411
"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
@@ -1798,7 +1798,8 @@
17981798
"action.uv_cycle.desc": "Cycle through the order of UV vertices without changing the UV positions",
17991799
"action.uv_cycle_invert": "Cycle Invert UV",
18001800
"action.uv_cycle_invert.desc": "Reverse the order of UV vertices without changing the UV positions",
1801-
"action.paint_mode_uv_overlay": "UV Show All",
1801+
"action.edit_mode_uv_overlay": "UV Show All",
1802+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
18021803
"action.paint_mode_uv_overlay.desc": "Display the UV map as an overlay in paint mode",
18031804
"action.snap_uv_to_image_bounds": "Snap UV to image bounds",
18041805
"action.remove_blank_faces": "Remove Blank Faces",

lang/es.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1405,7 +1405,7 @@
14051405
"action.new_window.desc": "Abrir una nueva ventana en Blockbench",
14061406
"action.export_collada": "Exportar modelo Collada (dae)",
14071407
"action.export_collada.desc": "Exportar modelo y animaciones como archivo dae para usarlo en otras aplicaciones 3D",
1408-
"action.paint_mode_uv_overlay": "UV Show All",
1408+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14091409
"action.paint_mode_uv_overlay.desc": "Muestra el mapa UV como una superposición en el modo de pintura",
14101410
"action.bake_animation_into_model": "Hornear animación en modelo",
14111411
"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
@@ -1405,7 +1405,7 @@
14051405
"action.new_window.desc": "Ouvre une nouvelle fenêtre Blockbench",
14061406
"action.export_collada": "Exporter modèle Collada (dae)",
14071407
"action.export_collada.desc": "Exporte le modèle et les animations dans un fichier dae pour l'utiliser dans d'autres logiciels 3D",
1408-
"action.paint_mode_uv_overlay": "UV Show All",
1408+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14091409
"action.paint_mode_uv_overlay.desc": "Affiche la carte UV sous forme d'overlay en mode Dessin",
14101410
"action.bake_animation_into_model": "Intégrer l'animation au modèle",
14111411
"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
@@ -1405,7 +1405,7 @@
14051405
"action.new_window.desc": "Opens a new Blockbench window",
14061406
"action.export_collada": "Export Collada Model (dae)",
14071407
"action.export_collada.desc": "Export model and animations as dae file to use it in other 3D applications",
1408-
"action.paint_mode_uv_overlay": "UV Show All",
1408+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14091409
"action.paint_mode_uv_overlay.desc": "Display the UV map as an overlay in paint mode",
14101410
"action.bake_animation_into_model": "Bake Animation into Model",
14111411
"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
@@ -1405,7 +1405,7 @@
14051405
"action.new_window.desc": "新しい Blockbench ウィンドウを開きます",
14061406
"action.export_collada": "Collada Model (dae)",
14071407
"action.export_collada.desc": "モデルとアニメーションを dae ファイルとして書き出します",
1408-
"action.paint_mode_uv_overlay": "UV Show All",
1408+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14091409
"action.paint_mode_uv_overlay.desc": "ペイントモードで UV マップをオーバーレイとして表示します",
14101410
"action.bake_animation_into_model": "アニメーションをモデルに焼き付ける",
14111411
"action.bake_animation_into_model.desc": "現在表示されているアニメーションフレームをモデルにベイク処理します。回転と位置のみを適用し、スケールは無視されます。",

lang/ko.json

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

lang/nl.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1405,7 +1405,7 @@
14051405
"action.new_window.desc": "Opent een nieuw Blockbench venster",
14061406
"action.export_collada": "Exporteer Collada Model (dae)",
14071407
"action.export_collada.desc": "Exporteer modellen en animaties als .dae-bestand voor gebruik in andere 3D-applicaties",
1408-
"action.paint_mode_uv_overlay": "UV Show All",
1408+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14091409
"action.paint_mode_uv_overlay.desc": "De UV-map weergeven als een overlay in verfmodus",
14101410
"action.bake_animation_into_model": "Bak Animatie in Model",
14111411
"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
@@ -1405,7 +1405,7 @@
14051405
"action.new_window.desc": "Otwiera nowe okno Blockbencha",
14061406
"action.export_collada": "Eksportuj model Collada (dae)",
14071407
"action.export_collada.desc": "Eksportuj model i animacje jako plik dae, aby używać ich w innych programach 3D",
1408-
"action.paint_mode_uv_overlay": "UV Show All",
1408+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14091409
"action.paint_mode_uv_overlay.desc": "Display the UV map as an overlay in paint mode",
14101410
"action.bake_animation_into_model": "Bake Animation into Model",
14111411
"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
@@ -1406,7 +1406,7 @@
14061406
"action.new_window.desc": "abrir nova aba do blockbench",
14071407
"action.export_collada": "exportar collada modelo (dae)",
14081408
"action.export_collada.desc": "exportar collada modelo (dae) para usar em outras aplicações",
1409-
"action.paint_mode_uv_overlay": "UV Show All",
1409+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14101410
"action.paint_mode_uv_overlay.desc": "Display the UV map as an overlay in paint mode",
14111411
"action.bake_animation_into_model": "Bake Animation into Model",
14121412
"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
@@ -1405,7 +1405,7 @@
14051405
"action.new_window.desc": "Открывает новое окно Blockbench",
14061406
"action.export_collada": "Экспортировать Collada модель (dae)",
14071407
"action.export_collada.desc": "Экспортировать модель или анимацию в dae файл, что бы использовать в других редакторах 3D",
1408-
"action.paint_mode_uv_overlay": "UV Show All",
1408+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14091409
"action.paint_mode_uv_overlay.desc": "Отображение UV-карты в виде наложения в режиме рисования",
14101410
"action.bake_animation_into_model": "Запечь анимацию в модель",
14111411
"action.bake_animation_into_model.desc": "Запеките текущий отображаемый кадр анимации в модель. Применяется только вращение и положение, масштаб игнорируется.",

lang/sv.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1405,7 +1405,7 @@
14051405
"action.new_window.desc": "Opens a new Blockbench window",
14061406
"action.export_collada": "Export Collada Model (dae)",
14071407
"action.export_collada.desc": "Export model and animations as dae file to use it in other 3D applications",
1408-
"action.paint_mode_uv_overlay": "UV Show All",
1408+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14091409
"action.paint_mode_uv_overlay.desc": "Display the UV map as an overlay in paint mode",
14101410
"action.bake_animation_into_model": "Bake Animation into Model",
14111411
"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
@@ -1405,7 +1405,7 @@
14051405
"action.new_window.desc": "Відкриває нове вікно Blockbench",
14061406
"action.export_collada": "Експортувати модель Collada (DAE)",
14071407
"action.export_collada.desc": "Експортувати модель і анімацію як файл DAE, щоб використовувати його в інших 3D-застосунках",
1408-
"action.paint_mode_uv_overlay": "UV Show All",
1408+
"action.paint_mode_uv_overlay": "UV Show in Paint Mode",
14091409
"action.paint_mode_uv_overlay.desc": "Показати мапу UV як накладання в режимі малювання",
14101410
"action.bake_animation_into_model": "Bake Animation into Model",
14111411
"action.bake_animation_into_model.desc": "Bake the currently displayed animation frame into the model. Only applies rotation and position, scale is ignored.",

0 commit comments

Comments
 (0)