From 299e112d1ae75db08b63cdaed47fefa4b13291f2 Mon Sep 17 00:00:00 2001 From: Damien Picard Date: Mon, 15 Jan 2024 18:04:38 +1100 Subject: [PATCH] UI: improve unit names This commit tweaks some unit names: - Remove `name_alt` for square mile "sq m" and cubic mile "cu m" as they could easily be confused with meters. - Correct plural forms for the ton units: rename "ton" to "tonne" for the metric ton, and "tonnes" to "tons" for the imperial (short) ton. Identifiers are unchanged. - Swap `name_short` and `name_alt` for metric ton, hour, and second, as `name_short` is used for UI display and should use the official symbol. Keep the other form as `name_alt` for input. - Use "t" and "tn" respectively as short names for the metric and imperial (short) ton. - Rename radian's short name "r" to "rad", keep it as alt name. - Introduce alt names for km/h (kph), arcminutes (amin), arcseconds (asec), for convenience. References: - https://en.wikipedia.org/wiki/Ton - https://en.wikipedia.org/wiki/Tonne Ref: !116762 --- source/blender/blenkernel/intern/unit.cc | 36 ++++++++++++------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/source/blender/blenkernel/intern/unit.cc b/source/blender/blenkernel/intern/unit.cc index 884a98d9c92..a89806b3801 100644 --- a/source/blender/blenkernel/intern/unit.cc +++ b/source/blender/blenkernel/intern/unit.cc @@ -492,7 +492,7 @@ static bUnitDef buImperialAreaDef[] = { /*name*/ "square mile", /*name_plural*/ "square miles", /*name_short*/ "sq mi", - /*name_alt*/ "sq m", + /*name_alt*/ nullptr, /*name_display*/ "Square Miles", /*identifier*/ nullptr, /*scalar*/ UN_SC_MI *UN_SC_MI, @@ -680,7 +680,7 @@ static bUnitDef buImperialVolDef[] = { /*name*/ "cubic mile", /*name_plural*/ "cubic miles", /*name_short*/ "cu mi", - /*name_alt*/ "cu m", + /*name_alt*/ nullptr, /*name_display*/ "Cubic Miles", /*identifier*/ nullptr, /*scalar*/ UN_SC_MI *UN_SC_MI *UN_SC_MI, @@ -766,10 +766,10 @@ static bUnitCollection buImperialVolCollection = { /* Mass. */ static bUnitDef buMetricMassDef[] = { { - /*name*/ "ton", + /*name*/ "tonne", /*name_plural*/ "tonnes", - /*name_short*/ "ton", - /*name_alt*/ "t", + /*name_short*/ "t", + /*name_alt*/ "ton", /*name_display*/ "Tonnes", /*identifier*/ "TONNES", /*scalar*/ UN_SC_MTON, @@ -855,10 +855,10 @@ static bUnitCollection buMetricMassCollection = { static bUnitDef buImperialMassDef[] = { { /*name*/ "ton", - /*name_plural*/ "tonnes", - /*name_short*/ "ton", - /*name_alt*/ "t", - /*name_display*/ "Tonnes", + /*name_plural*/ "tons", + /*name_short*/ "tn", + /*name_alt*/ nullptr, + /*name_display*/ "Tons", /*identifier*/ "TONNES", /*scalar*/ UN_SC_ITON, /*bias*/ 0.0, @@ -939,7 +939,7 @@ static bUnitDef buMetricVelDef[] = { /*name*/ "kilometer per hour", /*name_plural*/ "kilometers per hour", /*name_short*/ "km/h", - /*name_alt*/ nullptr, + /*name_alt*/ "kph", /*name_display*/ "Kilometers per hour", /*identifier*/ nullptr, /*scalar*/ UN_SC_KM / 3600.0f, @@ -1050,8 +1050,8 @@ static bUnitDef buNaturalTimeDef[] = { { /*name*/ "hour", /*name_plural*/ "hours", - /*name_short*/ "hr", - /*name_alt*/ "h", + /*name_short*/ "h", + /*name_alt*/ "hr", /*name_display*/ "Hours", /*identifier*/ "HOURS", /*scalar*/ 3600.0, @@ -1073,8 +1073,8 @@ static bUnitDef buNaturalTimeDef[] = { { /*name*/ "second", /*name_plural*/ "seconds", - /*name_short*/ "sec", - /*name_alt*/ "s", + /*name_short*/ "s", + /*name_alt*/ "sec", /*name_display*/ "Seconds", /*identifier*/ "SECONDS", /*scalar*/ 1.0, @@ -1129,7 +1129,7 @@ static bUnitDef buNaturalRotDef[] = { /*name*/ "arcminute", /*name_plural*/ "arcminutes", /*name_short*/ "'", - /*name_alt*/ nullptr, + /*name_alt*/ "amin", /*name_display*/ "Arcminutes", /*identifier*/ "ARCMINUTES", /*scalar*/ (M_PI / 180.0) / 60.0, @@ -1140,7 +1140,7 @@ static bUnitDef buNaturalRotDef[] = { /*name*/ "arcsecond", /*name_plural*/ "arcseconds", /*name_short*/ "\"", - /*name_alt*/ nullptr, + /*name_alt*/ "asec", /*name_display*/ "Arcseconds", /*identifier*/ "ARCSECONDS", /*scalar*/ (M_PI / 180.0) / 3600.0, @@ -1150,8 +1150,8 @@ static bUnitDef buNaturalRotDef[] = { { /*name*/ "radian", /*name_plural*/ "radians", - /*name_short*/ "r", - /*name_alt*/ nullptr, + /*name_short*/ "rad", + /*name_alt*/ "r", /*name_display*/ "Radians", /*identifier*/ "RADIANS", /*scalar*/ 1.0,