mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-07 02:12:07 +03:00
337 lines
13 KiB
ReStructuredText
337 lines
13 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
|
|
.. DO NOT EDIT THIS FILE, but the VisualScriptBuiltinFunc.xml source instead.
|
|
.. The source is found in doc/classes or modules/<name>/doc_classes.
|
|
|
|
.. _class_VisualScriptBuiltinFunc:
|
|
|
|
VisualScriptBuiltinFunc
|
|
=======================
|
|
|
|
**Inherits:** :ref:`VisualScriptNode<class_VisualScriptNode>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
|
|
|
A Visual Script node used to call built-in functions.
|
|
|
|
Description
|
|
-----------
|
|
|
|
A built-in function used inside a :ref:`VisualScript<class_VisualScript>`. It is usually a math function or an utility function.
|
|
|
|
See also :ref:`@GDScript<class_@GDScript>`, for the same functions in the GDScript language.
|
|
|
|
Properties
|
|
----------
|
|
|
|
+--------------------------------------------------------------+------------------------------------------------------------------+-------+
|
|
| :ref:`BuiltinFunc<enum_VisualScriptBuiltinFunc_BuiltinFunc>` | :ref:`function<class_VisualScriptBuiltinFunc_property_function>` | ``0`` |
|
|
+--------------------------------------------------------------+------------------------------------------------------------------+-------+
|
|
|
|
Enumerations
|
|
------------
|
|
|
|
.. _enum_VisualScriptBuiltinFunc_BuiltinFunc:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_SIN:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_COS:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_TAN:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_SINH:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_COSH:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_TANH:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_ASIN:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_ACOS:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_ATAN:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_ATAN2:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_SQRT:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_FMOD:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_FPOSMOD:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_FLOOR:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_CEIL:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_ROUND:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_ABS:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_SIGN:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_POW:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_LOG:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_EXP:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_ISNAN:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_ISINF:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_EASE:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_STEP_DECIMALS:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_SNAPPED:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_LERP:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_INVERSE_LERP:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_RANGE_LERP:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_MOVE_TOWARD:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_RANDOMIZE:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_RANDI:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_RANDF:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_RANDI_RANGE:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_RANDF_RANGE:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_RANDFN:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_SEED:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_RANDSEED:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_DEG2RAD:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_RAD2DEG:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_LINEAR2DB:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_DB2LINEAR:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_WRAP:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_WRAPF:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_PINGPONG:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_LOGIC_MAX:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_LOGIC_MIN:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_LOGIC_CLAMP:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_LOGIC_NEAREST_PO2:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_OBJ_WEAKREF:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_TYPE_CONVERT:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_TYPE_OF:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_TYPE_EXISTS:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_TEXT_CHAR:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_TEXT_STR:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_TEXT_PRINT:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_TEXT_PRINTERR:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_TEXT_PRINTRAW:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_TEXT_PRINT_VERBOSE:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_VAR_TO_STR:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_STR_TO_VAR:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_VAR_TO_BYTES:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_BYTES_TO_VAR:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_SMOOTHSTEP:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_POSMOD:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_MATH_LERP_ANGLE:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_TEXT_ORD:
|
|
|
|
.. _class_VisualScriptBuiltinFunc_constant_FUNC_MAX:
|
|
|
|
enum **BuiltinFunc**:
|
|
|
|
- **MATH_SIN** = **0** --- Returns the sine of the input.
|
|
|
|
- **MATH_COS** = **1** --- Returns the cosine of the input.
|
|
|
|
- **MATH_TAN** = **2** --- Returns the tangent of the input.
|
|
|
|
- **MATH_SINH** = **3** --- Returns the hyperbolic sine of the input.
|
|
|
|
- **MATH_COSH** = **4** --- Returns the hyperbolic cosine of the input.
|
|
|
|
- **MATH_TANH** = **5** --- Returns the hyperbolic tangent of the input.
|
|
|
|
- **MATH_ASIN** = **6** --- Returns the arc sine of the input.
|
|
|
|
- **MATH_ACOS** = **7** --- Returns the arc cosine of the input.
|
|
|
|
- **MATH_ATAN** = **8** --- Returns the arc tangent of the input.
|
|
|
|
- **MATH_ATAN2** = **9** --- Returns the arc tangent of the input, using the signs of both parameters to determine the exact angle.
|
|
|
|
- **MATH_SQRT** = **10** --- Returns the square root of the input.
|
|
|
|
- **MATH_FMOD** = **11** --- Returns the remainder of one input divided by the other, using floating-point numbers.
|
|
|
|
- **MATH_FPOSMOD** = **12** --- Returns the positive remainder of one input divided by the other, using floating-point numbers.
|
|
|
|
- **MATH_FLOOR** = **13** --- Returns the input rounded down.
|
|
|
|
- **MATH_CEIL** = **14** --- Returns the input rounded up.
|
|
|
|
- **MATH_ROUND** = **15** --- Returns the input rounded to the nearest integer.
|
|
|
|
- **MATH_ABS** = **16** --- Returns the absolute value of the input.
|
|
|
|
- **MATH_SIGN** = **17** --- Returns the sign of the input, turning it into 1, -1, or 0. Useful to determine if the input is positive or negative.
|
|
|
|
- **MATH_POW** = **18** --- Returns the input raised to a given power.
|
|
|
|
- **MATH_LOG** = **19** --- Returns the natural logarithm of the input. Note that this is not the typical base-10 logarithm function calculators use.
|
|
|
|
- **MATH_EXP** = **20** --- Returns the mathematical constant **e** raised to the specified power of the input. **e** has an approximate value of 2.71828.
|
|
|
|
- **MATH_ISNAN** = **21** --- Returns whether the input is NaN (Not a Number) or not. NaN is usually produced by dividing 0 by 0, though other ways exist.
|
|
|
|
- **MATH_ISINF** = **22** --- Returns whether the input is an infinite floating-point number or not. Infinity is usually produced by dividing a number by 0, though other ways exist.
|
|
|
|
- **MATH_EASE** = **23** --- Easing function, based on exponent. 0 is constant, 1 is linear, 0 to 1 is ease-in, 1+ is ease out. Negative values are in-out/out in.
|
|
|
|
- **MATH_STEP_DECIMALS** = **24** --- Returns the number of digit places after the decimal that the first non-zero digit occurs.
|
|
|
|
- **MATH_SNAPPED** = **25** --- Returns the input snapped to a given step.
|
|
|
|
- **MATH_LERP** = **26** --- Returns a number linearly interpolated between the first two inputs, based on the third input. Uses the formula ``a + (a - b) * t``.
|
|
|
|
- **MATH_INVERSE_LERP** = **27**
|
|
|
|
- **MATH_RANGE_LERP** = **28**
|
|
|
|
- **MATH_MOVE_TOWARD** = **29** --- Moves the number toward a value, based on the third input.
|
|
|
|
- **MATH_RANDOMIZE** = **30** --- Randomize the seed (or the internal state) of the random number generator. Current implementation reseeds using a number based on time.
|
|
|
|
- **MATH_RANDI** = **31** --- Returns a random 32 bits integer value. To obtain a random value between 0 to N (where N is smaller than 2^32 - 1), you can use it with the remainder function.
|
|
|
|
- **MATH_RANDF** = **32** --- Returns a random floating-point value between 0 and 1. To obtain a random value between 0 to N, you can use it with multiplication.
|
|
|
|
- **MATH_RANDI_RANGE** = **33** --- Returns a random 32-bit integer value between the two inputs.
|
|
|
|
- **MATH_RANDF_RANGE** = **34** --- Returns a random floating-point value between the two inputs.
|
|
|
|
- **MATH_RANDFN** = **35** --- Returns a normally-distributed pseudo-random number, using Box-Muller transform with the specified mean and a standard deviation. This is also called Gaussian distribution.
|
|
|
|
- **MATH_SEED** = **36** --- Set the seed for the random number generator.
|
|
|
|
- **MATH_RANDSEED** = **37** --- Returns a random value from the given seed, along with the new seed.
|
|
|
|
- **MATH_DEG2RAD** = **38** --- Convert the input from degrees to radians.
|
|
|
|
- **MATH_RAD2DEG** = **39** --- Convert the input from radians to degrees.
|
|
|
|
- **MATH_LINEAR2DB** = **40** --- Convert the input from linear volume to decibel volume.
|
|
|
|
- **MATH_DB2LINEAR** = **41** --- Convert the input from decibel volume to linear volume.
|
|
|
|
- **MATH_WRAP** = **42**
|
|
|
|
- **MATH_WRAPF** = **43**
|
|
|
|
- **MATH_PINGPONG** = **44** --- Returns the ``value`` wrapped between ``0`` and the ``length``. If the limit is reached, the next value the function returned is decreased to the ``0`` side or increased to the ``length`` side (like a triangle wave). If ``length`` is less than zero, it becomes positive.
|
|
|
|
- **LOGIC_MAX** = **45** --- Returns the greater of the two numbers, also known as their maximum.
|
|
|
|
- **LOGIC_MIN** = **46** --- Returns the lesser of the two numbers, also known as their minimum.
|
|
|
|
- **LOGIC_CLAMP** = **47** --- Returns the input clamped inside the given range, ensuring the result is never outside it. Equivalent to ``min(max(input, range_low), range_high)``.
|
|
|
|
- **LOGIC_NEAREST_PO2** = **48** --- Returns the nearest power of 2 to the input.
|
|
|
|
- **OBJ_WEAKREF** = **49** --- Create a :ref:`WeakRef<class_WeakRef>` from the input.
|
|
|
|
- **TYPE_CONVERT** = **50** --- Convert between types.
|
|
|
|
- **TYPE_OF** = **51** --- Returns the type of the input as an integer. Check :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` for the integers that might be returned.
|
|
|
|
- **TYPE_EXISTS** = **52** --- Checks if a type is registered in the :ref:`ClassDB<class_ClassDB>`.
|
|
|
|
- **TEXT_CHAR** = **53** --- Returns a character with the given ascii value.
|
|
|
|
- **TEXT_STR** = **54** --- Convert the input to a string.
|
|
|
|
- **TEXT_PRINT** = **55** --- Print the given string to the output window.
|
|
|
|
- **TEXT_PRINTERR** = **56** --- Print the given string to the standard error output.
|
|
|
|
- **TEXT_PRINTRAW** = **57** --- Print the given string to the standard output, without adding a newline.
|
|
|
|
- **TEXT_PRINT_VERBOSE** = **58**
|
|
|
|
- **VAR_TO_STR** = **59** --- Serialize a :ref:`Variant<class_Variant>` to a string.
|
|
|
|
- **STR_TO_VAR** = **60** --- Deserialize a :ref:`Variant<class_Variant>` from a string serialized using :ref:`VAR_TO_STR<class_VisualScriptBuiltinFunc_constant_VAR_TO_STR>`.
|
|
|
|
- **VAR_TO_BYTES** = **61** --- Serialize a :ref:`Variant<class_Variant>` to a :ref:`PackedByteArray<class_PackedByteArray>`.
|
|
|
|
- **BYTES_TO_VAR** = **62** --- Deserialize a :ref:`Variant<class_Variant>` from a :ref:`PackedByteArray<class_PackedByteArray>` serialized using :ref:`VAR_TO_BYTES<class_VisualScriptBuiltinFunc_constant_VAR_TO_BYTES>`.
|
|
|
|
- **MATH_SMOOTHSTEP** = **63** --- Returns a number smoothly interpolated between the first two inputs, based on the third input. Similar to :ref:`MATH_LERP<class_VisualScriptBuiltinFunc_constant_MATH_LERP>`, but interpolates faster at the beginning and slower at the end. Using Hermite interpolation formula:
|
|
|
|
::
|
|
|
|
var t = clamp((weight - from) / (to - from), 0.0, 1.0)
|
|
return t * t * (3.0 - 2.0 * t)
|
|
|
|
- **MATH_POSMOD** = **64**
|
|
|
|
- **MATH_LERP_ANGLE** = **65**
|
|
|
|
- **TEXT_ORD** = **66**
|
|
|
|
- **FUNC_MAX** = **67** --- Represents the size of the :ref:`BuiltinFunc<enum_VisualScriptBuiltinFunc_BuiltinFunc>` enum.
|
|
|
|
Property Descriptions
|
|
---------------------
|
|
|
|
.. _class_VisualScriptBuiltinFunc_property_function:
|
|
|
|
- :ref:`BuiltinFunc<enum_VisualScriptBuiltinFunc_BuiltinFunc>` **function**
|
|
|
|
+-----------+-----------------+
|
|
| *Default* | ``0`` |
|
|
+-----------+-----------------+
|
|
| *Setter* | set_func(value) |
|
|
+-----------+-----------------+
|
|
| *Getter* | get_func() |
|
|
+-----------+-----------------+
|
|
|
|
The function to be executed.
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
|
|
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
|
|
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
|
|
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
|
|
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
|
|
.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
|