Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2020-09-07 22:59:07 +0300
committerHans Goudey <h.goudey@me.com>2020-09-07 22:59:07 +0300
commit36aeb0ec1e2ec8cd6a3690ac11cd3c50f3851802 (patch)
tree4c9ce5df6ba5cc01eb2e0841c57fd9b0e9690b11 /source/blender/blenkernel/BKE_unit.h
parentd4cca7b7b0d858a45c684fd0725344881e0c1c63 (diff)
UI: Add temperature units
Based on the original patch by Vaishnav S (@padthai), this adds support for temperature units. Initially supported units are Celsius, Kelvin, and Fahrenheit. The units aren't used anywhere with this commit. Those changes should happen in separate patches by adding PROP_TEMPERATURE to RNA property definitions. But it should be ensured that the various solvers and simulations actually properly use real units. The complexity of some of the changes comes from the fact that these units have offsets from each other as well as coefficients. This also makes the implementation in the current unit system troublesome. For example, entering 0C evaluates correctly to 273K, but 0C + 0C doubles that result, because each unit value is evaluated separately. This is quite hard to solve in the general case with Blender's current unit system, though, so it is not handled in this commit. Differential Revision: https://developer.blender.org/D4401
Diffstat (limited to 'source/blender/blenkernel/BKE_unit.h')
-rw-r--r--source/blender/blenkernel/BKE_unit.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_unit.h b/source/blender/blenkernel/BKE_unit.h
index a797c5555ff..d47cebb5dc8 100644
--- a/source/blender/blenkernel/BKE_unit.h
+++ b/source/blender/blenkernel/BKE_unit.h
@@ -46,8 +46,8 @@ bool bUnit_ReplaceString(
/* return true if the string contains any valid unit for the given type */
bool bUnit_ContainsUnit(const char *str, int type);
-/* if user does not specify a unit, multiply with this value */
-double bUnit_PreferredInputUnitScalar(const struct UnitSettings *settings, int type);
+/* If user does not specify a unit, this converts it to the unit from the settings. */
+double bUnit_ApplyPreferredUnit(const struct UnitSettings *settings, int type, double value);
/* make string keyboard-friendly: 10µm --> 10um */
void bUnit_ToUnitAltName(char *str, int len_max, const char *orig_str, int system, int type);
@@ -86,7 +86,8 @@ enum {
B_UNIT_ACCELERATION = 8,
B_UNIT_CAMERA = 9,
B_UNIT_POWER = 10,
- B_UNIT_TYPE_TOT = 11,
+ B_UNIT_TEMPERATURE = 11,
+ B_UNIT_TYPE_TOT = 12,
};
#ifdef __cplusplus