class_visualscriptbuiltinfunc.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the VisualScriptBuiltinFunc.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_VisualScriptBuiltinFunc:
  6. VisualScriptBuiltinFunc
  7. =======================
  8. **Inherits:** :ref:`VisualScriptNode<class_VisualScriptNode>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  9. A Visual Script node used to call built-in functions.
  10. Description
  11. -----------
  12. A built-in function used inside a :ref:`VisualScript<class_VisualScript>`. It is usually a math function or an utility function.
  13. See also :ref:`@GDScript<class_@GDScript>`, for the same functions in the GDScript language.
  14. Properties
  15. ----------
  16. +--------------------------------------------------------------+------------------------------------------------------------------+-------+
  17. | :ref:`BuiltinFunc<enum_VisualScriptBuiltinFunc_BuiltinFunc>` | :ref:`function<class_VisualScriptBuiltinFunc_property_function>` | ``0`` |
  18. +--------------------------------------------------------------+------------------------------------------------------------------+-------+
  19. Enumerations
  20. ------------
  21. .. _enum_VisualScriptBuiltinFunc_BuiltinFunc:
  22. .. _class_VisualScriptBuiltinFunc_constant_MATH_SIN:
  23. .. _class_VisualScriptBuiltinFunc_constant_MATH_COS:
  24. .. _class_VisualScriptBuiltinFunc_constant_MATH_TAN:
  25. .. _class_VisualScriptBuiltinFunc_constant_MATH_SINH:
  26. .. _class_VisualScriptBuiltinFunc_constant_MATH_COSH:
  27. .. _class_VisualScriptBuiltinFunc_constant_MATH_TANH:
  28. .. _class_VisualScriptBuiltinFunc_constant_MATH_ASIN:
  29. .. _class_VisualScriptBuiltinFunc_constant_MATH_ACOS:
  30. .. _class_VisualScriptBuiltinFunc_constant_MATH_ATAN:
  31. .. _class_VisualScriptBuiltinFunc_constant_MATH_ATAN2:
  32. .. _class_VisualScriptBuiltinFunc_constant_MATH_SQRT:
  33. .. _class_VisualScriptBuiltinFunc_constant_MATH_FMOD:
  34. .. _class_VisualScriptBuiltinFunc_constant_MATH_FPOSMOD:
  35. .. _class_VisualScriptBuiltinFunc_constant_MATH_FLOOR:
  36. .. _class_VisualScriptBuiltinFunc_constant_MATH_CEIL:
  37. .. _class_VisualScriptBuiltinFunc_constant_MATH_ROUND:
  38. .. _class_VisualScriptBuiltinFunc_constant_MATH_ABS:
  39. .. _class_VisualScriptBuiltinFunc_constant_MATH_SIGN:
  40. .. _class_VisualScriptBuiltinFunc_constant_MATH_POW:
  41. .. _class_VisualScriptBuiltinFunc_constant_MATH_LOG:
  42. .. _class_VisualScriptBuiltinFunc_constant_MATH_EXP:
  43. .. _class_VisualScriptBuiltinFunc_constant_MATH_ISNAN:
  44. .. _class_VisualScriptBuiltinFunc_constant_MATH_ISINF:
  45. .. _class_VisualScriptBuiltinFunc_constant_MATH_EASE:
  46. .. _class_VisualScriptBuiltinFunc_constant_MATH_STEP_DECIMALS:
  47. .. _class_VisualScriptBuiltinFunc_constant_MATH_SNAPPED:
  48. .. _class_VisualScriptBuiltinFunc_constant_MATH_LERP:
  49. .. _class_VisualScriptBuiltinFunc_constant_MATH_CUBIC_INTERPOLATE:
  50. .. _class_VisualScriptBuiltinFunc_constant_MATH_INVERSE_LERP:
  51. .. _class_VisualScriptBuiltinFunc_constant_MATH_RANGE_LERP:
  52. .. _class_VisualScriptBuiltinFunc_constant_MATH_MOVE_TOWARD:
  53. .. _class_VisualScriptBuiltinFunc_constant_MATH_RANDOMIZE:
  54. .. _class_VisualScriptBuiltinFunc_constant_MATH_RANDI:
  55. .. _class_VisualScriptBuiltinFunc_constant_MATH_RANDF:
  56. .. _class_VisualScriptBuiltinFunc_constant_MATH_RANDI_RANGE:
  57. .. _class_VisualScriptBuiltinFunc_constant_MATH_RANDF_RANGE:
  58. .. _class_VisualScriptBuiltinFunc_constant_MATH_RANDFN:
  59. .. _class_VisualScriptBuiltinFunc_constant_MATH_SEED:
  60. .. _class_VisualScriptBuiltinFunc_constant_MATH_RANDSEED:
  61. .. _class_VisualScriptBuiltinFunc_constant_MATH_DEG2RAD:
  62. .. _class_VisualScriptBuiltinFunc_constant_MATH_RAD2DEG:
  63. .. _class_VisualScriptBuiltinFunc_constant_MATH_LINEAR2DB:
  64. .. _class_VisualScriptBuiltinFunc_constant_MATH_DB2LINEAR:
  65. .. _class_VisualScriptBuiltinFunc_constant_MATH_WRAP:
  66. .. _class_VisualScriptBuiltinFunc_constant_MATH_WRAPF:
  67. .. _class_VisualScriptBuiltinFunc_constant_MATH_PINGPONG:
  68. .. _class_VisualScriptBuiltinFunc_constant_LOGIC_MAX:
  69. .. _class_VisualScriptBuiltinFunc_constant_LOGIC_MIN:
  70. .. _class_VisualScriptBuiltinFunc_constant_LOGIC_CLAMP:
  71. .. _class_VisualScriptBuiltinFunc_constant_LOGIC_NEAREST_PO2:
  72. .. _class_VisualScriptBuiltinFunc_constant_OBJ_WEAKREF:
  73. .. _class_VisualScriptBuiltinFunc_constant_TYPE_CONVERT:
  74. .. _class_VisualScriptBuiltinFunc_constant_TYPE_OF:
  75. .. _class_VisualScriptBuiltinFunc_constant_TYPE_EXISTS:
  76. .. _class_VisualScriptBuiltinFunc_constant_TEXT_CHAR:
  77. .. _class_VisualScriptBuiltinFunc_constant_TEXT_STR:
  78. .. _class_VisualScriptBuiltinFunc_constant_TEXT_PRINT:
  79. .. _class_VisualScriptBuiltinFunc_constant_TEXT_PRINTERR:
  80. .. _class_VisualScriptBuiltinFunc_constant_TEXT_PRINTRAW:
  81. .. _class_VisualScriptBuiltinFunc_constant_TEXT_PRINT_VERBOSE:
  82. .. _class_VisualScriptBuiltinFunc_constant_VAR_TO_STR:
  83. .. _class_VisualScriptBuiltinFunc_constant_STR_TO_VAR:
  84. .. _class_VisualScriptBuiltinFunc_constant_VAR_TO_BYTES:
  85. .. _class_VisualScriptBuiltinFunc_constant_BYTES_TO_VAR:
  86. .. _class_VisualScriptBuiltinFunc_constant_MATH_SMOOTHSTEP:
  87. .. _class_VisualScriptBuiltinFunc_constant_MATH_POSMOD:
  88. .. _class_VisualScriptBuiltinFunc_constant_MATH_LERP_ANGLE:
  89. .. _class_VisualScriptBuiltinFunc_constant_TEXT_ORD:
  90. .. _class_VisualScriptBuiltinFunc_constant_FUNC_MAX:
  91. enum **BuiltinFunc**:
  92. - **MATH_SIN** = **0** --- Returns the sine of the input.
  93. - **MATH_COS** = **1** --- Returns the cosine of the input.
  94. - **MATH_TAN** = **2** --- Returns the tangent of the input.
  95. - **MATH_SINH** = **3** --- Returns the hyperbolic sine of the input.
  96. - **MATH_COSH** = **4** --- Returns the hyperbolic cosine of the input.
  97. - **MATH_TANH** = **5** --- Returns the hyperbolic tangent of the input.
  98. - **MATH_ASIN** = **6** --- Returns the arc sine of the input.
  99. - **MATH_ACOS** = **7** --- Returns the arc cosine of the input.
  100. - **MATH_ATAN** = **8** --- Returns the arc tangent of the input.
  101. - **MATH_ATAN2** = **9** --- Returns the arc tangent of the input, using the signs of both parameters to determine the exact angle.
  102. - **MATH_SQRT** = **10** --- Returns the square root of the input.
  103. - **MATH_FMOD** = **11** --- Returns the remainder of one input divided by the other, using floating-point numbers.
  104. - **MATH_FPOSMOD** = **12** --- Returns the positive remainder of one input divided by the other, using floating-point numbers.
  105. - **MATH_FLOOR** = **13** --- Returns the input rounded down.
  106. - **MATH_CEIL** = **14** --- Returns the input rounded up.
  107. - **MATH_ROUND** = **15** --- Returns the input rounded to the nearest integer.
  108. - **MATH_ABS** = **16** --- Returns the absolute value of the input.
  109. - **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.
  110. - **MATH_POW** = **18** --- Returns the input raised to a given power.
  111. - **MATH_LOG** = **19** --- Returns the natural logarithm of the input. Note that this is not the typical base-10 logarithm function calculators use.
  112. - **MATH_EXP** = **20** --- Returns the mathematical constant **e** raised to the specified power of the input. **e** has an approximate value of 2.71828.
  113. - **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.
  114. - **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.
  115. - **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.
  116. - **MATH_STEP_DECIMALS** = **24** --- Returns the number of digit places after the decimal that the first non-zero digit occurs.
  117. - **MATH_SNAPPED** = **25** --- Returns the input snapped to a given step.
  118. - **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``.
  119. - **MATH_CUBIC_INTERPOLATE** = **27**
  120. - **MATH_INVERSE_LERP** = **28**
  121. - **MATH_RANGE_LERP** = **29**
  122. - **MATH_MOVE_TOWARD** = **30** --- Moves the number toward a value, based on the third input.
  123. - **MATH_RANDOMIZE** = **31** --- Randomize the seed (or the internal state) of the random number generator. Current implementation reseeds using a number based on time.
  124. - **MATH_RANDI** = **32** --- 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.
  125. - **MATH_RANDF** = **33** --- 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.
  126. - **MATH_RANDI_RANGE** = **34** --- Returns a random 32-bit integer value between the two inputs.
  127. - **MATH_RANDF_RANGE** = **35** --- Returns a random floating-point value between the two inputs.
  128. - **MATH_RANDFN** = **36** --- 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.
  129. - **MATH_SEED** = **37** --- Set the seed for the random number generator.
  130. - **MATH_RANDSEED** = **38** --- Returns a random value from the given seed, along with the new seed.
  131. - **MATH_DEG2RAD** = **39** --- Convert the input from degrees to radians.
  132. - **MATH_RAD2DEG** = **40** --- Convert the input from radians to degrees.
  133. - **MATH_LINEAR2DB** = **41** --- Convert the input from linear volume to decibel volume.
  134. - **MATH_DB2LINEAR** = **42** --- Convert the input from decibel volume to linear volume.
  135. - **MATH_WRAP** = **43**
  136. - **MATH_WRAPF** = **44**
  137. - **MATH_PINGPONG** = **45** --- 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.
  138. - **LOGIC_MAX** = **46** --- Returns the greater of the two numbers, also known as their maximum.
  139. - **LOGIC_MIN** = **47** --- Returns the lesser of the two numbers, also known as their minimum.
  140. - **LOGIC_CLAMP** = **48** --- Returns the input clamped inside the given range, ensuring the result is never outside it. Equivalent to ``min(max(input, range_low), range_high)``.
  141. - **LOGIC_NEAREST_PO2** = **49** --- Returns the nearest power of 2 to the input.
  142. - **OBJ_WEAKREF** = **50** --- Create a :ref:`WeakRef<class_WeakRef>` from the input.
  143. - **TYPE_CONVERT** = **51** --- Convert between types.
  144. - **TYPE_OF** = **52** --- Returns the type of the input as an integer. Check :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` for the integers that might be returned.
  145. - **TYPE_EXISTS** = **53** --- Checks if a type is registered in the :ref:`ClassDB<class_ClassDB>`.
  146. - **TEXT_CHAR** = **54** --- Returns a character with the given ascii value.
  147. - **TEXT_STR** = **55** --- Convert the input to a string.
  148. - **TEXT_PRINT** = **56** --- Print the given string to the output window.
  149. - **TEXT_PRINTERR** = **57** --- Print the given string to the standard error output.
  150. - **TEXT_PRINTRAW** = **58** --- Print the given string to the standard output, without adding a newline.
  151. - **TEXT_PRINT_VERBOSE** = **59**
  152. - **VAR_TO_STR** = **60** --- Serialize a :ref:`Variant<class_Variant>` to a string.
  153. - **STR_TO_VAR** = **61** --- Deserialize a :ref:`Variant<class_Variant>` from a string serialized using :ref:`VAR_TO_STR<class_VisualScriptBuiltinFunc_constant_VAR_TO_STR>`.
  154. - **VAR_TO_BYTES** = **62** --- Serialize a :ref:`Variant<class_Variant>` to a :ref:`PackedByteArray<class_PackedByteArray>`.
  155. - **BYTES_TO_VAR** = **63** --- Deserialize a :ref:`Variant<class_Variant>` from a :ref:`PackedByteArray<class_PackedByteArray>` serialized using :ref:`VAR_TO_BYTES<class_VisualScriptBuiltinFunc_constant_VAR_TO_BYTES>`.
  156. - **MATH_SMOOTHSTEP** = **64** --- 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:
  157. ::
  158. var t = clamp((weight - from) / (to - from), 0.0, 1.0)
  159. return t * t * (3.0 - 2.0 * t)
  160. - **MATH_POSMOD** = **65**
  161. - **MATH_LERP_ANGLE** = **66**
  162. - **TEXT_ORD** = **67**
  163. - **FUNC_MAX** = **68** --- Represents the size of the :ref:`BuiltinFunc<enum_VisualScriptBuiltinFunc_BuiltinFunc>` enum.
  164. Property Descriptions
  165. ---------------------
  166. .. _class_VisualScriptBuiltinFunc_property_function:
  167. - :ref:`BuiltinFunc<enum_VisualScriptBuiltinFunc_BuiltinFunc>` **function**
  168. +-----------+-----------------+
  169. | *Default* | ``0`` |
  170. +-----------+-----------------+
  171. | *Setter* | set_func(value) |
  172. +-----------+-----------------+
  173. | *Getter* | get_func() |
  174. +-----------+-----------------+
  175. The function to be executed.
  176. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  177. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  178. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  179. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  180. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  181. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`