class_visualscriptcustomnode.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the VisualScriptCustomNode.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_VisualScriptCustomNode:
  5. VisualScriptCustomNode
  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 scripted Visual Script node.
  12. Member Functions
  13. ----------------
  14. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | :ref:`String<class_string>` | :ref:`_get_caption<class_VisualScriptCustomNode__get_caption>` **(** **)** virtual |
  16. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`String<class_string>` | :ref:`_get_category<class_VisualScriptCustomNode__get_category>` **(** **)** virtual |
  18. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`int<class_int>` | :ref:`_get_input_value_port_count<class_VisualScriptCustomNode__get_input_value_port_count>` **(** **)** virtual |
  20. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`String<class_string>` | :ref:`_get_input_value_port_name<class_VisualScriptCustomNode__get_input_value_port_name>` **(** :ref:`int<class_int>` idx **)** virtual |
  22. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`int<class_int>` | :ref:`_get_input_value_port_type<class_VisualScriptCustomNode__get_input_value_port_type>` **(** :ref:`int<class_int>` idx **)** virtual |
  24. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`int<class_int>` | :ref:`_get_output_sequence_port_count<class_VisualScriptCustomNode__get_output_sequence_port_count>` **(** **)** virtual |
  26. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`String<class_string>` | :ref:`_get_output_sequence_port_text<class_VisualScriptCustomNode__get_output_sequence_port_text>` **(** :ref:`int<class_int>` idx **)** virtual |
  28. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`int<class_int>` | :ref:`_get_output_value_port_count<class_VisualScriptCustomNode__get_output_value_port_count>` **(** **)** virtual |
  30. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`String<class_string>` | :ref:`_get_output_value_port_name<class_VisualScriptCustomNode__get_output_value_port_name>` **(** :ref:`int<class_int>` idx **)** virtual |
  32. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`int<class_int>` | :ref:`_get_output_value_port_type<class_VisualScriptCustomNode__get_output_value_port_type>` **(** :ref:`int<class_int>` idx **)** virtual |
  34. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`String<class_string>` | :ref:`_get_text<class_VisualScriptCustomNode__get_text>` **(** **)** virtual |
  36. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`int<class_int>` | :ref:`_get_working_memory_size<class_VisualScriptCustomNode__get_working_memory_size>` **(** **)** virtual |
  38. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`bool<class_bool>` | :ref:`_has_input_sequence_port<class_VisualScriptCustomNode__has_input_sequence_port>` **(** **)** virtual |
  40. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`Variant<class_variant>` | :ref:`_step<class_VisualScriptCustomNode__step>` **(** :ref:`Array<class_array>` inputs, :ref:`Array<class_array>` outputs, :ref:`int<class_int>` start_mode, :ref:`Array<class_array>` working_mem **)** virtual |
  42. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. Numeric Constants
  44. -----------------
  45. - **STEP_PUSH_STACK_BIT** = **16777216** --- Hint used by :ref:`_step<class_VisualScriptCustomNode__step>` to tell that control should return to it when there is no other node left to execute.
  46. This is used by :ref:`VisualScriptCondition<class_visualscriptcondition>` to redirect the sequence to the "Done" port after the true/false branch has finished execution.
  47. - **STEP_GO_BACK_BIT** = **33554432** --- Hint used by :ref:`_step<class_VisualScriptCustomNode__step>` to tell that control should return back, either hitting a previous STEP_PUSH_STACK_BIT or exiting the function.
  48. - **STEP_NO_ADVANCE_BIT** = **67108864**
  49. - **STEP_EXIT_FUNCTION_BIT** = **134217728** --- Hint used by :ref:`_step<class_VisualScriptCustomNode__step>` to tell that control should stop and exit the function.
  50. - **STEP_YIELD_BIT** = **268435456** --- Hint used by :ref:`_step<class_VisualScriptCustomNode__step>` to tell that the function should be yielded.
  51. Using this requires you to have at least one working memory slot, which is used for the :ref:`VisualScriptFunctionState<class_visualscriptfunctionstate>`.
  52. Enums
  53. -----
  54. .. _enum_VisualScriptCustomNode_StartMode:
  55. enum **StartMode**
  56. - **START_MODE_BEGIN_SEQUENCE** = **0** --- The start mode used the first time when :ref:`_step<class_VisualScriptCustomNode__step>` is called.
  57. - **START_MODE_CONTINUE_SEQUENCE** = **1** --- The start mode used when :ref:`_step<class_VisualScriptCustomNode__step>` is called after coming back from a STEP_PUSH_STACK_BIT.
  58. - **START_MODE_RESUME_YIELD** = **2** --- The start mode used when :ref:`_step<class_VisualScriptCustomNode__step>` is called after resuming from STEP_YIELD_BIT.
  59. Description
  60. -----------
  61. A custom Visual Script node which can be scripted in powerful ways.
  62. Member Function Description
  63. ---------------------------
  64. .. _class_VisualScriptCustomNode__get_caption:
  65. - :ref:`String<class_string>` **_get_caption** **(** **)** virtual
  66. Return the node's title.
  67. .. _class_VisualScriptCustomNode__get_category:
  68. - :ref:`String<class_string>` **_get_category** **(** **)** virtual
  69. Return the node's category.
  70. .. _class_VisualScriptCustomNode__get_input_value_port_count:
  71. - :ref:`int<class_int>` **_get_input_value_port_count** **(** **)** virtual
  72. Return the count of input value ports.
  73. .. _class_VisualScriptCustomNode__get_input_value_port_name:
  74. - :ref:`String<class_string>` **_get_input_value_port_name** **(** :ref:`int<class_int>` idx **)** virtual
  75. Return the specified input port's name.
  76. .. _class_VisualScriptCustomNode__get_input_value_port_type:
  77. - :ref:`int<class_int>` **_get_input_value_port_type** **(** :ref:`int<class_int>` idx **)** virtual
  78. Return the specified input port's type. See the TYPE\_\* enum in :ref:`@GlobalScope<class_@globalscope>`.
  79. .. _class_VisualScriptCustomNode__get_output_sequence_port_count:
  80. - :ref:`int<class_int>` **_get_output_sequence_port_count** **(** **)** virtual
  81. Return the amount of output **sequence** ports.
  82. .. _class_VisualScriptCustomNode__get_output_sequence_port_text:
  83. - :ref:`String<class_string>` **_get_output_sequence_port_text** **(** :ref:`int<class_int>` idx **)** virtual
  84. Return the specified **sequence** output's name.
  85. .. _class_VisualScriptCustomNode__get_output_value_port_count:
  86. - :ref:`int<class_int>` **_get_output_value_port_count** **(** **)** virtual
  87. Return the amount of output value ports.
  88. .. _class_VisualScriptCustomNode__get_output_value_port_name:
  89. - :ref:`String<class_string>` **_get_output_value_port_name** **(** :ref:`int<class_int>` idx **)** virtual
  90. Return the specified output's name.
  91. .. _class_VisualScriptCustomNode__get_output_value_port_type:
  92. - :ref:`int<class_int>` **_get_output_value_port_type** **(** :ref:`int<class_int>` idx **)** virtual
  93. Return the specified output's type. See the TYPE\_\* enum in :ref:`@GlobalScope<class_@globalscope>`.
  94. .. _class_VisualScriptCustomNode__get_text:
  95. - :ref:`String<class_string>` **_get_text** **(** **)** virtual
  96. 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).
  97. .. _class_VisualScriptCustomNode__get_working_memory_size:
  98. - :ref:`int<class_int>` **_get_working_memory_size** **(** **)** virtual
  99. Return the size of the custom node's working memory. See :ref:`_step<class_VisualScriptCustomNode__step>` for more details.
  100. .. _class_VisualScriptCustomNode__has_input_sequence_port:
  101. - :ref:`bool<class_bool>` **_has_input_sequence_port** **(** **)** virtual
  102. Return whether the custom node has an input **sequence** port.
  103. .. _class_VisualScriptCustomNode__step:
  104. - :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
  105. 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.
  106. The ``inputs`` array contains the values of the input ports.
  107. ``outputs`` is an array whose indices should be set to the respective outputs.
  108. The ``start_mode`` is usually ``START_MODE_BEGIN_SEQUENCE``, unless you have used the STEP\_\* constants.
  109. ``working_mem`` is an array which can be used to persist information between runs of the custom node.
  110. When returning, you can mask the returned value with one of the STEP\_\* constants.