From 7f9bfee0ac4707f2586bd25c04c3883c9eb1be9e Mon Sep 17 00:00:00 2001 From: Meriipu Date: Sat, 25 Jul 2020 16:11:23 +0200 Subject: GDScript: Clarified/fixed inaccuracies in the built-in function docs. The input to smoothstep is not actually a weight, and the decscription of smoothstep was pretty hard to understand and easy to misinterpret. Clarified what it means to be approximately equal. nearest_po2 does not do what the descriptions says it does. For one, it returns the same power if the input is a power of 2. Second, it returns 0 if the input is negative or 0, while the smallest possible integral power of 2 actually is 1 (2^0 = 1). Due to the implementation and how it is used in a lot of places, it does not seem wise to change such a core function however, and I decided it is better to alter the description of the built-in. Added a few examples/clarifications/edge-cases. --- modules/gdscript/gdscript_functions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gdscript/gdscript_functions.cpp') diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp index 7f2a62a8e9..fefbf906f0 100644 --- a/modules/gdscript/gdscript_functions.cpp +++ b/modules/gdscript/gdscript_functions.cpp @@ -1636,7 +1636,7 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) { return mi; } break; case MATH_SMOOTHSTEP: { - MethodInfo mi("smoothstep", PropertyInfo(Variant::FLOAT, "from"), PropertyInfo(Variant::FLOAT, "to"), PropertyInfo(Variant::FLOAT, "weight")); + MethodInfo mi("smoothstep", PropertyInfo(Variant::FLOAT, "from"), PropertyInfo(Variant::FLOAT, "to"), PropertyInfo(Variant::FLOAT, "s")); mi.return_val.type = Variant::FLOAT; return mi; } break; -- cgit v1.2.3