class_visualscriptcustomnode.rst 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/modules/visual_script/doc_classes/VisualScriptCustomNode.xml.
  6. .. _class_VisualScriptCustomNode:
  7. VisualScriptCustomNode
  8. ======================
  9. **Inherits:** :ref:`VisualScriptNode<class_VisualScriptNode>` **<** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  10. A scripted Visual Script node.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. A custom Visual Script node which can be scripted in powerful ways.
  15. .. rst-class:: classref-reftable-group
  16. Methods
  17. -------
  18. .. table::
  19. :widths: auto
  20. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`String<class_String>` | :ref:`_get_caption<class_VisualScriptCustomNode_method__get_caption>` **(** **)** |virtual| |
  22. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`String<class_String>` | :ref:`_get_category<class_VisualScriptCustomNode_method__get_category>` **(** **)** |virtual| |
  24. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`int<class_int>` | :ref:`_get_input_value_port_count<class_VisualScriptCustomNode_method__get_input_value_port_count>` **(** **)** |virtual| |
  26. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`int<class_int>` | :ref:`_get_input_value_port_hint<class_VisualScriptCustomNode_method__get_input_value_port_hint>` **(** :ref:`int<class_int>` idx **)** |virtual| |
  28. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`String<class_String>` | :ref:`_get_input_value_port_hint_string<class_VisualScriptCustomNode_method__get_input_value_port_hint_string>` **(** :ref:`int<class_int>` idx **)** |virtual| |
  30. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`String<class_String>` | :ref:`_get_input_value_port_name<class_VisualScriptCustomNode_method__get_input_value_port_name>` **(** :ref:`int<class_int>` idx **)** |virtual| |
  32. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`int<class_int>` | :ref:`_get_input_value_port_type<class_VisualScriptCustomNode_method__get_input_value_port_type>` **(** :ref:`int<class_int>` idx **)** |virtual| |
  34. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`int<class_int>` | :ref:`_get_output_sequence_port_count<class_VisualScriptCustomNode_method__get_output_sequence_port_count>` **(** **)** |virtual| |
  36. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`String<class_String>` | :ref:`_get_output_sequence_port_text<class_VisualScriptCustomNode_method__get_output_sequence_port_text>` **(** :ref:`int<class_int>` idx **)** |virtual| |
  38. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`int<class_int>` | :ref:`_get_output_value_port_count<class_VisualScriptCustomNode_method__get_output_value_port_count>` **(** **)** |virtual| |
  40. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`int<class_int>` | :ref:`_get_output_value_port_hint<class_VisualScriptCustomNode_method__get_output_value_port_hint>` **(** :ref:`int<class_int>` idx **)** |virtual| |
  42. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`String<class_String>` | :ref:`_get_output_value_port_hint_string<class_VisualScriptCustomNode_method__get_output_value_port_hint_string>` **(** :ref:`int<class_int>` idx **)** |virtual| |
  44. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`String<class_String>` | :ref:`_get_output_value_port_name<class_VisualScriptCustomNode_method__get_output_value_port_name>` **(** :ref:`int<class_int>` idx **)** |virtual| |
  46. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`int<class_int>` | :ref:`_get_output_value_port_type<class_VisualScriptCustomNode_method__get_output_value_port_type>` **(** :ref:`int<class_int>` idx **)** |virtual| |
  48. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`String<class_String>` | :ref:`_get_text<class_VisualScriptCustomNode_method__get_text>` **(** **)** |virtual| |
  50. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`int<class_int>` | :ref:`_get_working_memory_size<class_VisualScriptCustomNode_method__get_working_memory_size>` **(** **)** |virtual| |
  52. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`bool<class_bool>` | :ref:`_has_input_sequence_port<class_VisualScriptCustomNode_method__has_input_sequence_port>` **(** **)** |virtual| |
  54. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`Variant<class_Variant>` | :ref:`_step<class_VisualScriptCustomNode_method__step>` **(** :ref:`Array<class_Array>` inputs, :ref:`Array<class_Array>` outputs, :ref:`int<class_int>` start_mode, :ref:`Array<class_Array>` working_mem **)** |virtual| |
  56. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. .. rst-class:: classref-section-separator
  58. ----
  59. .. rst-class:: classref-descriptions-group
  60. Enumerations
  61. ------------
  62. .. _enum_VisualScriptCustomNode_StartMode:
  63. .. rst-class:: classref-enumeration
  64. enum **StartMode**:
  65. .. _class_VisualScriptCustomNode_constant_START_MODE_BEGIN_SEQUENCE:
  66. .. rst-class:: classref-enumeration-constant
  67. :ref:`StartMode<enum_VisualScriptCustomNode_StartMode>` **START_MODE_BEGIN_SEQUENCE** = ``0``
  68. The start mode used the first time when :ref:`_step<class_VisualScriptCustomNode_method__step>` is called.
  69. .. _class_VisualScriptCustomNode_constant_START_MODE_CONTINUE_SEQUENCE:
  70. .. rst-class:: classref-enumeration-constant
  71. :ref:`StartMode<enum_VisualScriptCustomNode_StartMode>` **START_MODE_CONTINUE_SEQUENCE** = ``1``
  72. The start mode used when :ref:`_step<class_VisualScriptCustomNode_method__step>` is called after coming back from a :ref:`STEP_PUSH_STACK_BIT<class_VisualScriptCustomNode_constant_STEP_PUSH_STACK_BIT>`.
  73. .. _class_VisualScriptCustomNode_constant_START_MODE_RESUME_YIELD:
  74. .. rst-class:: classref-enumeration-constant
  75. :ref:`StartMode<enum_VisualScriptCustomNode_StartMode>` **START_MODE_RESUME_YIELD** = ``2``
  76. The start mode used when :ref:`_step<class_VisualScriptCustomNode_method__step>` is called after resuming from :ref:`STEP_YIELD_BIT<class_VisualScriptCustomNode_constant_STEP_YIELD_BIT>`.
  77. .. rst-class:: classref-section-separator
  78. ----
  79. .. rst-class:: classref-descriptions-group
  80. Constants
  81. ---------
  82. .. _class_VisualScriptCustomNode_constant_STEP_PUSH_STACK_BIT:
  83. .. rst-class:: classref-constant
  84. **STEP_PUSH_STACK_BIT** = ``16777216``
  85. Hint used by :ref:`_step<class_VisualScriptCustomNode_method__step>` to tell that control should return to it when there is no other node left to execute.
  86. This is used by :ref:`VisualScriptCondition<class_VisualScriptCondition>` to redirect the sequence to the "Done" port after the ``true``/``false`` branch has finished execution.
  87. .. _class_VisualScriptCustomNode_constant_STEP_GO_BACK_BIT:
  88. .. rst-class:: classref-constant
  89. **STEP_GO_BACK_BIT** = ``33554432``
  90. Hint used by :ref:`_step<class_VisualScriptCustomNode_method__step>` to tell that control should return back, either hitting a previous :ref:`STEP_PUSH_STACK_BIT<class_VisualScriptCustomNode_constant_STEP_PUSH_STACK_BIT>` or exiting the function.
  91. .. _class_VisualScriptCustomNode_constant_STEP_NO_ADVANCE_BIT:
  92. .. rst-class:: classref-constant
  93. **STEP_NO_ADVANCE_BIT** = ``67108864``
  94. .. _class_VisualScriptCustomNode_constant_STEP_EXIT_FUNCTION_BIT:
  95. .. rst-class:: classref-constant
  96. **STEP_EXIT_FUNCTION_BIT** = ``134217728``
  97. Hint used by :ref:`_step<class_VisualScriptCustomNode_method__step>` to tell that control should stop and exit the function.
  98. .. _class_VisualScriptCustomNode_constant_STEP_YIELD_BIT:
  99. .. rst-class:: classref-constant
  100. **STEP_YIELD_BIT** = ``268435456``
  101. Hint used by :ref:`_step<class_VisualScriptCustomNode_method__step>` to tell that the function should be yielded.
  102. Using this requires you to have at least one working memory slot, which is used for the :ref:`VisualScriptFunctionState<class_VisualScriptFunctionState>`.
  103. .. rst-class:: classref-section-separator
  104. ----
  105. .. rst-class:: classref-descriptions-group
  106. Method Descriptions
  107. -------------------
  108. .. _class_VisualScriptCustomNode_method__get_caption:
  109. .. rst-class:: classref-method
  110. :ref:`String<class_String>` **_get_caption** **(** **)** |virtual|
  111. Return the node's title.
  112. .. rst-class:: classref-item-separator
  113. ----
  114. .. _class_VisualScriptCustomNode_method__get_category:
  115. .. rst-class:: classref-method
  116. :ref:`String<class_String>` **_get_category** **(** **)** |virtual|
  117. Return the node's category.
  118. .. rst-class:: classref-item-separator
  119. ----
  120. .. _class_VisualScriptCustomNode_method__get_input_value_port_count:
  121. .. rst-class:: classref-method
  122. :ref:`int<class_int>` **_get_input_value_port_count** **(** **)** |virtual|
  123. Return the count of input value ports.
  124. .. rst-class:: classref-item-separator
  125. ----
  126. .. _class_VisualScriptCustomNode_method__get_input_value_port_hint:
  127. .. rst-class:: classref-method
  128. :ref:`int<class_int>` **_get_input_value_port_hint** **(** :ref:`int<class_int>` idx **)** |virtual|
  129. Return the specified input port's hint. See the :ref:`PropertyHint<enum_@GlobalScope_PropertyHint>` hints.
  130. .. rst-class:: classref-item-separator
  131. ----
  132. .. _class_VisualScriptCustomNode_method__get_input_value_port_hint_string:
  133. .. rst-class:: classref-method
  134. :ref:`String<class_String>` **_get_input_value_port_hint_string** **(** :ref:`int<class_int>` idx **)** |virtual|
  135. Return the specified input port's hint string.
  136. .. rst-class:: classref-item-separator
  137. ----
  138. .. _class_VisualScriptCustomNode_method__get_input_value_port_name:
  139. .. rst-class:: classref-method
  140. :ref:`String<class_String>` **_get_input_value_port_name** **(** :ref:`int<class_int>` idx **)** |virtual|
  141. Return the specified input port's name.
  142. .. rst-class:: classref-item-separator
  143. ----
  144. .. _class_VisualScriptCustomNode_method__get_input_value_port_type:
  145. .. rst-class:: classref-method
  146. :ref:`int<class_int>` **_get_input_value_port_type** **(** :ref:`int<class_int>` idx **)** |virtual|
  147. Return the specified input port's type. See the :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` values.
  148. .. rst-class:: classref-item-separator
  149. ----
  150. .. _class_VisualScriptCustomNode_method__get_output_sequence_port_count:
  151. .. rst-class:: classref-method
  152. :ref:`int<class_int>` **_get_output_sequence_port_count** **(** **)** |virtual|
  153. Return the amount of output **sequence** ports.
  154. .. rst-class:: classref-item-separator
  155. ----
  156. .. _class_VisualScriptCustomNode_method__get_output_sequence_port_text:
  157. .. rst-class:: classref-method
  158. :ref:`String<class_String>` **_get_output_sequence_port_text** **(** :ref:`int<class_int>` idx **)** |virtual|
  159. Return the specified **sequence** output's name.
  160. .. rst-class:: classref-item-separator
  161. ----
  162. .. _class_VisualScriptCustomNode_method__get_output_value_port_count:
  163. .. rst-class:: classref-method
  164. :ref:`int<class_int>` **_get_output_value_port_count** **(** **)** |virtual|
  165. Return the amount of output value ports.
  166. .. rst-class:: classref-item-separator
  167. ----
  168. .. _class_VisualScriptCustomNode_method__get_output_value_port_hint:
  169. .. rst-class:: classref-method
  170. :ref:`int<class_int>` **_get_output_value_port_hint** **(** :ref:`int<class_int>` idx **)** |virtual|
  171. Return the specified output port's hint. See the :ref:`PropertyHint<enum_@GlobalScope_PropertyHint>` hints.
  172. .. rst-class:: classref-item-separator
  173. ----
  174. .. _class_VisualScriptCustomNode_method__get_output_value_port_hint_string:
  175. .. rst-class:: classref-method
  176. :ref:`String<class_String>` **_get_output_value_port_hint_string** **(** :ref:`int<class_int>` idx **)** |virtual|
  177. Return the specified output port's hint string.
  178. .. rst-class:: classref-item-separator
  179. ----
  180. .. _class_VisualScriptCustomNode_method__get_output_value_port_name:
  181. .. rst-class:: classref-method
  182. :ref:`String<class_String>` **_get_output_value_port_name** **(** :ref:`int<class_int>` idx **)** |virtual|
  183. Return the specified output port's name.
  184. .. rst-class:: classref-item-separator
  185. ----
  186. .. _class_VisualScriptCustomNode_method__get_output_value_port_type:
  187. .. rst-class:: classref-method
  188. :ref:`int<class_int>` **_get_output_value_port_type** **(** :ref:`int<class_int>` idx **)** |virtual|
  189. Return the specified output port's type. See the :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` values.
  190. .. rst-class:: classref-item-separator
  191. ----
  192. .. _class_VisualScriptCustomNode_method__get_text:
  193. .. rst-class:: classref-method
  194. :ref:`String<class_String>` **_get_text** **(** **)** |virtual|
  195. Return the custom node's text, which is shown right next to the input **sequence** port (if there is none, on the place that is usually taken by it).
  196. .. rst-class:: classref-item-separator
  197. ----
  198. .. _class_VisualScriptCustomNode_method__get_working_memory_size:
  199. .. rst-class:: classref-method
  200. :ref:`int<class_int>` **_get_working_memory_size** **(** **)** |virtual|
  201. Return the size of the custom node's working memory. See :ref:`_step<class_VisualScriptCustomNode_method__step>` for more details.
  202. .. rst-class:: classref-item-separator
  203. ----
  204. .. _class_VisualScriptCustomNode_method__has_input_sequence_port:
  205. .. rst-class:: classref-method
  206. :ref:`bool<class_bool>` **_has_input_sequence_port** **(** **)** |virtual|
  207. Return whether the custom node has an input **sequence** port.
  208. .. rst-class:: classref-item-separator
  209. ----
  210. .. _class_VisualScriptCustomNode_method__step:
  211. .. rst-class:: classref-method
  212. :ref:`Variant<class_Variant>` **_step** **(** :ref:`Array<class_Array>` inputs, :ref:`Array<class_Array>` outputs, :ref:`int<class_int>` start_mode, :ref:`Array<class_Array>` working_mem **)** |virtual|
  213. Execute the custom node's logic, returning the index of the output sequence port to use or a :ref:`String<class_String>` when there is an error.
  214. The ``inputs`` array contains the values of the input ports.
  215. \ ``outputs`` is an array whose indices should be set to the respective outputs.
  216. The ``start_mode`` is usually :ref:`START_MODE_BEGIN_SEQUENCE<class_VisualScriptCustomNode_constant_START_MODE_BEGIN_SEQUENCE>`, unless you have used the ``STEP_*`` constants.
  217. \ ``working_mem`` is an array which can be used to persist information between runs of the custom node. The size needs to be predefined using :ref:`_get_working_memory_size<class_VisualScriptCustomNode_method__get_working_memory_size>`.
  218. When returning, you can mask the returned value with one of the ``STEP_*`` constants.
  219. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  220. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  221. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  222. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`