class_visualscriptbuiltinfunc.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the VisualScriptBuiltinFunc.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_VisualScriptBuiltinFunc:
  5. VisualScriptBuiltinFunc
  6. =======================
  7. **Inherits:** :ref:`VisualScriptNode<class_VisualScriptNode>` **<** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. A Visual Script node used to call built-in functions.
  12. Properties
  13. ----------
  14. +--------------------------------------------------------------+------------------------------------------------------------------+
  15. | :ref:`BuiltinFunc<enum_VisualScriptBuiltinFunc_BuiltinFunc>` | :ref:`function<class_VisualScriptBuiltinFunc_property_function>` |
  16. +--------------------------------------------------------------+------------------------------------------------------------------+
  17. Enumerations
  18. ------------
  19. .. _enum_VisualScriptBuiltinFunc_BuiltinFunc:
  20. .. _class_VisualScriptBuiltinFunc_constant_MATH_SIN:
  21. .. _class_VisualScriptBuiltinFunc_constant_MATH_COS:
  22. .. _class_VisualScriptBuiltinFunc_constant_MATH_TAN:
  23. .. _class_VisualScriptBuiltinFunc_constant_MATH_SINH:
  24. .. _class_VisualScriptBuiltinFunc_constant_MATH_COSH:
  25. .. _class_VisualScriptBuiltinFunc_constant_MATH_TANH:
  26. .. _class_VisualScriptBuiltinFunc_constant_MATH_ASIN:
  27. .. _class_VisualScriptBuiltinFunc_constant_MATH_ACOS:
  28. .. _class_VisualScriptBuiltinFunc_constant_MATH_ATAN:
  29. .. _class_VisualScriptBuiltinFunc_constant_MATH_ATAN2:
  30. .. _class_VisualScriptBuiltinFunc_constant_MATH_SQRT:
  31. .. _class_VisualScriptBuiltinFunc_constant_MATH_FMOD:
  32. .. _class_VisualScriptBuiltinFunc_constant_MATH_FPOSMOD:
  33. .. _class_VisualScriptBuiltinFunc_constant_MATH_FLOOR:
  34. .. _class_VisualScriptBuiltinFunc_constant_MATH_CEIL:
  35. .. _class_VisualScriptBuiltinFunc_constant_MATH_ROUND:
  36. .. _class_VisualScriptBuiltinFunc_constant_MATH_ABS:
  37. .. _class_VisualScriptBuiltinFunc_constant_MATH_SIGN:
  38. .. _class_VisualScriptBuiltinFunc_constant_MATH_POW:
  39. .. _class_VisualScriptBuiltinFunc_constant_MATH_LOG:
  40. .. _class_VisualScriptBuiltinFunc_constant_MATH_EXP:
  41. .. _class_VisualScriptBuiltinFunc_constant_MATH_ISNAN:
  42. .. _class_VisualScriptBuiltinFunc_constant_MATH_ISINF:
  43. .. _class_VisualScriptBuiltinFunc_constant_MATH_EASE:
  44. .. _class_VisualScriptBuiltinFunc_constant_MATH_DECIMALS:
  45. .. _class_VisualScriptBuiltinFunc_constant_MATH_STEPIFY:
  46. .. _class_VisualScriptBuiltinFunc_constant_MATH_LERP:
  47. .. _class_VisualScriptBuiltinFunc_constant_MATH_INVERSE_LERP:
  48. .. _class_VisualScriptBuiltinFunc_constant_MATH_RANGE_LERP:
  49. .. _class_VisualScriptBuiltinFunc_constant_MATH_DECTIME:
  50. .. _class_VisualScriptBuiltinFunc_constant_MATH_RANDOMIZE:
  51. .. _class_VisualScriptBuiltinFunc_constant_MATH_RAND:
  52. .. _class_VisualScriptBuiltinFunc_constant_MATH_RANDF:
  53. .. _class_VisualScriptBuiltinFunc_constant_MATH_RANDOM:
  54. .. _class_VisualScriptBuiltinFunc_constant_MATH_SEED:
  55. .. _class_VisualScriptBuiltinFunc_constant_MATH_RANDSEED:
  56. .. _class_VisualScriptBuiltinFunc_constant_MATH_DEG2RAD:
  57. .. _class_VisualScriptBuiltinFunc_constant_MATH_RAD2DEG:
  58. .. _class_VisualScriptBuiltinFunc_constant_MATH_LINEAR2DB:
  59. .. _class_VisualScriptBuiltinFunc_constant_MATH_DB2LINEAR:
  60. .. _class_VisualScriptBuiltinFunc_constant_MATH_POLAR2CARTESIAN:
  61. .. _class_VisualScriptBuiltinFunc_constant_MATH_CARTESIAN2POLAR:
  62. .. _class_VisualScriptBuiltinFunc_constant_MATH_WRAP:
  63. .. _class_VisualScriptBuiltinFunc_constant_MATH_WRAPF:
  64. .. _class_VisualScriptBuiltinFunc_constant_LOGIC_MAX:
  65. .. _class_VisualScriptBuiltinFunc_constant_LOGIC_MIN:
  66. .. _class_VisualScriptBuiltinFunc_constant_LOGIC_CLAMP:
  67. .. _class_VisualScriptBuiltinFunc_constant_LOGIC_NEAREST_PO2:
  68. .. _class_VisualScriptBuiltinFunc_constant_OBJ_WEAKREF:
  69. .. _class_VisualScriptBuiltinFunc_constant_FUNC_FUNCREF:
  70. .. _class_VisualScriptBuiltinFunc_constant_TYPE_CONVERT:
  71. .. _class_VisualScriptBuiltinFunc_constant_TYPE_OF:
  72. .. _class_VisualScriptBuiltinFunc_constant_TYPE_EXISTS:
  73. .. _class_VisualScriptBuiltinFunc_constant_TEXT_CHAR:
  74. .. _class_VisualScriptBuiltinFunc_constant_TEXT_STR:
  75. .. _class_VisualScriptBuiltinFunc_constant_TEXT_PRINT:
  76. .. _class_VisualScriptBuiltinFunc_constant_TEXT_PRINTERR:
  77. .. _class_VisualScriptBuiltinFunc_constant_TEXT_PRINTRAW:
  78. .. _class_VisualScriptBuiltinFunc_constant_VAR_TO_STR:
  79. .. _class_VisualScriptBuiltinFunc_constant_STR_TO_VAR:
  80. .. _class_VisualScriptBuiltinFunc_constant_VAR_TO_BYTES:
  81. .. _class_VisualScriptBuiltinFunc_constant_BYTES_TO_VAR:
  82. .. _class_VisualScriptBuiltinFunc_constant_COLORN:
  83. .. _class_VisualScriptBuiltinFunc_constant_FUNC_MAX:
  84. enum **BuiltinFunc**:
  85. - **MATH_SIN** = **0** --- Return the sine of the input.
  86. - **MATH_COS** = **1** --- Return the cosine of the input.
  87. - **MATH_TAN** = **2** --- Return the tangent of the input.
  88. - **MATH_SINH** = **3** --- Return the hyperbolic sine of the input.
  89. - **MATH_COSH** = **4** --- Return the hyperbolic cosine of the input.
  90. - **MATH_TANH** = **5** --- Return the hyperbolic tangent of the input.
  91. - **MATH_ASIN** = **6** --- Return the arc sine of the input.
  92. - **MATH_ACOS** = **7** --- Return the arc cosine of the input.
  93. - **MATH_ATAN** = **8** --- Return the arc tangent of the input.
  94. - **MATH_ATAN2** = **9** --- Return the arc tangent of the input, using the signs of both parameters to determine the exact angle.
  95. - **MATH_SQRT** = **10** --- Return the square root of the input.
  96. - **MATH_FMOD** = **11** --- Return the remainder of one input divided by the other, using floating-point numbers.
  97. - **MATH_FPOSMOD** = **12** --- Return the positive remainder of one input divided by the other, using floating-point numbers.
  98. - **MATH_FLOOR** = **13** --- Return the input rounded down.
  99. - **MATH_CEIL** = **14** --- Return the input rounded up.
  100. - **MATH_ROUND** = **15** --- Return the input rounded to the nearest integer.
  101. - **MATH_ABS** = **16** --- Return the absolute value of the input.
  102. - **MATH_SIGN** = **17** --- Return the sign of the input, turning it into 1, -1, or 0. Useful to determine if the input is positive or negative.
  103. - **MATH_POW** = **18** --- Return the input raised to a given power.
  104. - **MATH_LOG** = **19** --- Return the natural logarithm of the input. Note that this is not the typical base-10 logarithm function calculators use.
  105. - **MATH_EXP** = **20** --- Return the mathematical constant **e** raised to the specified power of the input. **e** has an approximate value of 2.71828.
  106. - **MATH_ISNAN** = **21** --- Return whether the input is NaN (Not a Number) or not. NaN is usually produced by dividing 0 by 0, though other ways exist.
  107. - **MATH_ISINF** = **22** --- Return 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.
  108. - **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.
  109. - **MATH_DECIMALS** = **24** --- Return the number of digit places after the decimal that the first non-zero digit occurs.
  110. - **MATH_STEPIFY** = **25** --- Return the input snapped to a given step.
  111. - **MATH_LERP** = **26** --- Return a number linearly interpolated between the first two inputs, based on the third input. Uses the formula ``a + (a - b) * t``.
  112. - **MATH_INVERSE_LERP** = **27**
  113. - **MATH_RANGE_LERP** = **28**
  114. - **MATH_DECTIME** = **29** --- Return the result of 'value' decreased by 'step' \* 'amount'.
  115. - **MATH_RANDOMIZE** = **30** --- Randomize the seed (or the internal state) of the random number generator. Current implementation reseeds using a number based on time.
  116. - **MATH_RAND** = **31** --- Return 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.
  117. - **MATH_RANDF** = **32** --- Return a random floating-point value between 0 and 1. To obtain a random value between 0 to N, you can use it with multiplication.
  118. - **MATH_RANDOM** = **33** --- Return a random floating-point value between the two inputs.
  119. - **MATH_SEED** = **34** --- Set the seed for the random number generator.
  120. - **MATH_RANDSEED** = **35** --- Return a random value from the given seed, along with the new seed.
  121. - **MATH_DEG2RAD** = **36** --- Convert the input from degrees to radians.
  122. - **MATH_RAD2DEG** = **37** --- Convert the input from radians to degrees.
  123. - **MATH_LINEAR2DB** = **38** --- Convert the input from linear volume to decibel volume.
  124. - **MATH_DB2LINEAR** = **39** --- Convert the input from decibel volume to linear volume.
  125. - **MATH_POLAR2CARTESIAN** = **40** --- Converts a 2D point expressed in the polar coordinate system (a distance from the origin ``r`` and an angle ``th``) to the cartesian coordinate system (x and y axis).
  126. - **MATH_CARTESIAN2POLAR** = **41** --- Converts a 2D point expressed in the cartesian coordinate system (x and y axis) to the polar coordinate system (a distance from the origin and an angle).
  127. - **MATH_WRAP** = **42**
  128. - **MATH_WRAPF** = **43**
  129. - **LOGIC_MAX** = **44** --- Return the greater of the two numbers, also known as their maximum.
  130. - **LOGIC_MIN** = **45** --- Return the lesser of the two numbers, also known as their minimum.
  131. - **LOGIC_CLAMP** = **46** --- Return the input clamped inside the given range, ensuring the result is never outside it. Equivalent to ``min(max(input, range_low), range_high)``.
  132. - **LOGIC_NEAREST_PO2** = **47** --- Return the nearest power of 2 to the input.
  133. - **OBJ_WEAKREF** = **48** --- Create a :ref:`WeakRef<class_WeakRef>` from the input.
  134. - **FUNC_FUNCREF** = **49** --- Create a :ref:`FuncRef<class_FuncRef>` from the input.
  135. - **TYPE_CONVERT** = **50** --- Convert between types.
  136. - **TYPE_OF** = **51** --- Return the type of the input as an integer. Check :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` for the integers that might be returned.
  137. - **TYPE_EXISTS** = **52** --- Checks if a type is registered in the :ref:`ClassDB<class_ClassDB>`.
  138. - **TEXT_CHAR** = **53** --- Return a character with the given ascii value.
  139. - **TEXT_STR** = **54** --- Convert the input to a string.
  140. - **TEXT_PRINT** = **55** --- Print the given string to the output window.
  141. - **TEXT_PRINTERR** = **56** --- Print the given string to the standard error output.
  142. - **TEXT_PRINTRAW** = **57** --- Print the given string to the standard output, without adding a newline.
  143. - **VAR_TO_STR** = **58** --- Serialize a :ref:`Variant<class_Variant>` to a string.
  144. - **STR_TO_VAR** = **59** --- Deserialize a :ref:`Variant<class_Variant>` from a string serialized using ``VAR_TO_STR``.
  145. - **VAR_TO_BYTES** = **60** --- Serialize a :ref:`Variant<class_Variant>` to a :ref:`PoolByteArray<class_PoolByteArray>`.
  146. - **BYTES_TO_VAR** = **61** --- Deserialize a :ref:`Variant<class_Variant>` from a :ref:`PoolByteArray<class_PoolByteArray>` serialized using ``VAR_TO_BYTES``.
  147. - **COLORN** = **62** --- Return the :ref:`Color<class_Color>` with the given name and alpha ranging from 0 to 1. Note: names are defined in color_names.inc.
  148. - **FUNC_MAX** = **63** --- The maximum value the :ref:`function<class_VisualScriptBuiltinFunc_property_function>` property can have.
  149. Description
  150. -----------
  151. A built-in function used inside a :ref:`VisualScript<class_VisualScript>`. It is usually a math function or an utility function.
  152. See also :ref:`@GDScript<class_@GDScript>`, for the same functions in the GDScript language.
  153. Property Descriptions
  154. ---------------------
  155. .. _class_VisualScriptBuiltinFunc_property_function:
  156. - :ref:`BuiltinFunc<enum_VisualScriptBuiltinFunc_BuiltinFunc>` **function**
  157. +----------+-----------------+
  158. | *Setter* | set_func(value) |
  159. +----------+-----------------+
  160. | *Getter* | get_func() |
  161. +----------+-----------------+
  162. The function to be executed.