diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2021-06-08 12:50:19 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2021-06-10 13:15:59 +0300 |
commit | 5fa6cdb77a9860ce673f685fd29e11b1c3ee8ad8 (patch) | |
tree | 9f5fcc26cf0f1893054183db59bf7e5379450b02 /source/blender/blenkernel/intern | |
parent | 5304c6ed7d6288ac40bbc79391668c397e30afb8 (diff) |
Add unit for time stored in seconds
Allows to define properties which will have proper units displayed
in the interface. The internal storage is expected to be seconds
(which matches how other times are stored in Blender).
Is not immediately used in Blender, but is required for the upcoming
feature in Cycles X (D11526)
The naming does not sound very exciting, but can't think of anything
better either.
For test it probably easiest to define FloatProperty with subdtype
of TIME_ABSOLUTE.
Differential Revision: https://developer.blender.org/D11532
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/node.cc | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/unit.c | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index 8d8f7b90d3b..f4e78859749 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -1662,6 +1662,8 @@ const char *nodeStaticSocketType(int type, int subtype) return "NodeSocketFloatAngle"; case PROP_TIME: return "NodeSocketFloatTime"; + case PROP_TIME_ABSOLUTE: + return "NodeSocketFloatTimeAbsolute"; case PROP_DISTANCE: return "NodeSocketFloatDistance"; case PROP_NONE: @@ -1737,6 +1739,8 @@ const char *nodeStaticSocketInterfaceType(int type, int subtype) return "NodeSocketInterfaceFloatAngle"; case PROP_TIME: return "NodeSocketInterfaceFloatTime"; + case PROP_TIME_ABSOLUTE: + return "NodeSocketInterfaceFloatTimeAbsolute"; case PROP_DISTANCE: return "NodeSocketInterfaceFloatDistance"; case PROP_NONE: diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index 3612a26315c..5cf76bb6452 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -358,6 +358,7 @@ static const struct bUnitCollection *bUnitSystems[][B_UNIT_TYPE_TOT] = { NULL, &buNaturalRotCollection, &buNaturalTimeCollection, + &buNaturalTimeCollection, NULL, NULL, NULL, @@ -371,6 +372,7 @@ static const struct bUnitCollection *bUnitSystems[][B_UNIT_TYPE_TOT] = { &buMetricMassCollection, &buNaturalRotCollection, &buNaturalTimeCollection, + &buNaturalTimeCollection, &buMetricVelCollection, &buMetricAclCollection, &buCameraLenCollection, @@ -384,12 +386,13 @@ static const struct bUnitCollection *bUnitSystems[][B_UNIT_TYPE_TOT] = { &buImperialMassCollection, &buNaturalRotCollection, &buNaturalTimeCollection, + &buNaturalTimeCollection, &buImperialVelCollection, &buImperialAclCollection, &buCameraLenCollection, &buPowerCollection, &buImperialTempCollection}, - {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, + {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, }; static const bUnitCollection *unit_get_system(int system, int type) |