-
Notifications
You must be signed in to change notification settings - Fork 1
/
built_in_flow_types.cpp
196 lines (174 loc) · 4.35 KB
/
built_in_flow_types.cpp
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#include "built_in_flow_types.hpp"
BuiltInFlowTypes *BuiltInFlowTypes::singleton = nullptr;
BuiltInFlowTypes *BuiltInFlowTypes::get_singleton()
{
return singleton;
}
void BuiltInFlowTypes::init_types()
{
if (have_types_initialized)
{
return;
}
have_types_initialized = true;
_init_types_internal();
}
List<Ref<FlowType>> *BuiltInFlowTypes::get_built_in_types()
{
return &built_in_types;
}
int BuiltInFlowTypes::get_type_count() const
{
return built_in_types.size();
}
Ref<FlowType> BuiltInFlowTypes::get_type_at(const int p_idx) const
{
return built_in_types.get(p_idx);
}
void BuiltInFlowTypes::add_type(Ref<FlowType> p_type)
{
built_in_types.push_back(p_type);
}
BuiltInFlowTypes::BuiltInFlowTypes()
{
CRASH_COND(singleton != nullptr);
singleton = this;
init_types();
}
BuiltInFlowTypes::~BuiltInFlowTypes()
{
singleton = nullptr;
}
void BuiltInFlowTypes::_init_types_internal()
{
add_type(FlowType::create_native_type(
"procedure",
"Procedure",
"Flow",
"Marks the beginning of a Flow procedure.\nNodes of this type can be renamed.",
"",
"ProcedureFlowNode",
"ProcedureFlowNodeEditor",
true
));
add_type(FlowType::create_native_type(
"return_expression",
"Return",
"Flow",
"Returns the result of an expression to the caller.",
"",
"ReturnExpressionFlowNode",
"ReturnExpressionFlowNodeEditor",
false
));
add_type(FlowType::create_native_type(
"floating_comment",
"Comment",
"Debug",
"A disconnected text box.\nWrite whatever you want.",
"",
"CommentFlowNode",
"CommentFlowNodeEditor",
false
));
add_type(FlowType::create_native_type(
"wait_seconds",
"Wait Fixed Duration",
"",
"Pauses script execution for a defined duration.",
"",
"WaitSecondsFlowNode",
"WaitSecondsFlowNodeEditor",
false
));
add_type(FlowType::create_native_type(
"print_to_console",
"Print Message to Console",
"Debug",
"Prints a message to the console.\nFormat strings are supported, with the values sourced from the expression box. Use the {0}, {1}, etc. style syntax.",
"",
"PrintToConsoleFlowNode",
"PrintToConsoleFlowNodeEditor",
false
));
add_type(FlowType::create_native_type(
"execute_expression",
"Execute Expressions",
"Flow",
"Executes a series of expressions.\nNo result is returned.",
"",
"ExecuteExpressionFlowNode",
"ExecuteExpressionFlowNodeEditor",
false
));
add_type(FlowType::create_native_type(
"expression_branch",
"Conditional Branch",
"Flow",
"Branches depending on the result of an evaluated expression.",
"",
"ExpressionBranchFlowNode",
"ExpressionBranchFlowNodeEditor",
false
));
add_type(FlowType::create_native_type(
"execute_external_flow_script",
"Execute External Procedure",
"Flow",
"Executes a procedure from another FlowScript.",
"",
"ExecuteExternalFlowScriptFlowNode",
"ExecuteExternalFlowScriptFlowNodeEditor",
false
));
add_type(FlowType::create_native_type(
"while_expression_true_loop",
"While Loop",
"Flow",
"Repeats a section of code as long as the expressions written evaluate to true.",
"",
"WhileExpressionTrueLoopFlowNode",
"WhileExpressionTrueLoopFlowNodeEditor",
false
));
add_type(FlowType::create_native_type(
"sequential_branch_execution",
"Execute Branches Sequentially",
"Flow",
"Executes a list of branches one after another, waiting for each to complete before progressing to the next.",
"",
"SequentialBranchExecutionFlowNode",
"SequentialBranchExecutionFlowNodeEditor",
false
));
add_type(FlowType::create_native_type(
"simultaneous_branch_execution",
"Execute Branches Simultaneously",
"Flow",
"Executes a list of branches simultaneously, waiting for all of them to complete before progressing.",
"",
"SimultaneousBranchExecutionFlowNode",
"SimultaneousBranchExecutionFlowNodeEditor",
false
));
add_type(FlowType::create_native_type(
"assign_expression_to_local_variable",
"Set Local Variable",
"Variable",
"Assigns a local variable to the result of some expression.",
"",
"AssignExpressionToLocalVariableFlowNode",
"AssignExpressionToVariableFlowNodeEditor",
false
));
add_type(FlowType::create_native_type(
"assign_expression_to_global_variable",
"Set Global Variable",
"Variable",
"Assigns a global variable to the result of some expression.",
"",
"AssignExpressionToGlobalVariableFlowNode",
"AssignExpressionToVariableFlowNodeEditor",
false
));
}