VisualScriptCustomNode.xml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="VisualScriptCustomNode" inherits="VisualScriptNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
  3. <brief_description>
  4. A scripted Visual Script node.
  5. </brief_description>
  6. <description>
  7. A custom Visual Script node which can be scripted in powerful ways.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="_get_caption" qualifiers="virtual">
  13. <return type="String" />
  14. <description>
  15. Return the node's title.
  16. </description>
  17. </method>
  18. <method name="_get_category" qualifiers="virtual">
  19. <return type="String" />
  20. <description>
  21. Return the node's category.
  22. </description>
  23. </method>
  24. <method name="_get_input_value_port_count" qualifiers="virtual">
  25. <return type="int" />
  26. <description>
  27. Return the count of input value ports.
  28. </description>
  29. </method>
  30. <method name="_get_input_value_port_hint" qualifiers="virtual">
  31. <return type="int" />
  32. <argument index="0" name="idx" type="int" />
  33. <description>
  34. Return the specified input port's hint. See the [enum @GlobalScope.PropertyHint] hints.
  35. </description>
  36. </method>
  37. <method name="_get_input_value_port_hint_string" qualifiers="virtual">
  38. <return type="String" />
  39. <argument index="0" name="idx" type="int" />
  40. <description>
  41. Return the specified input port's hint string.
  42. </description>
  43. </method>
  44. <method name="_get_input_value_port_name" qualifiers="virtual">
  45. <return type="String" />
  46. <argument index="0" name="idx" type="int" />
  47. <description>
  48. Return the specified input port's name.
  49. </description>
  50. </method>
  51. <method name="_get_input_value_port_type" qualifiers="virtual">
  52. <return type="int" />
  53. <argument index="0" name="idx" type="int" />
  54. <description>
  55. Return the specified input port's type. See the [enum Variant.Type] values.
  56. </description>
  57. </method>
  58. <method name="_get_output_sequence_port_count" qualifiers="virtual">
  59. <return type="int" />
  60. <description>
  61. Return the amount of output [b]sequence[/b] ports.
  62. </description>
  63. </method>
  64. <method name="_get_output_sequence_port_text" qualifiers="virtual">
  65. <return type="String" />
  66. <argument index="0" name="idx" type="int" />
  67. <description>
  68. Return the specified [b]sequence[/b] output's name.
  69. </description>
  70. </method>
  71. <method name="_get_output_value_port_count" qualifiers="virtual">
  72. <return type="int" />
  73. <description>
  74. Return the amount of output value ports.
  75. </description>
  76. </method>
  77. <method name="_get_output_value_port_hint" qualifiers="virtual">
  78. <return type="int" />
  79. <argument index="0" name="idx" type="int" />
  80. <description>
  81. Return the specified output port's hint. See the [enum @GlobalScope.PropertyHint] hints.
  82. </description>
  83. </method>
  84. <method name="_get_output_value_port_hint_string" qualifiers="virtual">
  85. <return type="String" />
  86. <argument index="0" name="idx" type="int" />
  87. <description>
  88. Return the specified output port's hint string.
  89. </description>
  90. </method>
  91. <method name="_get_output_value_port_name" qualifiers="virtual">
  92. <return type="String" />
  93. <argument index="0" name="idx" type="int" />
  94. <description>
  95. Return the specified output port's name.
  96. </description>
  97. </method>
  98. <method name="_get_output_value_port_type" qualifiers="virtual">
  99. <return type="int" />
  100. <argument index="0" name="idx" type="int" />
  101. <description>
  102. Return the specified output port's type. See the [enum Variant.Type] values.
  103. </description>
  104. </method>
  105. <method name="_get_text" qualifiers="virtual">
  106. <return type="String" />
  107. <description>
  108. Return the custom node's text, which is shown right next to the input [b]sequence[/b] port (if there is none, on the place that is usually taken by it).
  109. </description>
  110. </method>
  111. <method name="_get_working_memory_size" qualifiers="virtual">
  112. <return type="int" />
  113. <description>
  114. Return the size of the custom node's working memory. See [method _step] for more details.
  115. </description>
  116. </method>
  117. <method name="_has_input_sequence_port" qualifiers="virtual">
  118. <return type="bool" />
  119. <description>
  120. Return whether the custom node has an input [b]sequence[/b] port.
  121. </description>
  122. </method>
  123. <method name="_step" qualifiers="virtual">
  124. <return type="Variant" />
  125. <argument index="0" name="inputs" type="Array" />
  126. <argument index="1" name="outputs" type="Array" />
  127. <argument index="2" name="start_mode" type="int" />
  128. <argument index="3" name="working_mem" type="Array" />
  129. <description>
  130. Execute the custom node's logic, returning the index of the output sequence port to use or a [String] when there is an error.
  131. The [code]inputs[/code] array contains the values of the input ports.
  132. [code]outputs[/code] is an array whose indices should be set to the respective outputs.
  133. The [code]start_mode[/code] is usually [constant START_MODE_BEGIN_SEQUENCE], unless you have used the [code]STEP_*[/code] constants.
  134. [code]working_mem[/code] is an array which can be used to persist information between runs of the custom node. The size needs to be predefined using [method _get_working_memory_size].
  135. When returning, you can mask the returned value with one of the [code]STEP_*[/code] constants.
  136. </description>
  137. </method>
  138. </methods>
  139. <constants>
  140. <constant name="START_MODE_BEGIN_SEQUENCE" value="0" enum="StartMode">
  141. The start mode used the first time when [method _step] is called.
  142. </constant>
  143. <constant name="START_MODE_CONTINUE_SEQUENCE" value="1" enum="StartMode">
  144. The start mode used when [method _step] is called after coming back from a [constant STEP_PUSH_STACK_BIT].
  145. </constant>
  146. <constant name="START_MODE_RESUME_YIELD" value="2" enum="StartMode">
  147. The start mode used when [method _step] is called after resuming from [constant STEP_YIELD_BIT].
  148. </constant>
  149. <constant name="STEP_PUSH_STACK_BIT" value="16777216">
  150. Hint used by [method _step] to tell that control should return to it when there is no other node left to execute.
  151. This is used by [VisualScriptCondition] to redirect the sequence to the "Done" port after the [code]true[/code]/[code]false[/code] branch has finished execution.
  152. </constant>
  153. <constant name="STEP_GO_BACK_BIT" value="33554432">
  154. Hint used by [method _step] to tell that control should return back, either hitting a previous [constant STEP_PUSH_STACK_BIT] or exiting the function.
  155. </constant>
  156. <constant name="STEP_NO_ADVANCE_BIT" value="67108864">
  157. </constant>
  158. <constant name="STEP_EXIT_FUNCTION_BIT" value="134217728">
  159. Hint used by [method _step] to tell that control should stop and exit the function.
  160. </constant>
  161. <constant name="STEP_YIELD_BIT" value="268435456">
  162. Hint used by [method _step] to tell that the function should be yielded.
  163. Using this requires you to have at least one working memory slot, which is used for the [VisualScriptFunctionState].
  164. </constant>
  165. </constants>
  166. </class>