summaryrefslogtreecommitdiff
path: root/modules/visual_script/visual_script.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/visual_script/visual_script.cpp')
-rw-r--r--modules/visual_script/visual_script.cpp205
1 files changed, 0 insertions, 205 deletions
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index fe1d82f977..79516fa1ba 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -44,7 +44,6 @@ void VisualScriptNode::set_breakpoint(bool p_breakpoint) {
}
bool VisualScriptNode::is_breakpoint() const {
-
return breakpoint;
}
@@ -53,7 +52,6 @@ void VisualScriptNode::ports_changed_notify() {
}
void VisualScriptNode::set_default_input_value(int p_port, const Variant &p_value) {
-
ERR_FAIL_INDEX(p_port, default_input_values.size());
default_input_values[p_port] = p_value;
@@ -66,13 +64,11 @@ void VisualScriptNode::set_default_input_value(int p_port, const Variant &p_valu
}
Variant VisualScriptNode::get_default_input_value(int p_port) const {
-
ERR_FAIL_INDEX_V(p_port, default_input_values.size(), Variant());
return default_input_values[p_port];
}
void VisualScriptNode::_set_default_input_values(Array p_values) {
-
default_input_values = p_values;
}
@@ -81,7 +77,6 @@ void VisualScriptNode::validate_input_default_values() {
//actually validate on save
for (int i = 0; i < get_input_value_port_count(); i++) {
-
Variant::Type expected = get_input_value_port_info(i).type;
if (expected == Variant::NIL || expected == default_input_values[i].get_type()) {
@@ -101,7 +96,6 @@ void VisualScriptNode::validate_input_default_values() {
}
Array VisualScriptNode::_get_default_input_values() const {
-
//validate on save, since on load there is little info about this
Array values = default_input_values;
values.resize(get_input_value_port_count());
@@ -114,7 +108,6 @@ String VisualScriptNode::get_text() const {
}
void VisualScriptNode::_bind_methods() {
-
ClassDB::bind_method(D_METHOD("get_visual_script"), &VisualScriptNode::get_visual_script);
ClassDB::bind_method(D_METHOD("set_default_input_value", "port_idx", "value"), &VisualScriptNode::set_default_input_value);
ClassDB::bind_method(D_METHOD("get_default_input_value", "port_idx"), &VisualScriptNode::get_default_input_value);
@@ -127,7 +120,6 @@ void VisualScriptNode::_bind_methods() {
}
VisualScriptNode::TypeGuess VisualScriptNode::guess_output_type(TypeGuess *p_inputs, int p_output) const {
-
PropertyInfo pinfo = get_output_value_port_info(p_output);
TypeGuess tg;
@@ -141,7 +133,6 @@ VisualScriptNode::TypeGuess VisualScriptNode::guess_output_type(TypeGuess *p_inp
}
Ref<VisualScript> VisualScriptNode::get_visual_script() const {
-
if (scripts_used.size())
return Ref<VisualScript>(scripts_used.front()->get());
@@ -157,13 +148,11 @@ VisualScriptNode::VisualScriptNode() {
/////////////////////
VisualScriptNodeInstance::VisualScriptNodeInstance() {
-
sequence_outputs = nullptr;
input_ports = nullptr;
}
VisualScriptNodeInstance::~VisualScriptNodeInstance() {
-
if (sequence_outputs) {
memdelete_arr(sequence_outputs);
}
@@ -178,7 +167,6 @@ VisualScriptNodeInstance::~VisualScriptNodeInstance() {
}
void VisualScript::add_function(const StringName &p_name) {
-
ERR_FAIL_COND(instances.size());
ERR_FAIL_COND(!String(p_name).is_valid_identifier());
ERR_FAIL_COND(functions.has(p_name));
@@ -188,16 +176,13 @@ void VisualScript::add_function(const StringName &p_name) {
}
bool VisualScript::has_function(const StringName &p_name) const {
-
return functions.has(p_name);
}
void VisualScript::remove_function(const StringName &p_name) {
-
ERR_FAIL_COND(instances.size());
ERR_FAIL_COND(!functions.has(p_name));
for (Map<int, Function::NodeData>::Element *E = functions[p_name].nodes.front(); E; E = E->next()) {
-
E->get().node->disconnect("ports_changed", callable_mp(this, &VisualScript::_node_ports_changed));
E->get().node->scripts_used.erase(this);
}
@@ -206,7 +191,6 @@ void VisualScript::remove_function(const StringName &p_name) {
}
void VisualScript::rename_function(const StringName &p_name, const StringName &p_new_name) {
-
ERR_FAIL_COND(instances.size());
ERR_FAIL_COND(!functions.has(p_name));
if (p_new_name == p_name)
@@ -223,19 +207,16 @@ void VisualScript::rename_function(const StringName &p_name, const StringName &p
}
void VisualScript::set_function_scroll(const StringName &p_name, const Vector2 &p_scroll) {
-
ERR_FAIL_COND(!functions.has(p_name));
functions[p_name].scroll = p_scroll;
}
Vector2 VisualScript::get_function_scroll(const StringName &p_name) const {
-
ERR_FAIL_COND_V(!functions.has(p_name), Vector2());
return functions[p_name].scroll;
}
void VisualScript::get_function_list(List<StringName> *r_functions) const {
-
for (const Map<StringName, Function>::Element *E = functions.front(); E; E = E->next()) {
r_functions->push_back(E->key());
}
@@ -244,18 +225,15 @@ void VisualScript::get_function_list(List<StringName> *r_functions) const {
}
int VisualScript::get_function_node_id(const StringName &p_name) const {
-
ERR_FAIL_COND_V(!functions.has(p_name), -1);
return functions[p_name].function_id;
}
void VisualScript::_node_ports_changed(int p_id) {
-
StringName function;
for (Map<StringName, Function>::Element *E = functions.front(); E; E = E->next()) {
-
if (E->get().nodes.has(p_id)) {
function = E->key();
break;
@@ -276,11 +254,9 @@ void VisualScript::_node_ports_changed(int p_id) {
for (Set<SequenceConnection>::Element *E = func.sequence_connections.front(); E; E = E->next()) {
if (E->get().from_node == p_id && E->get().from_output >= vsn->get_output_sequence_port_count()) {
-
to_remove.push_back(E->get());
}
if (E->get().to_node == p_id && !vsn->has_input_sequence_port()) {
-
to_remove.push_back(E->get());
}
}
@@ -292,7 +268,6 @@ void VisualScript::_node_ports_changed(int p_id) {
}
{
-
List<DataConnection> to_remove;
for (Set<DataConnection>::Element *E = func.data_connections.front(); E; E = E->next()) {
@@ -317,12 +292,10 @@ void VisualScript::_node_ports_changed(int p_id) {
}
void VisualScript::add_node(const StringName &p_func, int p_id, const Ref<VisualScriptNode> &p_node, const Point2 &p_pos) {
-
ERR_FAIL_COND(instances.size());
ERR_FAIL_COND(!functions.has(p_func));
for (Map<StringName, Function>::Element *E = functions.front(); E; E = E->next()) {
-
ERR_FAIL_COND(E->get().nodes.has(p_id)); //id can exist only one in script, even for different functions
}
@@ -348,7 +321,6 @@ void VisualScript::add_node(const StringName &p_func, int p_id, const Ref<Visual
}
void VisualScript::remove_node(const StringName &p_func, int p_id) {
-
ERR_FAIL_COND(instances.size());
ERR_FAIL_COND(!functions.has(p_func));
Function &func = functions[p_func];
@@ -370,7 +342,6 @@ void VisualScript::remove_node(const StringName &p_func, int p_id) {
}
{
-
List<DataConnection> to_remove;
for (Set<DataConnection>::Element *E = func.data_connections.front(); E; E = E->next()) {
@@ -396,7 +367,6 @@ void VisualScript::remove_node(const StringName &p_func, int p_id) {
}
bool VisualScript::has_node(const StringName &p_func, int p_id) const {
-
ERR_FAIL_COND_V(!functions.has(p_func), false);
const Function &func = functions[p_func];
@@ -404,7 +374,6 @@ bool VisualScript::has_node(const StringName &p_func, int p_id) const {
}
Ref<VisualScriptNode> VisualScript::get_node(const StringName &p_func, int p_id) const {
-
ERR_FAIL_COND_V(!functions.has(p_func), Ref<VisualScriptNode>());
const Function &func = functions[p_func];
@@ -414,7 +383,6 @@ Ref<VisualScriptNode> VisualScript::get_node(const StringName &p_func, int p_id)
}
void VisualScript::set_node_position(const StringName &p_func, int p_id, const Point2 &p_pos) {
-
ERR_FAIL_COND(instances.size());
ERR_FAIL_COND(!functions.has(p_func));
Function &func = functions[p_func];
@@ -424,7 +392,6 @@ void VisualScript::set_node_position(const StringName &p_func, int p_id, const P
}
Point2 VisualScript::get_node_position(const StringName &p_func, int p_id) const {
-
ERR_FAIL_COND_V(!functions.has(p_func), Point2());
const Function &func = functions[p_func];
@@ -433,7 +400,6 @@ Point2 VisualScript::get_node_position(const StringName &p_func, int p_id) const
}
void VisualScript::get_node_list(const StringName &p_func, List<int> *r_nodes) const {
-
ERR_FAIL_COND(!functions.has(p_func));
const Function &func = functions[p_func];
@@ -443,7 +409,6 @@ void VisualScript::get_node_list(const StringName &p_func, List<int> *r_nodes) c
}
void VisualScript::sequence_connect(const StringName &p_func, int p_from_node, int p_from_output, int p_to_node) {
-
ERR_FAIL_COND(instances.size());
ERR_FAIL_COND(!functions.has(p_func));
Function &func = functions[p_func];
@@ -458,7 +423,6 @@ void VisualScript::sequence_connect(const StringName &p_func, int p_from_node, i
}
void VisualScript::sequence_disconnect(const StringName &p_func, int p_from_node, int p_from_output, int p_to_node) {
-
ERR_FAIL_COND(!functions.has(p_func));
Function &func = functions[p_func];
@@ -472,7 +436,6 @@ void VisualScript::sequence_disconnect(const StringName &p_func, int p_from_node
}
bool VisualScript::has_sequence_connection(const StringName &p_func, int p_from_node, int p_from_output, int p_to_node) const {
-
ERR_FAIL_COND_V(!functions.has(p_func), false);
const Function &func = functions[p_func];
@@ -485,7 +448,6 @@ bool VisualScript::has_sequence_connection(const StringName &p_func, int p_from_
}
void VisualScript::get_sequence_connection_list(const StringName &p_func, List<SequenceConnection> *r_connection) const {
-
ERR_FAIL_COND(!functions.has(p_func));
const Function &func = functions[p_func];
@@ -495,7 +457,6 @@ void VisualScript::get_sequence_connection_list(const StringName &p_func, List<S
}
void VisualScript::data_connect(const StringName &p_func, int p_from_node, int p_from_port, int p_to_node, int p_to_port) {
-
ERR_FAIL_COND(instances.size());
ERR_FAIL_COND(!functions.has(p_func));
Function &func = functions[p_func];
@@ -512,7 +473,6 @@ void VisualScript::data_connect(const StringName &p_func, int p_from_node, int p
}
void VisualScript::data_disconnect(const StringName &p_func, int p_from_node, int p_from_port, int p_to_node, int p_to_port) {
-
ERR_FAIL_COND(!functions.has(p_func));
Function &func = functions[p_func];
@@ -528,7 +488,6 @@ void VisualScript::data_disconnect(const StringName &p_func, int p_from_node, in
}
bool VisualScript::has_data_connection(const StringName &p_func, int p_from_node, int p_from_port, int p_to_node, int p_to_port) const {
-
ERR_FAIL_COND_V(!functions.has(p_func), false);
const Function &func = functions[p_func];
@@ -542,7 +501,6 @@ bool VisualScript::has_data_connection(const StringName &p_func, int p_from_node
}
bool VisualScript::is_input_value_port_connected(const StringName &p_func, int p_node, int p_port) const {
-
ERR_FAIL_COND_V(!functions.has(p_func), false);
const Function &func = functions[p_func];
@@ -555,7 +513,6 @@ bool VisualScript::is_input_value_port_connected(const StringName &p_func, int p
}
bool VisualScript::get_input_value_port_connection_source(const StringName &p_func, int p_node, int p_port, int *r_node, int *r_port) const {
-
ERR_FAIL_COND_V(!functions.has(p_func), false);
const Function &func = functions[p_func];
@@ -571,7 +528,6 @@ bool VisualScript::get_input_value_port_connection_source(const StringName &p_fu
}
void VisualScript::get_data_connection_list(const StringName &p_func, List<DataConnection> *r_connection) const {
-
ERR_FAIL_COND(!functions.has(p_func));
const Function &func = functions[p_func];
@@ -585,7 +541,6 @@ void VisualScript::set_tool_enabled(bool p_enabled) {
}
void VisualScript::add_variable(const StringName &p_name, const Variant &p_default_value, bool p_export) {
-
ERR_FAIL_COND(instances.size());
ERR_FAIL_COND(!String(p_name).is_valid_identifier());
ERR_FAIL_COND(variables.has(p_name));
@@ -605,12 +560,10 @@ void VisualScript::add_variable(const StringName &p_name, const Variant &p_defau
}
bool VisualScript::has_variable(const StringName &p_name) const {
-
return variables.has(p_name);
}
void VisualScript::remove_variable(const StringName &p_name) {
-
ERR_FAIL_COND(!variables.has(p_name));
variables.erase(p_name);
@@ -620,7 +573,6 @@ void VisualScript::remove_variable(const StringName &p_name) {
}
void VisualScript::set_variable_default_value(const StringName &p_name, const Variant &p_value) {
-
ERR_FAIL_COND(!variables.has(p_name));
variables[p_name].default_value = p_value;
@@ -630,12 +582,10 @@ void VisualScript::set_variable_default_value(const StringName &p_name, const Va
#endif
}
Variant VisualScript::get_variable_default_value(const StringName &p_name) const {
-
ERR_FAIL_COND_V(!variables.has(p_name), Variant());
return variables[p_name].default_value;
}
void VisualScript::set_variable_info(const StringName &p_name, const PropertyInfo &p_info) {
-
ERR_FAIL_COND(instances.size());
ERR_FAIL_COND(!variables.has(p_name));
variables[p_name].info = p_info;
@@ -646,13 +596,11 @@ void VisualScript::set_variable_info(const StringName &p_name, const PropertyInf
#endif
}
PropertyInfo VisualScript::get_variable_info(const StringName &p_name) const {
-
ERR_FAIL_COND_V(!variables.has(p_name), PropertyInfo());
return variables[p_name].info;
}
void VisualScript::set_variable_export(const StringName &p_name, bool p_export) {
-
ERR_FAIL_COND(!variables.has(p_name));
variables[p_name]._export = p_export;
@@ -662,13 +610,11 @@ void VisualScript::set_variable_export(const StringName &p_name, bool p_export)
}
bool VisualScript::get_variable_export(const StringName &p_name) const {
-
ERR_FAIL_COND_V(!variables.has(p_name), false);
return variables[p_name]._export;
}
void VisualScript::_set_variable_info(const StringName &p_name, const Dictionary &p_info) {
-
PropertyInfo pinfo;
if (p_info.has("type"))
pinfo.type = Variant::Type(int(p_info["type"]));
@@ -685,7 +631,6 @@ void VisualScript::_set_variable_info(const StringName &p_name, const Dictionary
}
Dictionary VisualScript::_get_variable_info(const StringName &p_name) const {
-
PropertyInfo pinfo = get_variable_info(p_name);
Dictionary d;
d["type"] = pinfo.type;
@@ -698,7 +643,6 @@ Dictionary VisualScript::_get_variable_info(const StringName &p_name) const {
}
void VisualScript::get_variable_list(List<StringName> *r_variables) const {
-
for (Map<StringName, Variable>::Element *E = variables.front(); E; E = E->next()) {
r_variables->push_back(E->key());
}
@@ -707,13 +651,11 @@ void VisualScript::get_variable_list(List<StringName> *r_variables) const {
}
void VisualScript::set_instance_base_type(const StringName &p_type) {
-
ERR_FAIL_COND(instances.size());
base_type = p_type;
}
void VisualScript::rename_variable(const StringName &p_name, const StringName &p_new_name) {
-
ERR_FAIL_COND(instances.size());
ERR_FAIL_COND(!variables.has(p_name));
if (p_new_name == p_name)
@@ -750,7 +692,6 @@ void VisualScript::rename_variable(const StringName &p_name, const StringName &p
}
void VisualScript::add_custom_signal(const StringName &p_name) {
-
ERR_FAIL_COND(instances.size());
ERR_FAIL_COND(!String(p_name).is_valid_identifier());
ERR_FAIL_COND(custom_signals.has(p_name));
@@ -759,11 +700,9 @@ void VisualScript::add_custom_signal(const StringName &p_name) {
}
bool VisualScript::has_custom_signal(const StringName &p_name) const {
-
return custom_signals.has(p_name);
}
void VisualScript::custom_signal_add_argument(const StringName &p_func, Variant::Type p_type, const String &p_name, int p_index) {
-
ERR_FAIL_COND(instances.size());
ERR_FAIL_COND(!custom_signals.has(p_func));
Argument arg;
@@ -775,14 +714,12 @@ void VisualScript::custom_signal_add_argument(const StringName &p_func, Variant:
custom_signals[p_func].insert(0, arg);
}
void VisualScript::custom_signal_set_argument_type(const StringName &p_func, int p_argidx, Variant::Type p_type) {
-
ERR_FAIL_COND(instances.size());
ERR_FAIL_COND(!custom_signals.has(p_func));
ERR_FAIL_INDEX(p_argidx, custom_signals[p_func].size());
custom_signals[p_func].write[p_argidx].type = p_type;
}
Variant::Type VisualScript::custom_signal_get_argument_type(const StringName &p_func, int p_argidx) const {
-
ERR_FAIL_COND_V(!custom_signals.has(p_func), Variant::NIL);
ERR_FAIL_INDEX_V(p_argidx, custom_signals[p_func].size(), Variant::NIL);
return custom_signals[p_func][p_argidx].type;
@@ -794,13 +731,11 @@ void VisualScript::custom_signal_set_argument_name(const StringName &p_func, int
custom_signals[p_func].write[p_argidx].name = p_name;
}
String VisualScript::custom_signal_get_argument_name(const StringName &p_func, int p_argidx) const {
-
ERR_FAIL_COND_V(!custom_signals.has(p_func), String());
ERR_FAIL_INDEX_V(p_argidx, custom_signals[p_func].size(), String());
return custom_signals[p_func][p_argidx].name;
}
void VisualScript::custom_signal_remove_argument(const StringName &p_func, int p_argidx) {
-
ERR_FAIL_COND(instances.size());
ERR_FAIL_COND(!custom_signals.has(p_func));
ERR_FAIL_INDEX(p_argidx, custom_signals[p_func].size());
@@ -808,12 +743,10 @@ void VisualScript::custom_signal_remove_argument(const StringName &p_func, int p
}
int VisualScript::custom_signal_get_argument_count(const StringName &p_func) const {
-
ERR_FAIL_COND_V(!custom_signals.has(p_func), 0);
return custom_signals[p_func].size();
}
void VisualScript::custom_signal_swap_argument(const StringName &p_func, int p_argidx, int p_with_argidx) {
-
ERR_FAIL_COND(instances.size());
ERR_FAIL_COND(!custom_signals.has(p_func));
ERR_FAIL_INDEX(p_argidx, custom_signals[p_func].size());
@@ -822,14 +755,12 @@ void VisualScript::custom_signal_swap_argument(const StringName &p_func, int p_a
SWAP(custom_signals[p_func].write[p_argidx], custom_signals[p_func].write[p_with_argidx]);
}
void VisualScript::remove_custom_signal(const StringName &p_name) {
-
ERR_FAIL_COND(instances.size());
ERR_FAIL_COND(!custom_signals.has(p_name));
custom_signals.erase(p_name);
}
void VisualScript::rename_custom_signal(const StringName &p_name, const StringName &p_new_name) {
-
ERR_FAIL_COND(instances.size());
ERR_FAIL_COND(!custom_signals.has(p_name));
if (p_new_name == p_name)
@@ -846,7 +777,6 @@ void VisualScript::rename_custom_signal(const StringName &p_name, const StringNa
}
void VisualScript::get_custom_signal_list(List<StringName> *r_custom_signals) const {
-
for (const Map<StringName, Vector<Argument>>::Element *E = custom_signals.front(); E; E = E->next()) {
r_custom_signals->push_back(E->key());
}
@@ -855,7 +785,6 @@ void VisualScript::get_custom_signal_list(List<StringName> *r_custom_signals) co
}
int VisualScript::get_available_id() const {
-
int max_id = 0;
for (Map<StringName, Function>::Element *E = functions.front(); E; E = E->next()) {
if (E->get().nodes.empty())
@@ -871,12 +800,10 @@ int VisualScript::get_available_id() const {
/////////////////////////////////
bool VisualScript::can_instance() const {
-
return true; //ScriptServer::is_scripting_enabled();
}
StringName VisualScript::get_instance_base_type() const {
-
return base_type;
}
@@ -886,19 +813,16 @@ Ref<Script> VisualScript::get_base_script() const {
#ifdef TOOLS_ENABLED
void VisualScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder) {
-
placeholders.erase(p_placeholder);
}
void VisualScript::_update_placeholders() {
-
if (placeholders.size() == 0)
return; //no bother if no placeholders
List<PropertyInfo> pinfo;
Map<StringName, Variant> values;
for (Map<StringName, Variable>::Element *E = variables.front(); E; E = E->next()) {
-
if (!E->get()._export)
continue;
@@ -909,7 +833,6 @@ void VisualScript::_update_placeholders() {
}
for (Set<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) {
-
E->get()->update(pinfo, values);
}
}
@@ -917,11 +840,9 @@ void VisualScript::_update_placeholders() {
#endif
ScriptInstance *VisualScript::instance_create(Object *p_this) {
-
#ifdef TOOLS_ENABLED
if (!ScriptServer::is_scripting_enabled() && !is_tool_script) {
-
PlaceHolderScriptInstance *sins = memnew(PlaceHolderScriptInstance(VisualScriptLanguage::singleton, Ref<Script>((Script *)this), p_this));
placeholders.insert(sins);
@@ -929,7 +850,6 @@ ScriptInstance *VisualScript::instance_create(Object *p_this) {
Map<StringName, Variant> values;
for (Map<StringName, Variable>::Element *E = variables.front(); E; E = E->next()) {
-
if (!E->get()._export)
continue;
@@ -958,17 +878,14 @@ ScriptInstance *VisualScript::instance_create(Object *p_this) {
}
bool VisualScript::instance_has(const Object *p_this) const {
-
return instances.has((Object *)p_this);
}
bool VisualScript::has_source_code() const {
-
return false;
}
String VisualScript::get_source_code() const {
-
return String();
}
@@ -976,12 +893,10 @@ void VisualScript::set_source_code(const String &p_code) {
}
Error VisualScript::reload(bool p_keep_state) {
-
return OK;
}
bool VisualScript::is_tool() const {
-
return is_tool_script;
}
@@ -990,19 +905,15 @@ bool VisualScript::is_valid() const {
}
ScriptLanguage *VisualScript::get_language() const {
-
return VisualScriptLanguage::singleton;
}
bool VisualScript::has_script_signal(const StringName &p_signal) const {
-
return custom_signals.has(p_signal);
}
void VisualScript::get_script_signal_list(List<MethodInfo> *r_signals) const {
-
for (const Map<StringName, Vector<Argument>>::Element *E = custom_signals.front(); E; E = E->next()) {
-
MethodInfo mi;
mi.name = E->key();
for (int i = 0; i < E->get().size(); i++) {
@@ -1017,7 +928,6 @@ void VisualScript::get_script_signal_list(List<MethodInfo> *r_signals) const {
}
bool VisualScript::get_property_default_value(const StringName &p_property, Variant &r_value) const {
-
if (!variables.has(p_property))
return false;
@@ -1025,13 +935,10 @@ bool VisualScript::get_property_default_value(const StringName &p_property, Vari
return true;
}
void VisualScript::get_script_method_list(List<MethodInfo> *p_list) const {
-
for (Map<StringName, Function>::Element *E = functions.front(); E; E = E->next()) {
-
MethodInfo mi;
mi.name = E->key();
if (E->get().function_id >= 0) {
-
Ref<VisualScriptFunction> func = E->get().nodes[E->get().function_id].node;
if (func.is_valid()) {
for (int i = 0; i < func->get_argument_count(); i++) {
@@ -1048,11 +955,9 @@ void VisualScript::get_script_method_list(List<MethodInfo> *p_list) const {
}
bool VisualScript::has_method(const StringName &p_method) const {
-
return functions.has(p_method);
}
MethodInfo VisualScript::get_method_info(const StringName &p_method) const {
-
const Map<StringName, Function>::Element *E = functions.find(p_method);
if (!E)
return MethodInfo();
@@ -1060,10 +965,8 @@ MethodInfo VisualScript::get_method_info(const StringName &p_method) const {
MethodInfo mi;
mi.name = E->key();
if (E->get().function_id >= 0) {
-
Ref<VisualScriptFunction> func = E->get().nodes[E->get().function_id].node;
if (func.is_valid()) {
-
for (int i = 0; i < func->get_argument_count(); i++) {
PropertyInfo arg;
arg.name = func->get_argument_name(i);
@@ -1081,7 +984,6 @@ MethodInfo VisualScript::get_method_info(const StringName &p_method) const {
}
void VisualScript::get_script_property_list(List<PropertyInfo> *p_list) const {
-
List<StringName> vars;
get_variable_list(&vars);
@@ -1108,9 +1010,7 @@ int VisualScript::get_member_line(const StringName &p_member) const {
#ifdef TOOLS_ENABLED
bool VisualScript::are_subnodes_edited() const {
-
for (const Map<StringName, Function>::Element *E = functions.front(); E; E = E->next()) {
-
for (const Map<int, Function::NodeData>::Element *F = E->get().nodes.front(); F; F = F->next()) {
if (F->get().node->is_edited()) {
return true;
@@ -1177,7 +1077,6 @@ MultiplayerAPI::RPCMode VisualScript::get_rset_mode(const StringName &p_variable
}
void VisualScript::_set_data(const Dictionary &p_data) {
-
Dictionary d = p_data;
if (d.has("base_type"))
base_type = d["base_type"];
@@ -1185,7 +1084,6 @@ void VisualScript::_set_data(const Dictionary &p_data) {
variables.clear();
Array vars = d["variables"];
for (int i = 0; i < vars.size(); i++) {
-
Dictionary v = vars[i];
StringName name = v["name"];
add_variable(name);
@@ -1197,7 +1095,6 @@ void VisualScript::_set_data(const Dictionary &p_data) {
custom_signals.clear();
Array sigs = d["signals"];
for (int i = 0; i < sigs.size(); i++) {
-
Dictionary cs = sigs[i];
add_custom_signal(cs["name"]);
@@ -1214,7 +1111,6 @@ void VisualScript::_set_data(const Dictionary &p_data) {
Vector2 last_size = Vector2(0.0, 0.0);
for (int i = 0; i < funcs.size(); i++) {
-
Dictionary func = funcs[i];
StringName name = func["name"];
@@ -1264,14 +1160,12 @@ void VisualScript::_set_data(const Dictionary &p_data) {
Array sequence_connections = func["sequence_connections"];
for (int j = 0; j < sequence_connections.size(); j += 3) {
-
sequence_connect(name, sequence_connections[j + 0], sequence_connections[j + 1], sequence_connections[j + 2]);
}
Array data_connections = func["data_connections"];
for (int j = 0; j < data_connections.size(); j += 4) {
-
data_connect(name, data_connections[j + 0], data_connections[j + 1], data_connections[j + 2], data_connections[j + 3]);
}
}
@@ -1307,12 +1201,10 @@ void VisualScript::_set_data(const Dictionary &p_data) {
}
Dictionary VisualScript::_get_data() const {
-
Dictionary d;
d["base_type"] = base_type;
Array vars;
for (const Map<StringName, Variable>::Element *E = variables.front(); E; E = E->next()) {
-
Dictionary var = _get_variable_info(E->key());
var["name"] = E->key(); //make sure it's the right one
var["default_value"] = E->get().default_value;
@@ -1323,7 +1215,6 @@ Dictionary VisualScript::_get_data() const {
Array sigs;
for (const Map<StringName, Vector<Argument>>::Element *E = custom_signals.front(); E; E = E->next()) {
-
Dictionary cs;
cs["name"] = E->key();
Array args;
@@ -1341,7 +1232,6 @@ Dictionary VisualScript::_get_data() const {
Array funcs;
for (const Map<StringName, Function>::Element *E = functions.front(); E; E = E->next()) {
-
Dictionary func;
func["name"] = E->key();
func["function_id"] = E->get().function_id;
@@ -1350,7 +1240,6 @@ Dictionary VisualScript::_get_data() const {
Array nodes;
for (const Map<int, Function::NodeData>::Element *F = E->get().nodes.front(); F; F = F->next()) {
-
nodes.push_back(F->key());
nodes.push_back(F->get().pos);
nodes.push_back(F->get().node);
@@ -1361,7 +1250,6 @@ Dictionary VisualScript::_get_data() const {
Array sequence_connections;
for (const Set<SequenceConnection>::Element *F = E->get().sequence_connections.front(); F; F = F->next()) {
-
sequence_connections.push_back(F->get().from_node);
sequence_connections.push_back(F->get().from_output);
sequence_connections.push_back(F->get().to_node);
@@ -1372,7 +1260,6 @@ Dictionary VisualScript::_get_data() const {
Array data_connections;
for (const Set<DataConnection>::Element *F = E->get().data_connections.front(); F; F = F->next()) {
-
data_connections.push_back(F->get().from_node);
data_connections.push_back(F->get().from_port);
data_connections.push_back(F->get().to_node);
@@ -1392,7 +1279,6 @@ Dictionary VisualScript::_get_data() const {
}
void VisualScript::_bind_methods() {
-
ClassDB::bind_method(D_METHOD("add_function", "name"), &VisualScript::add_function);
ClassDB::bind_method(D_METHOD("has_function", "name"), &VisualScript::has_function);
ClassDB::bind_method(D_METHOD("remove_function", "name"), &VisualScript::remove_function);
@@ -1455,7 +1341,6 @@ void VisualScript::_bind_methods() {
}
VisualScript::VisualScript() {
-
base_type = "Object";
is_tool_script = false;
}
@@ -1482,7 +1367,6 @@ Set<int> VisualScript::get_output_sequence_ports_connected(const String &edited_
}
VisualScript::~VisualScript() {
-
while (!functions.empty()) {
remove_function(functions.front()->key());
}
@@ -1491,7 +1375,6 @@ VisualScript::~VisualScript() {
////////////////////////////////////////////
bool VisualScriptInstance::set(const StringName &p_name, const Variant &p_value) {
-
Map<StringName, Variant>::Element *E = variables.find(p_name);
if (!E)
return false;
@@ -1502,7 +1385,6 @@ bool VisualScriptInstance::set(const StringName &p_name, const Variant &p_value)
}
bool VisualScriptInstance::get(const StringName &p_name, Variant &r_ret) const {
-
const Map<StringName, Variant>::Element *E = variables.find(p_name);
if (!E)
return false;
@@ -1511,9 +1393,7 @@ bool VisualScriptInstance::get(const StringName &p_name, Variant &r_ret) const {
return true;
}
void VisualScriptInstance::get_property_list(List<PropertyInfo> *p_properties) const {
-
for (const Map<StringName, VisualScript::Variable>::Element *E = script->variables.front(); E; E = E->next()) {
-
if (!E->get()._export)
continue;
PropertyInfo p = E->get().info;
@@ -1523,7 +1403,6 @@ void VisualScriptInstance::get_property_list(List<PropertyInfo> *p_properties) c
}
}
Variant::Type VisualScriptInstance::get_property_type(const StringName &p_name, bool *r_is_valid) const {
-
const Map<StringName, VisualScript::Variable>::Element *E = script->variables.find(p_name);
if (!E) {
if (r_is_valid)
@@ -1538,9 +1417,7 @@ Variant::Type VisualScriptInstance::get_property_type(const StringName &p_name,
}
void VisualScriptInstance::get_method_list(List<MethodInfo> *p_list) const {
-
for (const Map<StringName, VisualScript::Function>::Element *E = script->functions.front(); E; E = E->next()) {
-
if (E->key() == script->get_default_func()) {
continue;
}
@@ -1548,10 +1425,8 @@ void VisualScriptInstance::get_method_list(List<MethodInfo> *p_list) const {
MethodInfo mi;
mi.name = E->key();
if (E->get().function_id >= 0 && E->get().nodes.has(E->get().function_id)) {
-
Ref<VisualScriptFunction> vsf = E->get().nodes[E->get().function_id].node;
if (vsf.is_valid()) {
-
for (int i = 0; i < vsf->get_argument_count(); i++) {
PropertyInfo arg;
arg.name = vsf->get_argument_name(i);
@@ -1570,7 +1445,6 @@ void VisualScriptInstance::get_method_list(List<MethodInfo> *p_list) const {
}
}
bool VisualScriptInstance::has_method(const StringName &p_method) const {
-
if (p_method == script->get_default_func())
return false;
@@ -1581,7 +1455,6 @@ bool VisualScriptInstance::has_method(const StringName &p_method) const {
#define VSDEBUG(m_text)
void VisualScriptInstance::_dependency_step(VisualScriptNodeInstance *node, int p_pass, int *pass_stack, const Variant **input_args, Variant **output_args, Variant *variant_stack, Callable::CallError &r_error, String &error_str, VisualScriptNodeInstance **r_error_node) {
-
ERR_FAIL_COND(node->pass_idx == -1);
if (pass_stack[node->pass_idx] == p_pass)
@@ -1590,12 +1463,10 @@ void VisualScriptInstance::_dependency_step(VisualScriptNodeInstance *node, int
pass_stack[node->pass_idx] = p_pass;
if (!node->dependencies.empty()) {
-
int dc = node->dependencies.size();
VisualScriptNodeInstance **deps = node->dependencies.ptrw();
for (int i = 0; i < dc; i++) {
-
_dependency_step(deps[i], p_pass, pass_stack, input_args, output_args, variant_stack, r_error, error_str, r_error_node);
if (r_error.error != Callable::CallError::CALL_OK)
return;
@@ -1603,7 +1474,6 @@ void VisualScriptInstance::_dependency_step(VisualScriptNodeInstance *node, int
}
for (int i = 0; i < node->input_port_count; i++) {
-
int index = node->input_ports[i] & VisualScriptNodeInstance::INPUT_MASK;
if (node->input_ports[i] & VisualScriptNodeInstance::INPUT_DEFAULT_VALUE_BIT) {
@@ -1628,7 +1498,6 @@ void VisualScriptInstance::_dependency_step(VisualScriptNodeInstance *node, int
}
Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p_stack, int p_stack_size, VisualScriptNodeInstance *p_node, int p_flow_stack_pos, int p_pass, bool p_resuming_yield, Callable::CallError &r_error) {
-
Map<StringName, Function>::Element *F = functions.find(p_method);
ERR_FAIL_COND_V(!F, Variant());
Function *f = &F->get();
@@ -1659,7 +1528,6 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
#endif
while (true) {
-
p_pass++; //increment pass
current_node_id = node->get_id();
@@ -1678,16 +1546,13 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
input_args[i] = &variant_stack[i];
}
} else {
-
//run dependencies first
if (!node->dependencies.empty()) {
-
int dc = node->dependencies.size();
VisualScriptNodeInstance **deps = node->dependencies.ptrw();
for (int i = 0; i < dc; i++) {
-
_dependency_step(deps[i], p_pass, pass_stack, input_args, output_args, variant_stack, r_error, error_str, &node);
if (r_error.error != Callable::CallError::CALL_OK) {
error = true;
@@ -1698,12 +1563,10 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
}
if (!error) {
-
//setup input pointers normally
VSDEBUG("INPUT PORTS: " + itos(node->input_port_count));
for (int i = 0; i < node->input_port_count; i++) {
-
int index = node->input_ports[i] & VisualScriptNodeInstance::INPUT_MASK;
if (node->input_ports[i] & VisualScriptNodeInstance::INPUT_DEFAULT_VALUE_BIT) {
@@ -1766,7 +1629,6 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
} else {
Ref<VisualScriptFunctionState> state = *working_mem;
if (!state.is_valid()) {
-
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
error_str = RTR("Node yielded, but did not return a function state in the first working memory.");
error = true;
@@ -1805,7 +1667,6 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
bool do_break = false;
if (EngineDebugger::get_script_debugger()->get_lines_left() > 0) {
-
if (EngineDebugger::get_script_debugger()->get_depth() <= 0)
EngineDebugger::get_script_debugger()->set_lines_left(EngineDebugger::get_script_debugger()->get_lines_left() - 1);
if (EngineDebugger::get_script_debugger()->get_lines_left() <= 0)
@@ -1828,7 +1689,6 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
if (ret & VisualScriptNodeInstance::STEP_EXIT_FUNCTION_BIT) {
if (node->get_working_memory_size() == 0) {
-
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
error_str = RTR("Return value must be assigned to first element of node working memory! Fix your node please.");
error = true;
@@ -1861,13 +1721,11 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
}
if (flow_stack) {
-
//update flow stack pos (may have changed)
flow_stack[flow_stack_pos] = current_node_id;
//add stack push bit if requested
if (ret & VisualScriptNodeInstance::STEP_FLAG_PUSH_STACK_BIT) {
-
flow_stack[flow_stack_pos] |= VisualScriptNodeInstance::FLOW_STACK_PUSHED_BIT;
sequence_bits[node->sequence_index] = true; //remember sequence bit
VSDEBUG("NEXT SEQ - FLAG BIT");
@@ -1888,7 +1746,6 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
break; //simply exit without value or error
}
} else if (next) {
-
if (sequence_bits[next->sequence_index]) {
// what happened here is that we are entering a node that is in the middle of doing a sequence (pushed stack) from the front
// because each node has a working memory, we can't really do a sub-sequence
@@ -1898,7 +1755,6 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
bool found = false;
for (int i = flow_stack_pos; i >= 0; i--) {
-
if ((flow_stack[i] & VisualScriptNodeInstance::FLOW_STACK_MASK) == next->get_id()) {
flow_stack_pos = i; //roll back and remove bit
flow_stack[i] = next->get_id();
@@ -1940,10 +1796,8 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
bool found = false;
for (int i = flow_stack_pos; i >= 0; i--) {
-
VSDEBUG("FS " + itos(i) + " - " + itos(flow_stack[i]));
if (flow_stack[i] & VisualScriptNodeInstance::FLOW_STACK_PUSHED_BIT) {
-
node = instances[flow_stack[i] & VisualScriptNodeInstance::FLOW_STACK_MASK];
flow_stack_pos = i;
found = true;
@@ -1959,13 +1813,11 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
VSDEBUG("NO NEXT NODE, GO BACK TO: " + itos(flow_stack_pos));
}
} else {
-
node = next; //stackless mode, simply assign next node
}
}
if (error) {
-
//error
// function, file, line, error, explanation
String err_file = script->get_path();
@@ -1973,7 +1825,6 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
int err_line = current_node_id; //not a line but it works as one
if (node && (r_error.error != Callable::CallError::CALL_ERROR_INVALID_METHOD || error_str == String())) {
-
if (error_str != String()) {
error_str += " ";
}
@@ -1996,13 +1847,11 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
// debugger break did not happen
if (!VisualScriptLanguage::singleton->debug_break(error_str, false)) {
-
_err_print_error(err_func.utf8().get_data(), err_file.utf8().get_data(), err_line, error_str.utf8().get_data(), ERR_HANDLER_SCRIPT);
}
//}
} else {
-
//return_value=
}
@@ -2021,7 +1870,6 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
}
Variant VisualScriptInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
-
r_error.error = Callable::CallError::CALL_OK; //ok by default
Map<StringName, Function>::Element *F = functions.find(p_method);
@@ -2109,7 +1957,6 @@ Variant VisualScriptInstance::call(const StringName &p_method, const Variant **p
}
void VisualScriptInstance::notification(int p_notification) {
-
//do nothing as this is called using virtual
Variant what = p_notification;
@@ -2139,7 +1986,6 @@ String VisualScriptInstance::to_string(bool *r_valid) {
}
Ref<Script> VisualScriptInstance::get_script() const {
-
return script;
}
@@ -2184,7 +2030,6 @@ MultiplayerAPI::RPCMode VisualScriptInstance::get_rset_mode(const StringName &p_
}
void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_owner) {
-
script = p_script;
owner = p_owner;
source = p_script->get_path();
@@ -2212,7 +2057,6 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
}
for (const Map<StringName, VisualScript::Function>::Element *E = script->functions.front(); E; E = E->next()) {
-
if (E->key() == script->get_default_func()) {
continue;
}
@@ -2251,7 +2095,6 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
//first create the nodes
for (const Map<int, VisualScript::Function::NodeData>::Element *F = E->get().nodes.front(); F; F = F->next()) {
-
Ref<VisualScriptNode> node = F->get().node;
VisualScriptNodeInstance *instance = node->instance(this); //create instance
@@ -2272,7 +2115,6 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
if (instance->input_port_count) {
instance->input_ports = memnew_arr(int, instance->input_port_count);
for (int i = 0; i < instance->input_port_count; i++) {
-
instance->input_ports[i] = -1; //if not assigned, will become default value
}
}
@@ -2327,7 +2169,6 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
//second pass, do data connections
for (const Set<VisualScript::DataConnection>::Element *F = E->get().data_connections.front(); F; F = F->next()) {
-
VisualScript::DataConnection dc = F->get();
ERR_CONTINUE(!instances.has(dc.from_node));
VisualScriptNodeInstance *from = instances[dc.from_node];
@@ -2337,7 +2178,6 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
ERR_CONTINUE(dc.to_port >= to->input_port_count);
if (from->output_ports[dc.from_port] == -1) {
-
int stack_pos = function.max_stack++;
from->output_ports[dc.from_port] = stack_pos;
}
@@ -2357,7 +2197,6 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
//third pass, do sequence connections
for (const Set<VisualScript::SequenceConnection>::Element *F = E->get().sequence_connections.front(); F; F = F->next()) {
-
VisualScript::SequenceConnection sc = F->get();
ERR_CONTINUE(!instances.has(sc.from_node));
VisualScriptNodeInstance *from = instances[sc.from_node];
@@ -2373,7 +2212,6 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
// 2) connect unassigned output ports to trash
for (const Map<int, VisualScript::Function::NodeData>::Element *F = E->get().nodes.front(); F; F = F->next()) {
-
ERR_CONTINUE(!instances.has(F->key()));
Ref<VisualScriptNode> node = F->get().node;
@@ -2382,7 +2220,6 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
// connect to default values
for (int i = 0; i < instance->input_port_count; i++) {
if (instance->input_ports[i] == -1) {
-
//unassigned, connect to default val
instance->input_ports[i] = default_values.size() | VisualScriptNodeInstance::INPUT_DEFAULT_VALUE_BIT;
default_values.push_back(node->get_default_input_value(i));
@@ -2402,7 +2239,6 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
}
ScriptLanguage *VisualScriptInstance::get_language() {
-
return VisualScriptLanguage::singleton;
}
@@ -2410,7 +2246,6 @@ VisualScriptInstance::VisualScriptInstance() {
}
VisualScriptInstance::~VisualScriptInstance() {
-
{
MutexLock lock(VisualScriptLanguage::singleton->lock);
@@ -2427,7 +2262,6 @@ VisualScriptInstance::~VisualScriptInstance() {
/////////////////////
Variant VisualScriptFunctionState::_signal_callback(const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
-
ERR_FAIL_COND_V(function == StringName(), Variant());
#ifdef DEBUG_ENABLED
@@ -2448,7 +2282,6 @@ Variant VisualScriptFunctionState::_signal_callback(const Variant **p_args, int
} else if (p_argcount == 1) {
//noooneee, reserved for me, me and only me.
} else {
-
for (int i = 0; i < p_argcount - 1; i++) {
args.push_back(*p_args[i]);
}
@@ -2475,7 +2308,6 @@ Variant VisualScriptFunctionState::_signal_callback(const Variant **p_args, int
}
void VisualScriptFunctionState::connect_to_signal(Object *p_obj, const String &p_signal, Array p_binds) {
-
Vector<Variant> binds;
for (int i = 0; i < p_binds.size(); i++) {
binds.push_back(p_binds[i]);
@@ -2485,12 +2317,10 @@ void VisualScriptFunctionState::connect_to_signal(Object *p_obj, const String &p
}
bool VisualScriptFunctionState::is_valid() const {
-
return function != StringName();
}
Variant VisualScriptFunctionState::resume(Array p_args) {
-
ERR_FAIL_COND_V(function == StringName(), Variant());
#ifdef DEBUG_ENABLED
@@ -2512,7 +2342,6 @@ Variant VisualScriptFunctionState::resume(Array p_args) {
}
void VisualScriptFunctionState::_bind_methods() {
-
ClassDB::bind_method(D_METHOD("connect_to_signal", "obj", "signals", "args"), &VisualScriptFunctionState::connect_to_signal);
ClassDB::bind_method(D_METHOD("resume", "args"), &VisualScriptFunctionState::resume, DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("is_valid"), &VisualScriptFunctionState::is_valid);
@@ -2523,7 +2352,6 @@ VisualScriptFunctionState::VisualScriptFunctionState() {
}
VisualScriptFunctionState::~VisualScriptFunctionState() {
-
if (function != StringName()) {
Variant *s = ((Variant *)stack.ptr());
for (int i = 0; i < variant_stack_size; i++) {
@@ -2535,7 +2363,6 @@ VisualScriptFunctionState::~VisualScriptFunctionState() {
///////////////////////////////////////////////
String VisualScriptLanguage::get_name() const {
-
return "VisualScript";
}
@@ -2543,15 +2370,12 @@ String VisualScriptLanguage::get_name() const {
void VisualScriptLanguage::init() {
}
String VisualScriptLanguage::get_type() const {
-
return "VisualScript";
}
String VisualScriptLanguage::get_extension() const {
-
return "vs";
}
Error VisualScriptLanguage::execute_file(const String &p_path) {
-
return OK;
}
void VisualScriptLanguage::finish() {
@@ -2565,7 +2389,6 @@ void VisualScriptLanguage::get_comment_delimiters(List<String> *p_delimiters) co
void VisualScriptLanguage::get_string_delimiters(List<String> *p_delimiters) const {
}
Ref<Script> VisualScriptLanguage::get_template(const String &p_class_name, const String &p_base_class_name) const {
-
Ref<VisualScript> script;
script.instance();
script->set_instance_base_type(p_base_class_name);
@@ -2573,7 +2396,6 @@ Ref<Script> VisualScriptLanguage::get_template(const String &p_class_name, const
}
bool VisualScriptLanguage::is_using_templates() {
-
return true;
}
@@ -2583,27 +2405,21 @@ void VisualScriptLanguage::make_template(const String &p_class_name, const Strin
}
bool VisualScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions, List<ScriptLanguage::Warning> *r_warnings, Set<int> *r_safe_lines) const {
-
return false;
}
Script *VisualScriptLanguage::create_script() const {
-
return memnew(VisualScript);
}
bool VisualScriptLanguage::has_named_classes() const {
-
return false;
}
bool VisualScriptLanguage::supports_builtin_mode() const {
-
return true;
}
int VisualScriptLanguage::find_function(const String &p_function, const String &p_code) const {
-
return -1;
}
String VisualScriptLanguage::make_function(const String &p_class, const String &p_name, const PackedStringArray &p_args) const {
-
return String();
}
@@ -2618,7 +2434,6 @@ bool VisualScriptLanguage::debug_break_parse(const String &p_file, int p_node, c
//break because of parse error
if (EngineDebugger::is_active() && Thread::get_caller_id() == Thread::get_main_id()) {
-
_debug_parse_err_node = p_node;
_debug_parse_err_file = p_file;
_debug_error = p_error;
@@ -2630,9 +2445,7 @@ bool VisualScriptLanguage::debug_break_parse(const String &p_file, int p_node, c
}
bool VisualScriptLanguage::debug_break(const String &p_error, bool p_allow_continue) {
-
if (EngineDebugger::is_active() && Thread::get_caller_id() == Thread::get_main_id()) {
-
_debug_parse_err_node = -1;
_debug_parse_err_file = "";
_debug_error = p_error;
@@ -2644,19 +2457,16 @@ bool VisualScriptLanguage::debug_break(const String &p_error, bool p_allow_conti
}
String VisualScriptLanguage::debug_get_error() const {
-
return _debug_error;
}
int VisualScriptLanguage::debug_get_stack_level_count() const {
-
if (_debug_parse_err_node >= 0)
return 1;
return _debug_call_stack_pos;
}
int VisualScriptLanguage::debug_get_stack_level_line(int p_level) const {
-
if (_debug_parse_err_node >= 0)
return _debug_parse_err_node;
@@ -2667,7 +2477,6 @@ int VisualScriptLanguage::debug_get_stack_level_line(int p_level) const {
return *(_call_stack[l].current_id);
}
String VisualScriptLanguage::debug_get_stack_level_function(int p_level) const {
-
if (_debug_parse_err_node >= 0)
return "";
@@ -2676,7 +2485,6 @@ String VisualScriptLanguage::debug_get_stack_level_function(int p_level) const {
return *_call_stack[l].function;
}
String VisualScriptLanguage::debug_get_stack_level_source(int p_level) const {
-
if (_debug_parse_err_node >= 0)
return _debug_parse_err_file;
@@ -2685,7 +2493,6 @@ String VisualScriptLanguage::debug_get_stack_level_source(int p_level) const {
return _call_stack[l].instance->get_script_ptr()->get_path();
}
void VisualScriptLanguage::debug_get_stack_level_locals(int p_level, List<String> *p_locals, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {
-
if (_debug_parse_err_node >= 0)
return;
@@ -2724,7 +2531,6 @@ void VisualScriptLanguage::debug_get_stack_level_locals(int p_level, List<String
}
for (int i = 0; i < node->output_port_count; i++) {
-
String name = node->get_base_node()->get_output_value_port_info(i).name;
if (name == String()) {
name = "out_" + itos(i);
@@ -2760,7 +2566,6 @@ void VisualScriptLanguage::debug_get_stack_level_locals(int p_level, List<String
*/
}
void VisualScriptLanguage::debug_get_stack_level_members(int p_level, List<String> *p_members, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {
-
if (_debug_parse_err_node >= 0)
return;
@@ -2783,11 +2588,9 @@ void VisualScriptLanguage::debug_get_stack_level_members(int p_level, List<Strin
}
void VisualScriptLanguage::debug_get_globals(List<String> *p_locals, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {
-
//no globals are really reachable in gdscript
}
String VisualScriptLanguage::debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems, int p_max_depth) {
-
return "";
}
@@ -2798,7 +2601,6 @@ void VisualScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool
/* LOADER FUNCTIONS */
void VisualScriptLanguage::get_recognized_extensions(List<String> *p_extensions) const {
-
p_extensions->push_back("vs");
}
void VisualScriptLanguage::get_public_functions(List<MethodInfo> *p_functions) const {
@@ -2812,19 +2614,16 @@ void VisualScriptLanguage::profiling_stop() {
}
int VisualScriptLanguage::profiling_get_accumulated_data(ProfilingInfo *p_info_arr, int p_info_max) {
-
return 0;
}
int VisualScriptLanguage::profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max) {
-
return 0;
}
VisualScriptLanguage *VisualScriptLanguage::singleton = nullptr;
void VisualScriptLanguage::add_register_func(const String &p_name, VisualScriptNodeRegisterFunc p_func) {
-
ERR_FAIL_COND(register_funcs.has(p_name));
register_funcs[p_name] = p_func;
}
@@ -2835,21 +2634,18 @@ void VisualScriptLanguage::remove_register_func(const String &p_name) {
}
Ref<VisualScriptNode> VisualScriptLanguage::create_node_from_name(const String &p_name) {
-
ERR_FAIL_COND_V(!register_funcs.has(p_name), Ref<VisualScriptNode>());
return register_funcs[p_name](p_name);
}
void VisualScriptLanguage::get_registered_node_names(List<String> *r_names) {
-
for (Map<String, VisualScriptNodeRegisterFunc>::Element *E = register_funcs.front(); E; E = E->next()) {
r_names->push_back(E->key());
}
}
VisualScriptLanguage::VisualScriptLanguage() {
-
notification = "_notification";
_step = "_step";
_subcall = "_subcall";
@@ -2873,7 +2669,6 @@ VisualScriptLanguage::VisualScriptLanguage() {
}
VisualScriptLanguage::~VisualScriptLanguage() {
-
if (_call_stack) {
memdelete_arr(_call_stack);
}