class_visualscriptcustomnode.rst 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/modules/visual_script/doc_classes/VisualScriptCustomNode.xml.
  6. .. _class_VisualScriptCustomNode:
  7. VisualScriptCustomNode
  8. ======================
  9. **Inherits:** :ref:`VisualScriptNode<class_VisualScriptNode>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. A scripted Visual Script node.
  11. Description
  12. -----------
  13. A custom Visual Script node which can be scripted in powerful ways.
  14. Methods
  15. -------
  16. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`String<class_String>` | :ref:`_get_caption<class_VisualScriptCustomNode_method__get_caption>` **(** **)** |virtual| |const| |
  18. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`String<class_String>` | :ref:`_get_category<class_VisualScriptCustomNode_method__get_category>` **(** **)** |virtual| |const| |
  20. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`int<class_int>` | :ref:`_get_input_value_port_count<class_VisualScriptCustomNode_method__get_input_value_port_count>` **(** **)** |virtual| |const| |
  22. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`int<class_int>` | :ref:`_get_input_value_port_hint<class_VisualScriptCustomNode_method__get_input_value_port_hint>` **(** :ref:`int<class_int>` input_idx **)** |virtual| |const| |
  24. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`String<class_String>` | :ref:`_get_input_value_port_hint_string<class_VisualScriptCustomNode_method__get_input_value_port_hint_string>` **(** :ref:`int<class_int>` input_idx **)** |virtual| |const| |
  26. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`String<class_String>` | :ref:`_get_input_value_port_name<class_VisualScriptCustomNode_method__get_input_value_port_name>` **(** :ref:`int<class_int>` input_idx **)** |virtual| |const| |
  28. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`int<class_int>` | :ref:`_get_input_value_port_type<class_VisualScriptCustomNode_method__get_input_value_port_type>` **(** :ref:`int<class_int>` input_idx **)** |virtual| |const| |
  30. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`int<class_int>` | :ref:`_get_output_sequence_port_count<class_VisualScriptCustomNode_method__get_output_sequence_port_count>` **(** **)** |virtual| |const| |
  32. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`String<class_String>` | :ref:`_get_output_sequence_port_text<class_VisualScriptCustomNode_method__get_output_sequence_port_text>` **(** :ref:`int<class_int>` seq_idx **)** |virtual| |const| |
  34. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`int<class_int>` | :ref:`_get_output_value_port_count<class_VisualScriptCustomNode_method__get_output_value_port_count>` **(** **)** |virtual| |const| |
  36. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`int<class_int>` | :ref:`_get_output_value_port_hint<class_VisualScriptCustomNode_method__get_output_value_port_hint>` **(** :ref:`int<class_int>` output_idx **)** |virtual| |const| |
  38. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`String<class_String>` | :ref:`_get_output_value_port_hint_string<class_VisualScriptCustomNode_method__get_output_value_port_hint_string>` **(** :ref:`int<class_int>` output_idx **)** |virtual| |const| |
  40. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`String<class_String>` | :ref:`_get_output_value_port_name<class_VisualScriptCustomNode_method__get_output_value_port_name>` **(** :ref:`int<class_int>` output_idx **)** |virtual| |const| |
  42. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`int<class_int>` | :ref:`_get_output_value_port_type<class_VisualScriptCustomNode_method__get_output_value_port_type>` **(** :ref:`int<class_int>` output_idx **)** |virtual| |const| |
  44. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`String<class_String>` | :ref:`_get_text<class_VisualScriptCustomNode_method__get_text>` **(** **)** |virtual| |const| |
  46. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`int<class_int>` | :ref:`_get_working_memory_size<class_VisualScriptCustomNode_method__get_working_memory_size>` **(** **)** |virtual| |const| |
  48. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`bool<class_bool>` | :ref:`_has_input_sequence_port<class_VisualScriptCustomNode_method__has_input_sequence_port>` **(** **)** |virtual| |const| |
  50. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :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| |const| |
  52. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. Enumerations
  54. ------------
  55. .. _enum_VisualScriptCustomNode_StartMode:
  56. .. _class_VisualScriptCustomNode_constant_START_MODE_BEGIN_SEQUENCE:
  57. .. _class_VisualScriptCustomNode_constant_START_MODE_CONTINUE_SEQUENCE:
  58. .. _class_VisualScriptCustomNode_constant_START_MODE_RESUME_YIELD:
  59. enum **StartMode**:
  60. - **START_MODE_BEGIN_SEQUENCE** = **0** --- The start mode used the first time when :ref:`_step<class_VisualScriptCustomNode_method__step>` is called.
  61. - **START_MODE_CONTINUE_SEQUENCE** = **1** --- 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>`.
  62. - **START_MODE_RESUME_YIELD** = **2** --- 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>`.
  63. Constants
  64. ---------
  65. .. _class_VisualScriptCustomNode_constant_STEP_PUSH_STACK_BIT:
  66. .. _class_VisualScriptCustomNode_constant_STEP_GO_BACK_BIT:
  67. .. _class_VisualScriptCustomNode_constant_STEP_NO_ADVANCE_BIT:
  68. .. _class_VisualScriptCustomNode_constant_STEP_EXIT_FUNCTION_BIT:
  69. .. _class_VisualScriptCustomNode_constant_STEP_YIELD_BIT:
  70. - **STEP_PUSH_STACK_BIT** = **16777216** --- 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.
  71. This is used by :ref:`VisualScriptCondition<class_VisualScriptCondition>` to redirect the sequence to the "Done" port after the ``true``/``false`` branch has finished execution.
  72. - **STEP_GO_BACK_BIT** = **33554432** --- 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.
  73. - **STEP_NO_ADVANCE_BIT** = **67108864**
  74. - **STEP_EXIT_FUNCTION_BIT** = **134217728** --- Hint used by :ref:`_step<class_VisualScriptCustomNode_method__step>` to tell that control should stop and exit the function.
  75. - **STEP_YIELD_BIT** = **268435456** --- Hint used by :ref:`_step<class_VisualScriptCustomNode_method__step>` to tell that the function should be yielded.
  76. Using this requires you to have at least one working memory slot, which is used for the :ref:`VisualScriptFunctionState<class_VisualScriptFunctionState>`.
  77. Method Descriptions
  78. -------------------
  79. .. _class_VisualScriptCustomNode_method__get_caption:
  80. - :ref:`String<class_String>` **_get_caption** **(** **)** |virtual| |const|
  81. Returns the node's title.
  82. ----
  83. .. _class_VisualScriptCustomNode_method__get_category:
  84. - :ref:`String<class_String>` **_get_category** **(** **)** |virtual| |const|
  85. Returns the node's category.
  86. ----
  87. .. _class_VisualScriptCustomNode_method__get_input_value_port_count:
  88. - :ref:`int<class_int>` **_get_input_value_port_count** **(** **)** |virtual| |const|
  89. Returns the count of input value ports.
  90. ----
  91. .. _class_VisualScriptCustomNode_method__get_input_value_port_hint:
  92. - :ref:`int<class_int>` **_get_input_value_port_hint** **(** :ref:`int<class_int>` input_idx **)** |virtual| |const|
  93. Returns the specified input port's hint. See the :ref:`PropertyHint<enum_@GlobalScope_PropertyHint>` hints.
  94. ----
  95. .. _class_VisualScriptCustomNode_method__get_input_value_port_hint_string:
  96. - :ref:`String<class_String>` **_get_input_value_port_hint_string** **(** :ref:`int<class_int>` input_idx **)** |virtual| |const|
  97. Returns the specified input port's hint string.
  98. ----
  99. .. _class_VisualScriptCustomNode_method__get_input_value_port_name:
  100. - :ref:`String<class_String>` **_get_input_value_port_name** **(** :ref:`int<class_int>` input_idx **)** |virtual| |const|
  101. Returns the specified input port's name.
  102. ----
  103. .. _class_VisualScriptCustomNode_method__get_input_value_port_type:
  104. - :ref:`int<class_int>` **_get_input_value_port_type** **(** :ref:`int<class_int>` input_idx **)** |virtual| |const|
  105. Returns the specified input port's type. See the :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` values.
  106. ----
  107. .. _class_VisualScriptCustomNode_method__get_output_sequence_port_count:
  108. - :ref:`int<class_int>` **_get_output_sequence_port_count** **(** **)** |virtual| |const|
  109. Returns the amount of output **sequence** ports.
  110. ----
  111. .. _class_VisualScriptCustomNode_method__get_output_sequence_port_text:
  112. - :ref:`String<class_String>` **_get_output_sequence_port_text** **(** :ref:`int<class_int>` seq_idx **)** |virtual| |const|
  113. Returns the specified **sequence** output's name.
  114. ----
  115. .. _class_VisualScriptCustomNode_method__get_output_value_port_count:
  116. - :ref:`int<class_int>` **_get_output_value_port_count** **(** **)** |virtual| |const|
  117. Returns the amount of output value ports.
  118. ----
  119. .. _class_VisualScriptCustomNode_method__get_output_value_port_hint:
  120. - :ref:`int<class_int>` **_get_output_value_port_hint** **(** :ref:`int<class_int>` output_idx **)** |virtual| |const|
  121. Returns the specified output port's hint. See the :ref:`PropertyHint<enum_@GlobalScope_PropertyHint>` hints.
  122. ----
  123. .. _class_VisualScriptCustomNode_method__get_output_value_port_hint_string:
  124. - :ref:`String<class_String>` **_get_output_value_port_hint_string** **(** :ref:`int<class_int>` output_idx **)** |virtual| |const|
  125. Returns the specified output port's hint string.
  126. ----
  127. .. _class_VisualScriptCustomNode_method__get_output_value_port_name:
  128. - :ref:`String<class_String>` **_get_output_value_port_name** **(** :ref:`int<class_int>` output_idx **)** |virtual| |const|
  129. Returns the specified output port's name.
  130. ----
  131. .. _class_VisualScriptCustomNode_method__get_output_value_port_type:
  132. - :ref:`int<class_int>` **_get_output_value_port_type** **(** :ref:`int<class_int>` output_idx **)** |virtual| |const|
  133. Returns the specified output port's type. See the :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` values.
  134. ----
  135. .. _class_VisualScriptCustomNode_method__get_text:
  136. - :ref:`String<class_String>` **_get_text** **(** **)** |virtual| |const|
  137. Returns 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).
  138. ----
  139. .. _class_VisualScriptCustomNode_method__get_working_memory_size:
  140. - :ref:`int<class_int>` **_get_working_memory_size** **(** **)** |virtual| |const|
  141. Returns the size of the custom node's working memory. See :ref:`_step<class_VisualScriptCustomNode_method__step>` for more details.
  142. ----
  143. .. _class_VisualScriptCustomNode_method__has_input_sequence_port:
  144. - :ref:`bool<class_bool>` **_has_input_sequence_port** **(** **)** |virtual| |const|
  145. Returns whether the custom node has an input **sequence** port.
  146. ----
  147. .. _class_VisualScriptCustomNode_method__step:
  148. - :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| |const|
  149. 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.
  150. The ``inputs`` array contains the values of the input ports.
  151. \ ``outputs`` is an array whose indices should be set to the respective outputs.
  152. The ``start_mode`` is usually :ref:`START_MODE_BEGIN_SEQUENCE<class_VisualScriptCustomNode_constant_START_MODE_BEGIN_SEQUENCE>`, unless you have used the ``STEP_*`` constants.
  153. \ ``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>`.
  154. When returning, you can mask the returned value with one of the ``STEP_*`` constants.
  155. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  156. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  157. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  158. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  159. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  160. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`