From 4f4a39a756f5bd7bd5f5a8ed80ff61ccb2100064 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 13 Nov 2026 20:36:23 -0800 Subject: [PATCH] 3D: Bevel Shape labels an effect's own custom bevel apart from a file bevel of the same name When the bevels file lists a bevel with the name of the effect's own custom bevel but other points, the effect's entry is now shown as " (document)", and the menu marks the current entry by its position instead of its label, so two entries are no longer both shown as selected. --- crates/ui-egui/src/dialogs/revolve.rs | 20 +++++++++++++++++--- crates/ui-egui/src/i18n/bg.tsv | 1 + crates/ui-egui/src/i18n/bs.tsv | 1 + crates/ui-egui/src/i18n/ca.tsv | 1 + crates/ui-egui/src/i18n/cs.tsv | 1 + crates/ui-egui/src/i18n/da.tsv | 1 + crates/ui-egui/src/i18n/de.tsv | 1 + crates/ui-egui/src/i18n/el.tsv | 1 + crates/ui-egui/src/i18n/es.tsv | 1 + crates/ui-egui/src/i18n/fi.tsv | 1 + crates/ui-egui/src/i18n/fr.tsv | 1 + crates/ui-egui/src/i18n/hi.tsv | 1 + crates/ui-egui/src/i18n/hu.tsv | 1 + crates/ui-egui/src/i18n/id.tsv | 1 + crates/ui-egui/src/i18n/it.tsv | 1 + crates/ui-egui/src/i18n/ja.tsv | 1 + crates/ui-egui/src/i18n/ka.tsv | 1 + crates/ui-egui/src/i18n/ko.tsv | 1 + crates/ui-egui/src/i18n/nl.tsv | 1 + crates/ui-egui/src/i18n/pl.tsv | 1 + crates/ui-egui/src/i18n/pt-br.tsv | 1 + crates/ui-egui/src/i18n/ru.tsv | 1 + crates/ui-egui/src/i18n/sv.tsv | 1 + crates/ui-egui/src/i18n/tr.tsv | 1 + crates/ui-egui/src/i18n/uk.tsv | 1 + crates/ui-egui/src/i18n/vi.tsv | 1 + crates/ui-egui/src/i18n/zh-hans.tsv | 1 + crates/ui-egui/src/i18n/zh-hant.tsv | 1 + crates/ui-egui/src/panels/tests_three_d.rs | 22 ++++++++++++++++++++++ 29 files changed, 66 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/dialogs/revolve.rs b/crates/ui-egui/src/dialogs/revolve.rs index 1349146f59..67cd08fda2 100644 --- a/crates/ui-egui/src/dialogs/revolve.rs +++ b/crates/ui-egui/src/dialogs/revolve.rs @@ -244,7 +244,7 @@ pub(crate) type BevelChoice = (String, Value, Option<(String, Value)>); /// The entries of [`bevel_choice`]'s menu for form `fields`, and how many are built in. The /// built-in labels are translated; custom bevels show their names as they are. The effect's own /// custom bevel, the panel's [`OWN_BEVEL`] else the form's, is listed unless the file lists it by -/// name with the same points. +/// name with the same points; while another entry has its label, " (document)" is added to it. pub(crate) fn bevel_options(app: &VectorcraftApp, fields: &serde_json::Map, effect: &str) -> (Vec, usize) { let mut options: Vec = super::effect::own_choices(effect, "bevel", false) .unwrap_or_default() @@ -266,7 +266,11 @@ pub(crate) fn bevel_options(app: &VectorcraftApp, fields: &serde_json::Map = options.iter().map(|(l, _, _)| l.as_str()).collect(); let shown = current.and_then(|i| labels.get(i)).copied().unwrap_or(""); let width = VALUE_W + rail_width(ui) + 6.0; - if let Some(k) = widgets::dropdown_names(ui, ("three-d-choice", KEY), shown, &labels, width) + // Marked by index, not label: a custom bevel's name can match another entry's label. + let picked = widgets::combo(ui, ("three-d-choice", KEY), shown, width, |ui| { + let mut chosen = None; + for (i, l) in labels.iter().enumerate() { + if ui.add(egui::Button::selectable(current == Some(i), *l)).clicked() { + chosen = Some(i); + } + } + chosen + }); + if let Some(k) = picked && let Some((_, v, c)) = options.get(k) { d.fields.insert(KEY.into(), v.clone()); diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index f02f16bf8d..ae3b94d5bd 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -2863,6 +2863,7 @@ digits Malayalam Малаялам Bevels Фаски Edit Bevels Редактиране на фаски Edit Bevels… Редактиране на фаски… + {name} (document) {name} (документ) Reload Bevels Презареждане на фаски Reset Rotate View Нулиране на изгледа на завъртане Rotate View to Selection Завъртане на изгледа спрямо селекцията diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 67a7bda96b..951f200c97 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -3969,6 +3969,7 @@ theme Appearance Izgled Bevels Zakošenja Edit Bevels Uredi zakošenja Edit Bevels… Uredi zakošenja… + {name} (document) {name} (dokument) Reload Bevels Ponovo učitaj zakošenja Stroke Options Opcije poteza Width Profiles Profili širine diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index f0fcf70843..1a5bd0db89 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -3653,6 +3653,7 @@ digits Malayalam Malaiàlam Bevels Bisells Edit Bevels Edita els bisells Edit Bevels… Edita els bisells… + {name} (document) {name} (document) Reload Bevels Torna a carregar els bisells Reset Rotate View Restableix la rotació de la vista Reset Ruler Origin Restableix l’origen de les regles diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 7551245ad4..7cd2f320d0 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -4025,6 +4025,7 @@ theme Appearance Motiv Bevels Zkosení Edit Bevels Upravit zkosení Edit Bevels… Upravit zkosení… + {name} (document) {name} (dokument) Reload Bevels Znovu načíst zkosení Stroke Options Možnosti tahu Width Profiles Profily šířky diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 647029e27b..4497c29285 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -3742,6 +3742,7 @@ theme Appearance Udseende Bevels Facetter Edit Bevels Redigér facetter Edit Bevels… Redigér facetter… + {name} (document) {name} (dokument) Reload Bevels Genindlæs facetter Stroke Options Konturindstillinger Width Profiles Breddeprofiler diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 0ee03555da..77bd9379c1 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -2908,6 +2908,7 @@ digits Malayalam Malayalam Bevels Abgeflachte Kanten Edit Bevels Abgeflachte Kanten bearbeiten Edit Bevels… Abgeflachte Kanten bearbeiten… + {name} (document) {name} (Dokument) Reload Bevels Abgeflachte Kanten neu laden Rotate View Ansicht drehen Reset Rotate View Ansichtsdrehung zurücksetzen diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 6c33aa87dd..d1accb5171 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -3645,6 +3645,7 @@ digits Malayalam Μαλαγιάλαμ Bevels Λοξοτμήσεις Edit Bevels Επεξεργασία λοξοτμήσεων Edit Bevels… Επεξεργασία λοξοτμήσεων… + {name} (document) {name} (έγγραφο) Reload Bevels Επαναφόρτωση λοξοτμήσεων Reset Rotate View Επαναφορά περιστροφής προβολής Rotate View to Selection Περιστροφή προβολής ως προς την επιλογή diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 15c12dcdcd..e8532b277f 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -2942,6 +2942,7 @@ digits Malayalam Malayálam Bevels Biseles Edit Bevels Editar biseles Edit Bevels… Editar biseles… + {name} (document) {name} (documento) Reload Bevels Volver a cargar biseles Reset Rotate View Restablecer rotación de vista Rotate View to Selection Rotar vista según la selección diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 9fd972ee9a..32d59f95c6 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -3949,6 +3949,7 @@ theme Appearance Ulkoasu Bevels Viisteet Edit Bevels Muokkaa viisteitä Edit Bevels… Muokkaa viisteitä… + {name} (document) {name} (asiakirja) Reload Bevels Lataa viisteet uudelleen Stroke Options Viivan asetukset Width Profiles Leveysprofiilit diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 06df1b4bd3..a7427096d7 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -2934,6 +2934,7 @@ digits Malayalam Malayalam Bevels Biseaux Edit Bevels Modifier les biseaux Edit Bevels… Modifier les biseaux… + {name} (document) {name} (document) Reload Bevels Recharger les biseaux Reset Rotate View Réinitialiser la rotation de l’affichage Rotate View to Selection Faire pivoter l’affichage selon la sélection diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 22525881b4..d00f5c1fd1 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -4016,6 +4016,7 @@ antiAlias Sharp शार्प Bevels बेवल्स Edit Bevels बेवल्स संपादित करें Edit Bevels… बेवल्स संपादित करें… + {name} (document) {name} (दस्तावेज़) Reload Bevels बेवल्स फिर से लोड करें Reset Rotate View व्यू घुमाएँ रीसेट करें Reset Ruler Origin शासकीय उत्पत्ति रीसेट करें diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 5ec8045a85..e9545c5ba7 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -3500,6 +3500,7 @@ mark-style Japanese Japán Bevels Élletörések Edit Bevels Élletörések szerkesztése Edit Bevels… Élletörések szerkesztése… + {name} (document) {name} (dokumentum) Reload Bevels Élletörések újratöltése Reset Rotate View Nézetforgatás visszaállítása Rotate View to Selection Nézet elforgatása a kijelöléshez diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 5042d4217b..d50bdaa3a2 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -3742,6 +3742,7 @@ theme Appearance Tampilan Bevels Bentuk bevel Edit Bevels Edit bentuk bevel Edit Bevels… Edit bentuk bevel… + {name} (document) {name} (dokumen) Reload Bevels Muat ulang bentuk bevel Stroke Options Opsi goresan Width Profiles Profil lebar diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index e6815869dc..64d173ee28 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -2984,6 +2984,7 @@ digits Malayalam Malayalam Bevels Smussi Edit Bevels Modifica smussi Edit Bevels… Modifica smussi… + {name} (document) {name} (documento) Reload Bevels Ricarica smussi Rotate View Ruota vista Reset Rotate View Reimposta rotazione vista diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 3c431b95be..3069ccbb6d 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -2992,6 +2992,7 @@ mark-style Japanese 日本式 Bevels ベベル一覧 Edit Bevels ベベルを編集 Edit Bevels… ベベルを編集… + {name} (document) {name} (ドキュメント) Reload Bevels ベベルを再読み込み Reset the rows to the artwork's colors 行をアートワークのカラーにリセット Color Theme Picker カラーテーマピッカー diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index adfdb887a7..a588c5d4fa 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -3585,6 +3585,7 @@ theme Appearance იერსახე Bevels წაკვეთები Edit Bevels წაკვეთების რედაქტირება Edit Bevels… წაკვეთების რედაქტირება… + {name} (document) {name} (დოკუმენტი) Reload Bevels წაკვეთების ხელახლა ჩატვირთვა Stroke Options კონტურის პარამეტრები Width Profiles სიგანის პროფილები diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index b46074af26..ea9e95c05e 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -2981,6 +2981,7 @@ mark-style Japanese 일본식 Bevels 베벨 목록 Edit Bevels 베벨 편집 Edit Bevels… 베벨 편집… + {name} (document) {name}(문서) Reload Bevels 베벨 다시 불러오기 Reset the rows to the artwork's colors 행을 아트웍 색상으로 재설정 Color Theme Picker 색상 테마 피커 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 7f598529c7..2642155c8f 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -4259,6 +4259,7 @@ theme Appearance Vormgeving Bevels Afschuiningen Edit Bevels Afschuiningen bewerken Edit Bevels… Afschuiningen bewerken… + {name} (document) {name} (document) Reload Bevels Afschuiningen opnieuw laden Stroke Options Lijnopties Width Profiles Breedteprofielen diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 8bbb4100c8..8e59033370 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -3888,6 +3888,7 @@ theme Appearance Wygląd Bevels Fazy Edit Bevels Edytuj fazy Edit Bevels… Edytuj fazy… + {name} (document) {name} (dokument) Reload Bevels Wczytaj ponownie fazy Stroke Options Opcje obrysu Width Profiles Profile szerokości diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index f0a1110f02..71410dbff7 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -2475,6 +2475,7 @@ digits Malayalam Malaiala Bevels Chanfros Edit Bevels Editar Chanfros Edit Bevels… Editar Chanfros… + {name} (document) {name} (documento) Reload Bevels Recarregar Chanfros Rotate View Girar Visualização Reset Rotate View Redefinir Visualização Girada diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index dc2c2e54b9..957042a1c1 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -2971,6 +2971,7 @@ digits Malayalam Малаялам Bevels Фаски Edit Bevels Редактировать фаски Edit Bevels… Редактировать фаски… + {name} (document) {name} (документ) Reload Bevels Перезагрузить фаски Rotate View Повернуть вид Reset Rotate View Сбросить поворот вида diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 791dec357e..ef1cb74a6f 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -2878,6 +2878,7 @@ digits Malayalam Malayalam Bevels Fasningar Edit Bevels Redigera fasningar Edit Bevels… Redigera fasningar… + {name} (document) {name} (dokument) Reload Bevels Läs in fasningar igen Reset Rotate View Återställ Rotera vy Rotate View to Selection Rotera vyn efter markeringen diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index b1ae6df145..6a1b615d69 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -2721,6 +2721,7 @@ digits Malayalam Malayalam Bevels Eğimler Edit Bevels Eğimleri Düzenle Edit Bevels… Eğimleri Düzenle… + {name} (document) {name} (belge) Reload Bevels Eğimleri Yeniden Yükle Reset Rotate View Döndürme Görünümünü Sıfırla Rotate View to Selection Görünümü Seçime Döndür diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 36ca63094b..a30e3df5c7 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -2976,6 +2976,7 @@ digits Malayalam Малаялам Bevels Фаски Edit Bevels Редагувати фаски Edit Bevels… Редагувати фаски… + {name} (document) {name} (документ) Reload Bevels Перезавантажити фаски Rotate View Повернути вид Reset Rotate View Скинути поворот виду diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 20f21181bc..fa5a3718d0 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -3269,6 +3269,7 @@ mark-style Japanese Kiểu Nhật Bevels Các kiểu vát Edit Bevels Chỉnh sửa kiểu vát Edit Bevels… Chỉnh sửa kiểu vát… + {name} (document) {name} (tài liệu) Reload Bevels Tải lại kiểu vát Rotate View Xoay chế độ xem Reset Rotate View Đặt lại xoay chế độ xem diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 2b5732b80e..3a25db6cc2 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -2838,6 +2838,7 @@ digits Malayalam 马拉雅拉姆数字 Bevels 斜角列表 Edit Bevels 编辑斜角 Edit Bevels… 编辑斜角… + {name} (document) {name} (文档) Reload Bevels 重新载入斜角 Reset Rotate View 重置旋转视图 Rotate View to Selection 按所选对象旋转视图 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 2bb793d5e1..ea7b547462 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -4055,6 +4055,7 @@ digits Malayalam 馬來亞拉姆數字 Bevels 斜角清單 Edit Bevels 編輯斜角 Edit Bevels… 編輯斜角… + {name} (document) {name} (文件) Reload Bevels 重新載入斜角 Rotate View 旋轉檢視 Reset Rotate View 重設旋轉檢視 diff --git a/crates/ui-egui/src/panels/tests_three_d.rs b/crates/ui-egui/src/panels/tests_three_d.rs index 76e205745a..bb03045dea 100644 --- a/crates/ui-egui/src/panels/tests_three_d.rs +++ b/crates/ui-egui/src/panels/tests_three_d.rs @@ -311,6 +311,28 @@ fn a_mixed_selection_still_lists_the_first_effects_own_custom_bevel() { } } +/// An effect's own custom bevel named like a bevel of the bevels file with other points is listed +/// under its own label, so Bevel Shape does not show two entries of one name. +#[test] +fn an_own_custom_bevel_named_like_a_file_bevel_gets_its_own_label() { + use crate::dialogs::revolve::bevel_options; + let dir = std::env::temp_dir().join(format!("vectorcraft-ui-bevels-own-label-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&dir); + std::fs::create_dir_all(&dir).unwrap(); + let mut app = app(); + app.session.attach_bevels_file(dir.join(vectorcraft_engine::cmd::bevels::FILE_NAME).to_string_lossy().to_string()); + app.run("threeD.bevels.edit", json!({})).unwrap(); + let file = app.session.bevels.get("Example Bevel").unwrap().profile_json(); + let other = json!([[0.0, 0.0], [0.5, 0.5], [1.0, 1.0]]); + assert_ne!(file, other); + let fields = json!({"bevel": "custom", "bevelName": "Example Bevel", "bevelProfile": other}).as_object().cloned().unwrap(); + let (options, builtin) = bevel_options(&app, &fields, "threeD.extrude"); + let _ = std::fs::remove_dir_all(&dir); + let labels: Vec<&str> = options[builtin..].iter().map(|(l, _, _)| l.as_str()).collect(); + assert_eq!(labels, ["Example Bevel", "Example Bevel (document)"]); + assert_eq!(options[builtin + 1].2, Some(("Example Bevel".to_string(), other))); +} + #[test] fn the_panel_finds_a_3d_effect_on_a_fill() { let mut app = app();