summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-11-23 08:33:53 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-11-23 08:33:53 +0100
commit3791872c65bf4650464a4fdd7cf692f611648668 (patch)
treefdfc3dfbe0e7e00235553ef6513442eecb553343
parent0afcbcfda4bd38a0c8c026e990a78768c59d7b3a (diff)
parent3e36cc7c7342213628a462c5d0ee2f330c283b4c (diff)
Merge pull request #67726 from HenryClones/integer-lerping-errors
Add case for Variant::INT in lerp variant switch
-rw-r--r--core/variant/variant_utility.cpp3
-rw-r--r--doc/classes/@GlobalScope.xml2
2 files changed, 4 insertions, 1 deletions
diff --git a/core/variant/variant_utility.cpp b/core/variant/variant_utility.cpp
index 3843c32bcc..f274b80729 100644
--- a/core/variant/variant_utility.cpp
+++ b/core/variant/variant_utility.cpp
@@ -335,6 +335,9 @@ struct VariantUtilityFunctions {
}
switch (from.get_type()) {
+ case Variant::INT: {
+ return lerpf(VariantInternalAccessor<int64_t>::get(&from), to, weight);
+ } break;
case Variant::FLOAT: {
return lerpf(VariantInternalAccessor<double>::get(&from), to, weight);
} break;
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index 09713bce2f..34f706b6f9 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -527,7 +527,7 @@
<param index="2" name="weight" type="Variant" />
<description>
Linearly interpolates between two values by the factor defined in [param weight]. To perform interpolation, [param weight] should be between [code]0.0[/code] and [code]1.0[/code] (inclusive). However, values outside this range are allowed and can be used to perform [i]extrapolation[/i]. If this is not desired, use [method clamp] on the result of this function.
- Both [param from] and [param to] must be the same type. Supported types: [float], [Vector2], [Vector3], [Vector4], [Color], [Quaternion], [Basis].
+ Both [param from] and [param to] must be the same type. Supported types: [int], [float], [Vector2], [Vector3], [Vector4], [Color], [Quaternion], [Basis].
[codeblock]
lerp(0, 4, 0.75) # Returns 3.0
[/codeblock]