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