Changeset View
Standalone View
source/blender/blenkernel/intern/unit.c
| Context not available. | |||||
| {"square yard", "square yards", "sq yd", NULL, "Square Yards", NULL, UN_SC_YD * UN_SC_YD, 0.0, B_UNIT_DEF_NONE}, | {"square yard", "square yards", "sq yd", NULL, "Square Yards", NULL, UN_SC_YD * UN_SC_YD, 0.0, B_UNIT_DEF_NONE}, | ||||
| {"square foot", "square feet", "sq ft", NULL, "Square Feet", NULL, UN_SC_FT * UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */ | {"square foot", "square feet", "sq ft", NULL, "Square Feet", NULL, UN_SC_FT * UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */ | ||||
| {"square inch", "square inches", "sq in", NULL, "Square Inches", NULL, UN_SC_IN * UN_SC_IN, 0.0, B_UNIT_DEF_NONE}, | {"square inch", "square inches", "sq in", NULL, "Square Inches", NULL, UN_SC_IN * UN_SC_IN, 0.0, B_UNIT_DEF_NONE}, | ||||
| {"square thou", "square thous", "sq mil", NULL, "Square Thous", NULL, UN_SC_MIL * UN_SC_MIL, 0.0, B_UNIT_DEF_NONE}, | {"square thou", "square thou", "sq mil", NULL, "Square Thou", NULL, UN_SC_MIL * UN_SC_MIL, 0.0, B_UNIT_DEF_NONE}, | ||||
JacquesLucke: Thanks for those typo fixes. I'll commit those separately. | |||||
| NULL_UNIT, | NULL_UNIT, | ||||
| }; | }; | ||||
| static struct bUnitCollection buImperialAreaCollection = {buImperialAreaDef, 4, 0, UNIT_COLLECTION_LENGTH(buImperialAreaDef)}; | static struct bUnitCollection buImperialAreaCollection = {buImperialAreaDef, 4, 0, UNIT_COLLECTION_LENGTH(buImperialAreaDef)}; | ||||
| Context not available. | |||||
| {"cubic yard", "cubic yards", "cu yd", NULL, "Cubic Yards", NULL, UN_SC_YD * UN_SC_YD * UN_SC_YD, 0.0, B_UNIT_DEF_NONE}, | {"cubic yard", "cubic yards", "cu yd", NULL, "Cubic Yards", NULL, UN_SC_YD * UN_SC_YD * UN_SC_YD, 0.0, B_UNIT_DEF_NONE}, | ||||
| {"cubic foot", "cubic feet", "cu ft", NULL, "Cubic Feet", NULL, UN_SC_FT * UN_SC_FT * UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */ | {"cubic foot", "cubic feet", "cu ft", NULL, "Cubic Feet", NULL, UN_SC_FT * UN_SC_FT * UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */ | ||||
| {"cubic inch", "cubic inches", "cu in", NULL, "Cubic Inches", NULL, UN_SC_IN * UN_SC_IN * UN_SC_IN, 0.0, B_UNIT_DEF_NONE}, | {"cubic inch", "cubic inches", "cu in", NULL, "Cubic Inches", NULL, UN_SC_IN * UN_SC_IN * UN_SC_IN, 0.0, B_UNIT_DEF_NONE}, | ||||
| {"cubic thou", "cubic thous", "cu mil", NULL, "Cubic Thous", NULL, UN_SC_MIL * UN_SC_MIL * UN_SC_MIL, 0.0, B_UNIT_DEF_NONE}, | {"cubic thou", "cubic thou", "cu mil", NULL, "Cubic Thou", NULL, UN_SC_MIL * UN_SC_MIL * UN_SC_MIL, 0.0, B_UNIT_DEF_NONE}, | ||||
| NULL_UNIT, | NULL_UNIT, | ||||
| }; | }; | ||||
| static struct bUnitCollection buImperialVolCollection = {buImperialVolDef, 4, 0, UNIT_COLLECTION_LENGTH(buImperialVolDef)}; | static struct bUnitCollection buImperialVolCollection = {buImperialVolDef, 4, 0, UNIT_COLLECTION_LENGTH(buImperialVolDef)}; | ||||
| Context not available. | |||||
| }; | }; | ||||
| static struct bUnitCollection buPowerCollection = {buPowerDef, 3, 0, UNIT_COLLECTION_LENGTH(buPowerDef)}; | static struct bUnitCollection buPowerCollection = {buPowerDef, 3, 0, UNIT_COLLECTION_LENGTH(buPowerDef)}; | ||||
| /* Temperature */ | |||||
| static struct bUnitDef buMetricTempDef[] = { | |||||
| {"celsius", "celsius", "°C", "oC", "Celsius", NULL, 1.0, 0.0, B_UNIT_DEF_NONE}, /* base unit */ | |||||
JacquesLuckeUnsubmitted Done Inline ActionsI wonder if we should use oC or just C. The latter is more comfortable to type. JacquesLucke: I wonder if we should use `oC` or just `C`. The latter is more comfortable to type. | |||||
| NULL_UNIT, | |||||
| }; | |||||
| static struct bUnitCollection buMetricTempCollection = {buMetricTempDef, 0, 0, UNIT_COLLECTION_LENGTH(buMetricTempDef)}; | |||||
| static struct bUnitDef buImperialTempDef[] = { | |||||
| {"fahrenheit","fahrenheit", "°F", "oF", "Fahrenheit", NULL, 1.0, 0.0, B_UNIT_DEF_NONE}, /* base unit */ | |||||
JacquesLuckeUnsubmitted Done Inline ActionsUnfortunately, the conversion is not that simple. Currently switching between the unit systems changes the absolute value of the temperature, i.e. it thinks 5C = 5F. A bit more work has to be done to get this conversion working, because it is different from all the other conversions we have so far. Also there is a missing white space. JacquesLucke: Unfortunately, the conversion is not that simple. Currently switching between the unit systems… | |||||
| NULL_UNIT, | |||||
| }; | |||||
| static struct bUnitCollection buImperialTempCollection = {buImperialTempDef, 0, 0, UNIT_COLLECTION_LENGTH(buImperialTempDef)}; | |||||
| #define UNIT_SYSTEM_TOT (((sizeof(bUnitSystems) / B_UNIT_TYPE_TOT) / sizeof(void *)) - 1) | #define UNIT_SYSTEM_TOT (((sizeof(bUnitSystems) / B_UNIT_TYPE_TOT) / sizeof(void *)) - 1) | ||||
| static const struct bUnitCollection *bUnitSystems[][B_UNIT_TYPE_TOT] = { | static const struct bUnitCollection *bUnitSystems[][B_UNIT_TYPE_TOT] = { | ||||
| {NULL, NULL, NULL, NULL, NULL, &buNaturalRotCollection, &buNaturalTimeCollection, NULL, NULL, NULL, NULL}, | {NULL, NULL, NULL, NULL, NULL, &buNaturalRotCollection, &buNaturalTimeCollection, NULL, NULL, NULL, NULL, NULL}, | ||||
| {NULL, &buMetricLenCollection, &buMetricAreaCollection, &buMetricVolCollection, &buMetricMassCollection, &buNaturalRotCollection, &buNaturalTimeCollection, &buMetricVelCollection, &buMetricAclCollection, &buCameraLenCollection, &buPowerCollection}, /* metric */ | {NULL, &buMetricLenCollection, &buMetricAreaCollection, &buMetricVolCollection, &buMetricMassCollection, &buNaturalRotCollection, &buNaturalTimeCollection, &buMetricVelCollection, &buMetricAclCollection, &buCameraLenCollection, &buPowerCollection, &buMetricTempCollection}, /* metric */ | ||||
JacquesLuckeUnsubmitted Done Inline ActionsIt's probably a good time to split this into multiple lines now, one line per unit collection. JacquesLucke: It's probably a good time to split this into multiple lines now, one line per unit collection. | |||||
| {NULL, &buImperialLenCollection, &buImperialAreaCollection, &buImperialVolCollection, &buImperialMassCollection, &buNaturalRotCollection, &buNaturalTimeCollection, &buImperialVelCollection, &buImperialAclCollection, &buCameraLenCollection, &buPowerCollection}, /* imperial */ | {NULL, &buImperialLenCollection, &buImperialAreaCollection, &buImperialVolCollection, &buImperialMassCollection, &buNaturalRotCollection, &buNaturalTimeCollection, &buImperialVelCollection, &buImperialAclCollection, &buCameraLenCollection, &buPowerCollection, &buImperialTempCollection}, /* imperial */ | ||||
| {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | ||||
| }; | }; | ||||
| Context not available. | |||||
Done Inline ActionsI think Kelvin should also be the base unit in imperial? Something like color temperature you would still want to see as Kelvin even if you use imperial length units. brecht: I think Kelvin should also be the base unit in imperial? Something like color temperature you… | |||||
Done Inline ActionsI was thinking about that too, I'll add that. HooglyBoogly: I was thinking about that too, I'll add that. | |||||
Not Done Inline ActionsBased on the name, I'd expect this function to compare chars to digits, but that does not seem to be what it is doing. JacquesLucke: Based on the name, I'd expect this function to compare chars to digits, but that does not seem… | |||||
Done Inline ActionsI used "value" instead for both the helper functions. Hopefully that's more clear. HooglyBoogly: I used "value" instead for both the helper functions. Hopefully that's more clear. | |||||
Done Inline Actionstypo JacquesLucke: typo | |||||
Done Inline Actionstypo JacquesLucke: typo | |||||
Thanks for those typo fixes. I'll commit those separately.