mirror of
https://github.com/godotengine/godot-visual-script.git
synced 2026-01-04 18:10:07 +03:00
Reworked signal connection system, added support for Callable and Signal objects and made them default.
This commit is contained in:
committed by
Juan Linietsky
parent
f8cabf372b
commit
6070e25d17
@@ -88,11 +88,11 @@ void VisualScriptNode::validate_input_default_values() {
|
|||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
//not the same, reconvert
|
//not the same, reconvert
|
||||||
Variant::CallError ce;
|
Callable::CallError ce;
|
||||||
Variant existing = default_input_values[i];
|
Variant existing = default_input_values[i];
|
||||||
const Variant *existingp = &existing;
|
const Variant *existingp = &existing;
|
||||||
default_input_values[i] = Variant::construct(expected, &existingp, 1, ce, false);
|
default_input_values[i] = Variant::construct(expected, &existingp, 1, ce, false);
|
||||||
if (ce.error != Variant::CallError::CALL_OK) {
|
if (ce.error != Callable::CallError::CALL_OK) {
|
||||||
//could not convert? force..
|
//could not convert? force..
|
||||||
default_input_values[i] = Variant::construct(expected, NULL, 0, ce, false);
|
default_input_values[i] = Variant::construct(expected, NULL, 0, ce, false);
|
||||||
}
|
}
|
||||||
@@ -198,7 +198,7 @@ void VisualScript::remove_function(const StringName &p_name) {
|
|||||||
|
|
||||||
for (Map<int, Function::NodeData>::Element *E = functions[p_name].nodes.front(); E; E = E->next()) {
|
for (Map<int, Function::NodeData>::Element *E = functions[p_name].nodes.front(); E; E = E->next()) {
|
||||||
|
|
||||||
E->get().node->disconnect("ports_changed", this, "_node_ports_changed");
|
E->get().node->disconnect_compat("ports_changed", this, "_node_ports_changed");
|
||||||
E->get().node->scripts_used.erase(this);
|
E->get().node->scripts_used.erase(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -340,7 +340,7 @@ void VisualScript::add_node(const StringName &p_func, int p_id, const Ref<Visual
|
|||||||
nd.pos = p_pos;
|
nd.pos = p_pos;
|
||||||
|
|
||||||
Ref<VisualScriptNode> vsn = p_node;
|
Ref<VisualScriptNode> vsn = p_node;
|
||||||
vsn->connect("ports_changed", this, "_node_ports_changed", varray(p_id));
|
vsn->connect_compat("ports_changed", this, "_node_ports_changed", varray(p_id));
|
||||||
vsn->scripts_used.insert(this);
|
vsn->scripts_used.insert(this);
|
||||||
vsn->validate_input_default_values(); // Validate when fully loaded
|
vsn->validate_input_default_values(); // Validate when fully loaded
|
||||||
|
|
||||||
@@ -389,7 +389,7 @@ void VisualScript::remove_node(const StringName &p_func, int p_id) {
|
|||||||
func.function_id = -1; //revert to invalid
|
func.function_id = -1; //revert to invalid
|
||||||
}
|
}
|
||||||
|
|
||||||
func.nodes[p_id].node->disconnect("ports_changed", this, "_node_ports_changed");
|
func.nodes[p_id].node->disconnect_compat("ports_changed", this, "_node_ports_changed");
|
||||||
func.nodes[p_id].node->scripts_used.erase(this);
|
func.nodes[p_id].node->scripts_used.erase(this);
|
||||||
|
|
||||||
func.nodes.erase(p_id);
|
func.nodes.erase(p_id);
|
||||||
@@ -1560,7 +1560,7 @@ bool VisualScriptInstance::has_method(const StringName &p_method) const {
|
|||||||
//#define VSDEBUG(m_text) print_line(m_text)
|
//#define VSDEBUG(m_text) print_line(m_text)
|
||||||
#define VSDEBUG(m_text)
|
#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, Variant::CallError &r_error, String &error_str, VisualScriptNodeInstance **r_error_node) {
|
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);
|
ERR_FAIL_COND(node->pass_idx == -1);
|
||||||
|
|
||||||
@@ -1577,7 +1577,7 @@ void VisualScriptInstance::_dependency_step(VisualScriptNodeInstance *node, int
|
|||||||
for (int i = 0; i < dc; i++) {
|
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);
|
_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 != Variant::CallError::CALL_OK)
|
if (r_error.error != Callable::CallError::CALL_OK)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1602,12 +1602,12 @@ void VisualScriptInstance::_dependency_step(VisualScriptNodeInstance *node, int
|
|||||||
|
|
||||||
node->step(input_args, output_args, VisualScriptNodeInstance::START_MODE_BEGIN_SEQUENCE, working_mem, r_error, error_str);
|
node->step(input_args, output_args, VisualScriptNodeInstance::START_MODE_BEGIN_SEQUENCE, working_mem, r_error, error_str);
|
||||||
//ignore return
|
//ignore return
|
||||||
if (r_error.error != Variant::CallError::CALL_OK) {
|
if (r_error.error != Callable::CallError::CALL_OK) {
|
||||||
*r_error_node = node;
|
*r_error_node = node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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, Variant::CallError &r_error) {
|
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);
|
Map<StringName, Function>::Element *F = functions.find(p_method);
|
||||||
ERR_FAIL_COND_V(!F, Variant());
|
ERR_FAIL_COND_V(!F, Variant());
|
||||||
@@ -1669,7 +1669,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
|
|||||||
for (int i = 0; i < dc; i++) {
|
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);
|
_dependency_step(deps[i], p_pass, pass_stack, input_args, output_args, variant_stack, r_error, error_str, &node);
|
||||||
if (r_error.error != Variant::CallError::CALL_OK) {
|
if (r_error.error != Callable::CallError::CALL_OK) {
|
||||||
error = true;
|
error = true;
|
||||||
current_node_id = node->id;
|
current_node_id = node->id;
|
||||||
break;
|
break;
|
||||||
@@ -1729,7 +1729,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
|
|||||||
|
|
||||||
int ret = node->step(input_args, output_args, start_mode, working_mem, r_error, error_str);
|
int ret = node->step(input_args, output_args, start_mode, working_mem, r_error, error_str);
|
||||||
|
|
||||||
if (r_error.error != Variant::CallError::CALL_OK) {
|
if (r_error.error != Callable::CallError::CALL_OK) {
|
||||||
//use error from step
|
//use error from step
|
||||||
error = true;
|
error = true;
|
||||||
break;
|
break;
|
||||||
@@ -1738,7 +1738,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
|
|||||||
if (ret & VisualScriptNodeInstance::STEP_YIELD_BIT) {
|
if (ret & VisualScriptNodeInstance::STEP_YIELD_BIT) {
|
||||||
//yielded!
|
//yielded!
|
||||||
if (node->get_working_memory_size() == 0) {
|
if (node->get_working_memory_size() == 0) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
error_str = RTR("A node yielded without working memory, please read the docs on how to yield properly!");
|
error_str = RTR("A node yielded without working memory, please read the docs on how to yield properly!");
|
||||||
error = true;
|
error = true;
|
||||||
break;
|
break;
|
||||||
@@ -1747,7 +1747,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
|
|||||||
Ref<VisualScriptFunctionState> state = *working_mem;
|
Ref<VisualScriptFunctionState> state = *working_mem;
|
||||||
if (!state.is_valid()) {
|
if (!state.is_valid()) {
|
||||||
|
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
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_str = RTR("Node yielded, but did not return a function state in the first working memory.");
|
||||||
error = true;
|
error = true;
|
||||||
break;
|
break;
|
||||||
@@ -1766,7 +1766,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
|
|||||||
state->pass = p_pass;
|
state->pass = p_pass;
|
||||||
copymem(state->stack.ptrw(), p_stack, p_stack_size);
|
copymem(state->stack.ptrw(), p_stack, p_stack_size);
|
||||||
//step 2, run away, return directly
|
//step 2, run away, return directly
|
||||||
r_error.error = Variant::CallError::CALL_OK;
|
r_error.error = Callable::CallError::CALL_OK;
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
//will re-enter later, so exiting
|
//will re-enter later, so exiting
|
||||||
@@ -1809,7 +1809,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
|
|||||||
if (ret & VisualScriptNodeInstance::STEP_EXIT_FUNCTION_BIT) {
|
if (ret & VisualScriptNodeInstance::STEP_EXIT_FUNCTION_BIT) {
|
||||||
if (node->get_working_memory_size() == 0) {
|
if (node->get_working_memory_size() == 0) {
|
||||||
|
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
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_str = RTR("Return value must be assigned to first element of node working memory! Fix your node please.");
|
||||||
error = true;
|
error = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -1826,7 +1826,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
|
|||||||
if ((ret == output || ret & VisualScriptNodeInstance::STEP_FLAG_PUSH_STACK_BIT) && node->sequence_output_count) {
|
if ((ret == output || ret & VisualScriptNodeInstance::STEP_FLAG_PUSH_STACK_BIT) && node->sequence_output_count) {
|
||||||
//if no exit bit was set, and has sequence outputs, guess next node
|
//if no exit bit was set, and has sequence outputs, guess next node
|
||||||
if (output >= node->sequence_output_count) {
|
if (output >= node->sequence_output_count) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
error_str = RTR("Node returned an invalid sequence output: ") + itos(output);
|
error_str = RTR("Node returned an invalid sequence output: ") + itos(output);
|
||||||
error = true;
|
error = true;
|
||||||
break;
|
break;
|
||||||
@@ -1888,7 +1888,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
error_str = RTR("Found sequence bit but not the node in the stack, report bug!");
|
error_str = RTR("Found sequence bit but not the node in the stack, report bug!");
|
||||||
error = true;
|
error = true;
|
||||||
break;
|
break;
|
||||||
@@ -1900,7 +1900,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
|
|||||||
} else {
|
} else {
|
||||||
// check for stack overflow
|
// check for stack overflow
|
||||||
if (flow_stack_pos + 1 >= flow_max) {
|
if (flow_stack_pos + 1 >= flow_max) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
error_str = RTR("Stack overflow with stack depth: ") + itos(output);
|
error_str = RTR("Stack overflow with stack depth: ") + itos(output);
|
||||||
error = true;
|
error = true;
|
||||||
break;
|
break;
|
||||||
@@ -1952,22 +1952,22 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
|
|||||||
String err_func = p_method;
|
String err_func = p_method;
|
||||||
int err_line = current_node_id; //not a line but it works as one
|
int err_line = current_node_id; //not a line but it works as one
|
||||||
|
|
||||||
if (node && (r_error.error != Variant::CallError::CALL_ERROR_INVALID_METHOD || error_str == String())) {
|
if (node && (r_error.error != Callable::CallError::CALL_ERROR_INVALID_METHOD || error_str == String())) {
|
||||||
|
|
||||||
if (error_str != String()) {
|
if (error_str != String()) {
|
||||||
error_str += " ";
|
error_str += " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r_error.error == Variant::CallError::CALL_ERROR_INVALID_ARGUMENT) {
|
if (r_error.error == Callable::CallError::CALL_ERROR_INVALID_ARGUMENT) {
|
||||||
int errorarg = r_error.argument;
|
int errorarg = r_error.argument;
|
||||||
error_str += "Cannot convert argument " + itos(errorarg + 1) + " to " + Variant::get_type_name(r_error.expected) + ".";
|
error_str += "Cannot convert argument " + itos(errorarg + 1) + " to " + Variant::get_type_name(Variant::Type(r_error.expected)) + ".";
|
||||||
} else if (r_error.error == Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS) {
|
} else if (r_error.error == Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS) {
|
||||||
error_str += "Expected " + itos(r_error.argument) + " arguments.";
|
error_str += "Expected " + itos(r_error.argument) + " arguments.";
|
||||||
} else if (r_error.error == Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS) {
|
} else if (r_error.error == Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS) {
|
||||||
error_str += "Expected " + itos(r_error.argument) + " arguments.";
|
error_str += "Expected " + itos(r_error.argument) + " arguments.";
|
||||||
} else if (r_error.error == Variant::CallError::CALL_ERROR_INVALID_METHOD) {
|
} else if (r_error.error == Callable::CallError::CALL_ERROR_INVALID_METHOD) {
|
||||||
error_str += "Invalid Call.";
|
error_str += "Invalid Call.";
|
||||||
} else if (r_error.error == Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL) {
|
} else if (r_error.error == Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL) {
|
||||||
error_str += "Base Instance is null";
|
error_str += "Base Instance is null";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2000,13 +2000,13 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
Variant VisualScriptInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
|
Variant VisualScriptInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
|
||||||
|
|
||||||
r_error.error = Variant::CallError::CALL_OK; //ok by default
|
r_error.error = Callable::CallError::CALL_OK; //ok by default
|
||||||
|
|
||||||
Map<StringName, Function>::Element *F = functions.find(p_method);
|
Map<StringName, Function>::Element *F = functions.find(p_method);
|
||||||
if (!F) {
|
if (!F) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
return Variant();
|
return Variant();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2048,7 +2048,7 @@ Variant VisualScriptInstance::call(const StringName &p_method, const Variant **p
|
|||||||
|
|
||||||
Map<int, VisualScriptNodeInstance *>::Element *E = instances.find(f->node);
|
Map<int, VisualScriptNodeInstance *>::Element *E = instances.find(f->node);
|
||||||
if (!E) {
|
if (!E) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
|
|
||||||
ERR_FAIL_V_MSG(Variant(), "No VisualScriptFunction node in function.");
|
ERR_FAIL_V_MSG(Variant(), "No VisualScriptFunction node in function.");
|
||||||
}
|
}
|
||||||
@@ -2062,14 +2062,14 @@ Variant VisualScriptInstance::call(const StringName &p_method, const Variant **p
|
|||||||
VSDEBUG("ARGUMENTS: " + itos(f->argument_count) = " RECEIVED: " + itos(p_argcount));
|
VSDEBUG("ARGUMENTS: " + itos(f->argument_count) = " RECEIVED: " + itos(p_argcount));
|
||||||
|
|
||||||
if (p_argcount < f->argument_count) {
|
if (p_argcount < f->argument_count) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = node->get_input_port_count();
|
r_error.argument = node->get_input_port_count();
|
||||||
|
|
||||||
return Variant();
|
return Variant();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_argcount > f->argument_count) {
|
if (p_argcount > f->argument_count) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = node->get_input_port_count();
|
r_error.argument = node->get_input_port_count();
|
||||||
|
|
||||||
return Variant();
|
return Variant();
|
||||||
@@ -2094,15 +2094,15 @@ void VisualScriptInstance::notification(int p_notification) {
|
|||||||
|
|
||||||
Variant what = p_notification;
|
Variant what = p_notification;
|
||||||
const Variant *whatp = &what;
|
const Variant *whatp = &what;
|
||||||
Variant::CallError ce;
|
Callable::CallError ce;
|
||||||
call(VisualScriptLanguage::singleton->notification, &whatp, 1, ce); //do as call
|
call(VisualScriptLanguage::singleton->notification, &whatp, 1, ce); //do as call
|
||||||
}
|
}
|
||||||
|
|
||||||
String VisualScriptInstance::to_string(bool *r_valid) {
|
String VisualScriptInstance::to_string(bool *r_valid) {
|
||||||
if (has_method(CoreStringNames::get_singleton()->_to_string)) {
|
if (has_method(CoreStringNames::get_singleton()->_to_string)) {
|
||||||
Variant::CallError ce;
|
Callable::CallError ce;
|
||||||
Variant ret = call(CoreStringNames::get_singleton()->_to_string, NULL, 0, ce);
|
Variant ret = call(CoreStringNames::get_singleton()->_to_string, NULL, 0, ce);
|
||||||
if (ce.error == Variant::CallError::CALL_OK) {
|
if (ce.error == Callable::CallError::CALL_OK) {
|
||||||
if (ret.get_type() != Variant::STRING) {
|
if (ret.get_type() != Variant::STRING) {
|
||||||
if (r_valid)
|
if (r_valid)
|
||||||
*r_valid = false;
|
*r_valid = false;
|
||||||
@@ -2408,7 +2408,7 @@ VisualScriptInstance::~VisualScriptInstance() {
|
|||||||
|
|
||||||
/////////////////////
|
/////////////////////
|
||||||
|
|
||||||
Variant VisualScriptFunctionState::_signal_callback(const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
|
Variant VisualScriptFunctionState::_signal_callback(const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(function == StringName(), Variant());
|
ERR_FAIL_COND_V(function == StringName(), Variant());
|
||||||
|
|
||||||
@@ -2419,12 +2419,12 @@ Variant VisualScriptFunctionState::_signal_callback(const Variant **p_args, int
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
r_error.error = Variant::CallError::CALL_OK;
|
r_error.error = Callable::CallError::CALL_OK;
|
||||||
|
|
||||||
Array args;
|
Array args;
|
||||||
|
|
||||||
if (p_argcount == 0) {
|
if (p_argcount == 0) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = 1;
|
r_error.argument = 1;
|
||||||
return Variant();
|
return Variant();
|
||||||
} else if (p_argcount == 1) {
|
} else if (p_argcount == 1) {
|
||||||
@@ -2439,13 +2439,13 @@ Variant VisualScriptFunctionState::_signal_callback(const Variant **p_args, int
|
|||||||
Ref<VisualScriptFunctionState> self = *p_args[p_argcount - 1]; //hi, I'm myself, needed this to remain alive.
|
Ref<VisualScriptFunctionState> self = *p_args[p_argcount - 1]; //hi, I'm myself, needed this to remain alive.
|
||||||
|
|
||||||
if (self.is_null()) {
|
if (self.is_null()) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||||
r_error.argument = p_argcount - 1;
|
r_error.argument = p_argcount - 1;
|
||||||
r_error.expected = Variant::OBJECT;
|
r_error.expected = Variant::OBJECT;
|
||||||
return Variant();
|
return Variant();
|
||||||
}
|
}
|
||||||
|
|
||||||
r_error.error = Variant::CallError::CALL_OK;
|
r_error.error = Callable::CallError::CALL_OK;
|
||||||
|
|
||||||
Variant *working_mem = ((Variant *)stack.ptr()) + working_mem_index;
|
Variant *working_mem = ((Variant *)stack.ptr()) + working_mem_index;
|
||||||
|
|
||||||
@@ -2463,7 +2463,7 @@ void VisualScriptFunctionState::connect_to_signal(Object *p_obj, const String &p
|
|||||||
binds.push_back(p_binds[i]);
|
binds.push_back(p_binds[i]);
|
||||||
}
|
}
|
||||||
binds.push_back(Ref<VisualScriptFunctionState>(this)); //add myself on the back to avoid dying from unreferencing
|
binds.push_back(Ref<VisualScriptFunctionState>(this)); //add myself on the back to avoid dying from unreferencing
|
||||||
p_obj->connect(p_signal, this, "_signal_callback", binds, CONNECT_ONESHOT);
|
p_obj->connect_compat(p_signal, this, "_signal_callback", binds, CONNECT_ONESHOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VisualScriptFunctionState::is_valid() const {
|
bool VisualScriptFunctionState::is_valid() const {
|
||||||
@@ -2481,8 +2481,8 @@ Variant VisualScriptFunctionState::resume(Array p_args) {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Variant::CallError r_error;
|
Callable::CallError r_error;
|
||||||
r_error.error = Variant::CallError::CALL_OK;
|
r_error.error = Callable::CallError::CALL_OK;
|
||||||
|
|
||||||
Variant *working_mem = ((Variant *)stack.ptr()) + working_mem_index;
|
Variant *working_mem = ((Variant *)stack.ptr()) + working_mem_index;
|
||||||
|
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ public:
|
|||||||
|
|
||||||
virtual int get_working_memory_size() const { return 0; }
|
virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) = 0; //do a step, return which sequence port to go out
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) = 0; //do a step, return which sequence port to go out
|
||||||
|
|
||||||
Ref<VisualScriptNode> get_base_node() { return Ref<VisualScriptNode>(base); }
|
Ref<VisualScriptNode> get_base_node() { return Ref<VisualScriptNode>(base); }
|
||||||
|
|
||||||
@@ -408,8 +408,8 @@ class VisualScriptInstance : public ScriptInstance {
|
|||||||
|
|
||||||
StringName source;
|
StringName source;
|
||||||
|
|
||||||
void _dependency_step(VisualScriptNodeInstance *node, int p_pass, int *pass_stack, const Variant **input_args, Variant **output_args, Variant *variant_stack, Variant::CallError &r_error, String &error_str, VisualScriptNodeInstance **r_error_node);
|
void _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);
|
||||||
Variant _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, Variant::CallError &r_error);
|
Variant _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> functions;
|
//Map<StringName,Function> functions;
|
||||||
friend class VisualScriptFunctionState; //for yield
|
friend class VisualScriptFunctionState; //for yield
|
||||||
@@ -422,7 +422,7 @@ public:
|
|||||||
|
|
||||||
virtual void get_method_list(List<MethodInfo> *p_list) const;
|
virtual void get_method_list(List<MethodInfo> *p_list) const;
|
||||||
virtual bool has_method(const StringName &p_method) const;
|
virtual bool has_method(const StringName &p_method) const;
|
||||||
virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error);
|
virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error);
|
||||||
virtual void notification(int p_notification);
|
virtual void notification(int p_notification);
|
||||||
String to_string(bool *r_valid);
|
String to_string(bool *r_valid);
|
||||||
|
|
||||||
@@ -487,7 +487,7 @@ class VisualScriptFunctionState : public Reference {
|
|||||||
int flow_stack_pos;
|
int flow_stack_pos;
|
||||||
int pass;
|
int pass;
|
||||||
|
|
||||||
Variant _signal_callback(const Variant **p_args, int p_argcount, Variant::CallError &r_error);
|
Variant _signal_callback(const Variant **p_args, int p_argcount, Callable::CallError &r_error);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|||||||
@@ -675,15 +675,15 @@ VisualScriptBuiltinFunc::BuiltinFunc VisualScriptBuiltinFunc::get_func() {
|
|||||||
return func;
|
return func;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define VALIDATE_ARG_NUM(m_arg) \
|
#define VALIDATE_ARG_NUM(m_arg) \
|
||||||
if (!p_inputs[m_arg]->is_num()) { \
|
if (!p_inputs[m_arg]->is_num()) { \
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; \
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; \
|
||||||
r_error.argument = m_arg; \
|
r_error.argument = m_arg; \
|
||||||
r_error.expected = Variant::REAL; \
|
r_error.expected = Variant::REAL; \
|
||||||
return; \
|
return; \
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant *r_return, Variant::CallError &r_error, String &r_error_str) {
|
void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant *r_return, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
switch (p_func) {
|
switch (p_func) {
|
||||||
case VisualScriptBuiltinFunc::MATH_SIN: {
|
case VisualScriptBuiltinFunc::MATH_SIN: {
|
||||||
@@ -787,7 +787,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
|
|||||||
*r_return = Math::abs(r);
|
*r_return = Math::abs(r);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||||
r_error.argument = 0;
|
r_error.argument = 0;
|
||||||
r_error.expected = Variant::REAL;
|
r_error.expected = Variant::REAL;
|
||||||
}
|
}
|
||||||
@@ -804,7 +804,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
|
|||||||
*r_return = r < 0.0 ? -1.0 : (r > 0.0 ? +1.0 : 0.0);
|
*r_return = r < 0.0 ? -1.0 : (r > 0.0 ? +1.0 : 0.0);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||||
r_error.argument = 0;
|
r_error.argument = 0;
|
||||||
r_error.expected = Variant::REAL;
|
r_error.expected = Variant::REAL;
|
||||||
}
|
}
|
||||||
@@ -1047,7 +1047,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
|
|||||||
|
|
||||||
if (p_inputs[0]->get_type() != Variant::OBJECT) {
|
if (p_inputs[0]->get_type() != Variant::OBJECT) {
|
||||||
|
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||||
r_error.argument = 0;
|
r_error.argument = 0;
|
||||||
r_error.expected = Variant::OBJECT;
|
r_error.expected = Variant::OBJECT;
|
||||||
|
|
||||||
@@ -1081,7 +1081,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
|
|||||||
|
|
||||||
if (p_inputs[0]->get_type() != Variant::OBJECT) {
|
if (p_inputs[0]->get_type() != Variant::OBJECT) {
|
||||||
|
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||||
r_error.argument = 0;
|
r_error.argument = 0;
|
||||||
r_error.expected = Variant::OBJECT;
|
r_error.expected = Variant::OBJECT;
|
||||||
|
|
||||||
@@ -1089,7 +1089,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
|
|||||||
}
|
}
|
||||||
if (p_inputs[1]->get_type() != Variant::STRING && p_inputs[1]->get_type() != Variant::NODE_PATH) {
|
if (p_inputs[1]->get_type() != Variant::STRING && p_inputs[1]->get_type() != Variant::NODE_PATH) {
|
||||||
|
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||||
r_error.argument = 1;
|
r_error.argument = 1;
|
||||||
r_error.expected = Variant::STRING;
|
r_error.expected = Variant::STRING;
|
||||||
|
|
||||||
@@ -1111,7 +1111,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
|
|||||||
if (type < 0 || type >= Variant::VARIANT_MAX) {
|
if (type < 0 || type >= Variant::VARIANT_MAX) {
|
||||||
|
|
||||||
r_error_str = RTR("Invalid type argument to convert(), use TYPE_* constants.");
|
r_error_str = RTR("Invalid type argument to convert(), use TYPE_* constants.");
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||||
r_error.argument = 0;
|
r_error.argument = 0;
|
||||||
r_error.expected = Variant::INT;
|
r_error.expected = Variant::INT;
|
||||||
return;
|
return;
|
||||||
@@ -1141,7 +1141,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
|
|||||||
case VisualScriptBuiltinFunc::TEXT_ORD: {
|
case VisualScriptBuiltinFunc::TEXT_ORD: {
|
||||||
|
|
||||||
if (p_inputs[0]->get_type() != Variant::STRING) {
|
if (p_inputs[0]->get_type() != Variant::STRING) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||||
r_error.argument = 0;
|
r_error.argument = 0;
|
||||||
r_error.expected = Variant::STRING;
|
r_error.expected = Variant::STRING;
|
||||||
|
|
||||||
@@ -1151,7 +1151,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
|
|||||||
String str = p_inputs[0]->operator String();
|
String str = p_inputs[0]->operator String();
|
||||||
|
|
||||||
if (str.length() != 1) {
|
if (str.length() != 1) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||||
r_error.argument = 0;
|
r_error.argument = 0;
|
||||||
r_error.expected = Variant::STRING;
|
r_error.expected = Variant::STRING;
|
||||||
*r_return = "Expected a string of length 1 (a character).";
|
*r_return = "Expected a string of length 1 (a character).";
|
||||||
@@ -1197,7 +1197,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
|
|||||||
case VisualScriptBuiltinFunc::STR_TO_VAR: {
|
case VisualScriptBuiltinFunc::STR_TO_VAR: {
|
||||||
|
|
||||||
if (p_inputs[0]->get_type() != Variant::STRING) {
|
if (p_inputs[0]->get_type() != Variant::STRING) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||||
r_error.argument = 0;
|
r_error.argument = 0;
|
||||||
r_error.expected = Variant::STRING;
|
r_error.expected = Variant::STRING;
|
||||||
|
|
||||||
@@ -1212,7 +1212,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
|
|||||||
Error err = VariantParser::parse(&ss, *r_return, errs, line);
|
Error err = VariantParser::parse(&ss, *r_return, errs, line);
|
||||||
|
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||||
r_error.argument = 0;
|
r_error.argument = 0;
|
||||||
r_error.expected = Variant::STRING;
|
r_error.expected = Variant::STRING;
|
||||||
*r_return = "Parse error at line " + itos(line) + ": " + errs;
|
*r_return = "Parse error at line " + itos(line) + ": " + errs;
|
||||||
@@ -1223,7 +1223,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
|
|||||||
case VisualScriptBuiltinFunc::VAR_TO_BYTES: {
|
case VisualScriptBuiltinFunc::VAR_TO_BYTES: {
|
||||||
|
|
||||||
if (p_inputs[1]->get_type() != Variant::BOOL) {
|
if (p_inputs[1]->get_type() != Variant::BOOL) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||||
r_error.argument = 1;
|
r_error.argument = 1;
|
||||||
r_error.expected = Variant::BOOL;
|
r_error.expected = Variant::BOOL;
|
||||||
return;
|
return;
|
||||||
@@ -1233,7 +1233,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
|
|||||||
bool full_objects = *p_inputs[1];
|
bool full_objects = *p_inputs[1];
|
||||||
Error err = encode_variant(*p_inputs[0], NULL, len, full_objects);
|
Error err = encode_variant(*p_inputs[0], NULL, len, full_objects);
|
||||||
if (err) {
|
if (err) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||||
r_error.argument = 0;
|
r_error.argument = 0;
|
||||||
r_error.expected = Variant::NIL;
|
r_error.expected = Variant::NIL;
|
||||||
r_error_str = "Unexpected error encoding variable to bytes, likely unserializable type found (Object or RID).";
|
r_error_str = "Unexpected error encoding variable to bytes, likely unserializable type found (Object or RID).";
|
||||||
@@ -1250,13 +1250,13 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
|
|||||||
case VisualScriptBuiltinFunc::BYTES_TO_VAR: {
|
case VisualScriptBuiltinFunc::BYTES_TO_VAR: {
|
||||||
|
|
||||||
if (p_inputs[0]->get_type() != Variant::PACKED_BYTE_ARRAY) {
|
if (p_inputs[0]->get_type() != Variant::PACKED_BYTE_ARRAY) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||||
r_error.argument = 0;
|
r_error.argument = 0;
|
||||||
r_error.expected = Variant::PACKED_BYTE_ARRAY;
|
r_error.expected = Variant::PACKED_BYTE_ARRAY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (p_inputs[1]->get_type() != Variant::BOOL) {
|
if (p_inputs[1]->get_type() != Variant::BOOL) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||||
r_error.argument = 1;
|
r_error.argument = 1;
|
||||||
r_error.expected = Variant::BOOL;
|
r_error.expected = Variant::BOOL;
|
||||||
return;
|
return;
|
||||||
@@ -1270,7 +1270,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
|
|||||||
Error err = decode_variant(ret, r, varr.size(), NULL, allow_objects);
|
Error err = decode_variant(ret, r, varr.size(), NULL, allow_objects);
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
r_error_str = RTR("Not enough bytes for decoding bytes, or invalid format.");
|
r_error_str = RTR("Not enough bytes for decoding bytes, or invalid format.");
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||||
r_error.argument = 0;
|
r_error.argument = 0;
|
||||||
r_error.expected = Variant::PACKED_BYTE_ARRAY;
|
r_error.expected = Variant::PACKED_BYTE_ARRAY;
|
||||||
return;
|
return;
|
||||||
@@ -1306,7 +1306,7 @@ public:
|
|||||||
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||||
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
VisualScriptBuiltinFunc::exec_func(func, p_inputs, p_outputs[0], r_error, r_error_str);
|
VisualScriptBuiltinFunc::exec_func(func, p_inputs, p_outputs[0], r_error, r_error_str);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ public:
|
|||||||
|
|
||||||
static int get_func_argument_count(BuiltinFunc p_func);
|
static int get_func_argument_count(BuiltinFunc p_func);
|
||||||
static String get_func_name(BuiltinFunc p_func);
|
static String get_func_name(BuiltinFunc p_func);
|
||||||
static void exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant *r_return, Variant::CallError &r_error, String &r_error_str);
|
static void exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant *r_return, Callable::CallError &r_error, String &r_error_str);
|
||||||
static BuiltinFunc find_function(const String &p_string);
|
static BuiltinFunc find_function(const String &p_string);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -556,8 +556,8 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
|
|||||||
|
|
||||||
gnode->set_meta("__vnode", node);
|
gnode->set_meta("__vnode", node);
|
||||||
gnode->set_name(itos(E->get()));
|
gnode->set_name(itos(E->get()));
|
||||||
gnode->connect("dragged", this, "_node_moved", varray(E->get()));
|
gnode->connect_compat("dragged", this, "_node_moved", varray(E->get()));
|
||||||
gnode->connect("close_request", this, "_remove_node", varray(E->get()), CONNECT_DEFERRED);
|
gnode->connect_compat("close_request", this, "_remove_node", varray(E->get()), CONNECT_DEFERRED);
|
||||||
|
|
||||||
if (E->get() != script->get_function_node_id(F->get())) {
|
if (E->get() != script->get_function_node_id(F->get())) {
|
||||||
//function can't be erased
|
//function can't be erased
|
||||||
@@ -575,7 +575,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
|
|||||||
Button *btn = memnew(Button);
|
Button *btn = memnew(Button);
|
||||||
btn->set_text(TTR("Add Input Port"));
|
btn->set_text(TTR("Add Input Port"));
|
||||||
hbnc->add_child(btn);
|
hbnc->add_child(btn);
|
||||||
btn->connect("pressed", this, "_add_input_port", varray(E->get()), CONNECT_DEFERRED);
|
btn->connect_compat("pressed", this, "_add_input_port", varray(E->get()), CONNECT_DEFERRED);
|
||||||
}
|
}
|
||||||
if (nd_list->is_output_port_editable()) {
|
if (nd_list->is_output_port_editable()) {
|
||||||
if (nd_list->is_input_port_editable())
|
if (nd_list->is_input_port_editable())
|
||||||
@@ -584,7 +584,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
|
|||||||
Button *btn = memnew(Button);
|
Button *btn = memnew(Button);
|
||||||
btn->set_text(TTR("Add Output Port"));
|
btn->set_text(TTR("Add Output Port"));
|
||||||
hbnc->add_child(btn);
|
hbnc->add_child(btn);
|
||||||
btn->connect("pressed", this, "_add_output_port", varray(E->get()), CONNECT_DEFERRED);
|
btn->connect_compat("pressed", this, "_add_output_port", varray(E->get()), CONNECT_DEFERRED);
|
||||||
}
|
}
|
||||||
gnode->add_child(hbnc);
|
gnode->add_child(hbnc);
|
||||||
} else if (Object::cast_to<VisualScriptExpression>(node.ptr())) {
|
} else if (Object::cast_to<VisualScriptExpression>(node.ptr())) {
|
||||||
@@ -594,7 +594,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
|
|||||||
line_edit->set_expand_to_text_length(true);
|
line_edit->set_expand_to_text_length(true);
|
||||||
line_edit->add_font_override("font", get_font("source", "EditorFonts"));
|
line_edit->add_font_override("font", get_font("source", "EditorFonts"));
|
||||||
gnode->add_child(line_edit);
|
gnode->add_child(line_edit);
|
||||||
line_edit->connect("text_changed", this, "_expression_text_changed", varray(E->get()));
|
line_edit->connect_compat("text_changed", this, "_expression_text_changed", varray(E->get()));
|
||||||
} else {
|
} else {
|
||||||
String text = node->get_text();
|
String text = node->get_text();
|
||||||
if (!text.empty()) {
|
if (!text.empty()) {
|
||||||
@@ -610,7 +610,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
|
|||||||
gnode->set_comment(true);
|
gnode->set_comment(true);
|
||||||
gnode->set_resizable(true);
|
gnode->set_resizable(true);
|
||||||
gnode->set_custom_minimum_size(vsc->get_size() * EDSCALE);
|
gnode->set_custom_minimum_size(vsc->get_size() * EDSCALE);
|
||||||
gnode->connect("resize_request", this, "_comment_node_resized", varray(E->get()));
|
gnode->connect_compat("resize_request", this, "_comment_node_resized", varray(E->get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node_styles.has(node->get_category())) {
|
if (node_styles.has(node->get_category())) {
|
||||||
@@ -720,8 +720,8 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
|
|||||||
name_box->set_custom_minimum_size(Size2(60 * EDSCALE, 0));
|
name_box->set_custom_minimum_size(Size2(60 * EDSCALE, 0));
|
||||||
name_box->set_text(left_name);
|
name_box->set_text(left_name);
|
||||||
name_box->set_expand_to_text_length(true);
|
name_box->set_expand_to_text_length(true);
|
||||||
name_box->connect("resized", this, "_update_node_size", varray(E->get()));
|
name_box->connect_compat("resized", this, "_update_node_size", varray(E->get()));
|
||||||
name_box->connect("focus_exited", this, "_port_name_focus_out", varray(name_box, E->get(), i, true));
|
name_box->connect_compat("focus_exited", this, "_port_name_focus_out", varray(name_box, E->get(), i, true));
|
||||||
} else {
|
} else {
|
||||||
hbc->add_child(memnew(Label(left_name)));
|
hbc->add_child(memnew(Label(left_name)));
|
||||||
}
|
}
|
||||||
@@ -734,13 +734,13 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
|
|||||||
opbtn->select(left_type);
|
opbtn->select(left_type);
|
||||||
opbtn->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
|
opbtn->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
|
||||||
hbc->add_child(opbtn);
|
hbc->add_child(opbtn);
|
||||||
opbtn->connect("item_selected", this, "_change_port_type", varray(E->get(), i, true), CONNECT_DEFERRED);
|
opbtn->connect_compat("item_selected", this, "_change_port_type", varray(E->get(), i, true), CONNECT_DEFERRED);
|
||||||
}
|
}
|
||||||
|
|
||||||
Button *rmbtn = memnew(Button);
|
Button *rmbtn = memnew(Button);
|
||||||
rmbtn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons"));
|
rmbtn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons"));
|
||||||
hbc->add_child(rmbtn);
|
hbc->add_child(rmbtn);
|
||||||
rmbtn->connect("pressed", this, "_remove_input_port", varray(E->get(), i), CONNECT_DEFERRED);
|
rmbtn->connect_compat("pressed", this, "_remove_input_port", varray(E->get(), i), CONNECT_DEFERRED);
|
||||||
} else {
|
} else {
|
||||||
hbc->add_child(memnew(Label(left_name)));
|
hbc->add_child(memnew(Label(left_name)));
|
||||||
}
|
}
|
||||||
@@ -753,14 +753,14 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
|
|||||||
if (value.get_type() != left_type) {
|
if (value.get_type() != left_type) {
|
||||||
//different type? for now convert
|
//different type? for now convert
|
||||||
//not the same, reconvert
|
//not the same, reconvert
|
||||||
Variant::CallError ce;
|
Callable::CallError ce;
|
||||||
const Variant *existingp = &value;
|
const Variant *existingp = &value;
|
||||||
value = Variant::construct(left_type, &existingp, 1, ce, false);
|
value = Variant::construct(left_type, &existingp, 1, ce, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (left_type == Variant::COLOR) {
|
if (left_type == Variant::COLOR) {
|
||||||
button->set_custom_minimum_size(Size2(30, 0) * EDSCALE);
|
button->set_custom_minimum_size(Size2(30, 0) * EDSCALE);
|
||||||
button->connect("draw", this, "_draw_color_over_button", varray(button, value));
|
button->connect_compat("draw", this, "_draw_color_over_button", varray(button, value));
|
||||||
} else if (left_type == Variant::OBJECT && Ref<Resource>(value).is_valid()) {
|
} else if (left_type == Variant::OBJECT && Ref<Resource>(value).is_valid()) {
|
||||||
|
|
||||||
Ref<Resource> res = value;
|
Ref<Resource> res = value;
|
||||||
@@ -776,7 +776,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
|
|||||||
|
|
||||||
button->set_text(value);
|
button->set_text(value);
|
||||||
}
|
}
|
||||||
button->connect("pressed", this, "_default_value_edited", varray(button, E->get(), i));
|
button->connect_compat("pressed", this, "_default_value_edited", varray(button, E->get(), i));
|
||||||
hbc2->add_child(button);
|
hbc2->add_child(button);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -802,7 +802,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
|
|||||||
Button *rmbtn = memnew(Button);
|
Button *rmbtn = memnew(Button);
|
||||||
rmbtn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons"));
|
rmbtn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons"));
|
||||||
hbc->add_child(rmbtn);
|
hbc->add_child(rmbtn);
|
||||||
rmbtn->connect("pressed", this, "_remove_output_port", varray(E->get(), i), CONNECT_DEFERRED);
|
rmbtn->connect_compat("pressed", this, "_remove_output_port", varray(E->get(), i), CONNECT_DEFERRED);
|
||||||
|
|
||||||
if (nd_list->is_output_port_type_editable()) {
|
if (nd_list->is_output_port_type_editable()) {
|
||||||
OptionButton *opbtn = memnew(OptionButton);
|
OptionButton *opbtn = memnew(OptionButton);
|
||||||
@@ -812,7 +812,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
|
|||||||
opbtn->select(right_type);
|
opbtn->select(right_type);
|
||||||
opbtn->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
|
opbtn->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
|
||||||
hbc->add_child(opbtn);
|
hbc->add_child(opbtn);
|
||||||
opbtn->connect("item_selected", this, "_change_port_type", varray(E->get(), i, false), CONNECT_DEFERRED);
|
opbtn->connect_compat("item_selected", this, "_change_port_type", varray(E->get(), i, false), CONNECT_DEFERRED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nd_list->is_output_port_name_editable()) {
|
if (nd_list->is_output_port_name_editable()) {
|
||||||
@@ -821,8 +821,8 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
|
|||||||
name_box->set_custom_minimum_size(Size2(60 * EDSCALE, 0));
|
name_box->set_custom_minimum_size(Size2(60 * EDSCALE, 0));
|
||||||
name_box->set_text(right_name);
|
name_box->set_text(right_name);
|
||||||
name_box->set_expand_to_text_length(true);
|
name_box->set_expand_to_text_length(true);
|
||||||
name_box->connect("resized", this, "_update_node_size", varray(E->get()));
|
name_box->connect_compat("resized", this, "_update_node_size", varray(E->get()));
|
||||||
name_box->connect("focus_exited", this, "_port_name_focus_out", varray(name_box, E->get(), i, false));
|
name_box->connect_compat("focus_exited", this, "_port_name_focus_out", varray(name_box, E->get(), i, false));
|
||||||
} else {
|
} else {
|
||||||
hbc->add_child(memnew(Label(right_name)));
|
hbc->add_child(memnew(Label(right_name)));
|
||||||
}
|
}
|
||||||
@@ -1225,7 +1225,7 @@ void VisualScriptEditor::_add_func_input() {
|
|||||||
LineEdit *name_box = memnew(LineEdit);
|
LineEdit *name_box = memnew(LineEdit);
|
||||||
name_box->set_h_size_flags(SIZE_EXPAND_FILL);
|
name_box->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||||
name_box->set_text("input");
|
name_box->set_text("input");
|
||||||
name_box->connect("focus_entered", this, "_deselect_input_names");
|
name_box->connect_compat("focus_entered", this, "_deselect_input_names");
|
||||||
hbox->add_child(name_box);
|
hbox->add_child(name_box);
|
||||||
|
|
||||||
Label *type_label = memnew(Label);
|
Label *type_label = memnew(Label);
|
||||||
@@ -1252,7 +1252,7 @@ void VisualScriptEditor::_add_func_input() {
|
|||||||
func_input_vbox->add_child(hbox);
|
func_input_vbox->add_child(hbox);
|
||||||
hbox->set_meta("id", hbox->get_position_in_parent());
|
hbox->set_meta("id", hbox->get_position_in_parent());
|
||||||
|
|
||||||
delete_button->connect("pressed", this, "_remove_func_input", varray(hbox));
|
delete_button->connect_compat("pressed", this, "_remove_func_input", varray(hbox));
|
||||||
|
|
||||||
name_box->select_all();
|
name_box->select_all();
|
||||||
name_box->grab_focus();
|
name_box->grab_focus();
|
||||||
@@ -2408,7 +2408,7 @@ void VisualScriptEditor::set_edited_resource(const RES &p_res) {
|
|||||||
variable_editor->script = script;
|
variable_editor->script = script;
|
||||||
variable_editor->undo_redo = undo_redo;
|
variable_editor->undo_redo = undo_redo;
|
||||||
|
|
||||||
script->connect("node_ports_changed", this, "_node_ports_changed");
|
script->connect_compat("node_ports_changed", this, "_node_ports_changed");
|
||||||
|
|
||||||
default_func = script->get_default_func();
|
default_func = script->get_default_func();
|
||||||
|
|
||||||
@@ -3851,7 +3851,7 @@ void VisualScriptEditor::_default_value_edited(Node *p_button, int p_id, int p_i
|
|||||||
Variant existing = vsn->get_default_input_value(p_input_port);
|
Variant existing = vsn->get_default_input_value(p_input_port);
|
||||||
if (pinfo.type != Variant::NIL && existing.get_type() != pinfo.type) {
|
if (pinfo.type != Variant::NIL && existing.get_type() != pinfo.type) {
|
||||||
|
|
||||||
Variant::CallError ce;
|
Callable::CallError ce;
|
||||||
const Variant *existingp = &existing;
|
const Variant *existingp = &existing;
|
||||||
existing = Variant::construct(pinfo.type, &existingp, 1, ce, false);
|
existing = Variant::construct(pinfo.type, &existingp, 1, ce, false);
|
||||||
}
|
}
|
||||||
@@ -3904,8 +3904,8 @@ void VisualScriptEditor::_notification(int p_what) {
|
|||||||
|
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_READY: {
|
case NOTIFICATION_READY: {
|
||||||
variable_editor->connect("changed", this, "_update_members");
|
variable_editor->connect_compat("changed", this, "_update_members");
|
||||||
signal_editor->connect("changed", this, "_update_members");
|
signal_editor->connect_compat("changed", this, "_update_members");
|
||||||
FALLTHROUGH;
|
FALLTHROUGH;
|
||||||
}
|
}
|
||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
@@ -4697,7 +4697,7 @@ VisualScriptEditor::VisualScriptEditor() {
|
|||||||
edit_menu->get_popup()->add_separator();
|
edit_menu->get_popup()->add_separator();
|
||||||
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("visual_script_editor/create_function"), EDIT_CREATE_FUNCTION);
|
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("visual_script_editor/create_function"), EDIT_CREATE_FUNCTION);
|
||||||
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("visual_script_editor/refresh_nodes"), REFRESH_GRAPH);
|
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("visual_script_editor/refresh_nodes"), REFRESH_GRAPH);
|
||||||
edit_menu->get_popup()->connect("id_pressed", this, "_menu_option");
|
edit_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option");
|
||||||
|
|
||||||
members_section = memnew(VBoxContainer);
|
members_section = memnew(VBoxContainer);
|
||||||
// Add but wait until done setting up this.
|
// Add but wait until done setting up this.
|
||||||
@@ -4707,7 +4707,7 @@ VisualScriptEditor::VisualScriptEditor() {
|
|||||||
CheckButton *tool_script_check = memnew(CheckButton);
|
CheckButton *tool_script_check = memnew(CheckButton);
|
||||||
tool_script_check->set_text(TTR("Make Tool:"));
|
tool_script_check->set_text(TTR("Make Tool:"));
|
||||||
members_section->add_child(tool_script_check);
|
members_section->add_child(tool_script_check);
|
||||||
tool_script_check->connect("pressed", this, "_toggle_tool_script");
|
tool_script_check->connect_compat("pressed", this, "_toggle_tool_script");
|
||||||
|
|
||||||
/// Members ///
|
/// Members ///
|
||||||
|
|
||||||
@@ -4715,11 +4715,11 @@ VisualScriptEditor::VisualScriptEditor() {
|
|||||||
members_section->add_margin_child(TTR("Members:"), members, true);
|
members_section->add_margin_child(TTR("Members:"), members, true);
|
||||||
members->set_custom_minimum_size(Size2(0, 50 * EDSCALE));
|
members->set_custom_minimum_size(Size2(0, 50 * EDSCALE));
|
||||||
members->set_hide_root(true);
|
members->set_hide_root(true);
|
||||||
members->connect("button_pressed", this, "_member_button");
|
members->connect_compat("button_pressed", this, "_member_button");
|
||||||
members->connect("item_edited", this, "_member_edited");
|
members->connect_compat("item_edited", this, "_member_edited");
|
||||||
members->connect("cell_selected", this, "_member_selected", varray(), CONNECT_DEFERRED);
|
members->connect_compat("cell_selected", this, "_member_selected", varray(), CONNECT_DEFERRED);
|
||||||
members->connect("gui_input", this, "_members_gui_input");
|
members->connect_compat("gui_input", this, "_members_gui_input");
|
||||||
members->connect("item_rmb_selected", this, "_member_rmb_selected");
|
members->connect_compat("item_rmb_selected", this, "_member_rmb_selected");
|
||||||
members->set_allow_rmb_select(true);
|
members->set_allow_rmb_select(true);
|
||||||
members->set_allow_reselect(true);
|
members->set_allow_reselect(true);
|
||||||
members->set_hide_folding(true);
|
members->set_hide_folding(true);
|
||||||
@@ -4727,13 +4727,13 @@ VisualScriptEditor::VisualScriptEditor() {
|
|||||||
|
|
||||||
member_popup = memnew(PopupMenu);
|
member_popup = memnew(PopupMenu);
|
||||||
add_child(member_popup);
|
add_child(member_popup);
|
||||||
member_popup->connect("id_pressed", this, "_member_option");
|
member_popup->connect_compat("id_pressed", this, "_member_option");
|
||||||
|
|
||||||
function_name_edit = memnew(PopupDialog);
|
function_name_edit = memnew(PopupDialog);
|
||||||
function_name_box = memnew(LineEdit);
|
function_name_box = memnew(LineEdit);
|
||||||
function_name_edit->add_child(function_name_box);
|
function_name_edit->add_child(function_name_box);
|
||||||
function_name_edit->set_h_size_flags(SIZE_EXPAND);
|
function_name_edit->set_h_size_flags(SIZE_EXPAND);
|
||||||
function_name_box->connect("gui_input", this, "_fn_name_box_input");
|
function_name_box->connect_compat("gui_input", this, "_fn_name_box_input");
|
||||||
function_name_box->set_expand_to_text_length(true);
|
function_name_box->set_expand_to_text_length(true);
|
||||||
add_child(function_name_edit);
|
add_child(function_name_edit);
|
||||||
|
|
||||||
@@ -4743,15 +4743,15 @@ VisualScriptEditor::VisualScriptEditor() {
|
|||||||
add_child(graph);
|
add_child(graph);
|
||||||
graph->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
graph->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
graph->set_anchors_and_margins_preset(Control::PRESET_WIDE);
|
graph->set_anchors_and_margins_preset(Control::PRESET_WIDE);
|
||||||
graph->connect("node_selected", this, "_node_selected");
|
graph->connect_compat("node_selected", this, "_node_selected");
|
||||||
graph->connect("_begin_node_move", this, "_begin_node_move");
|
graph->connect_compat("_begin_node_move", this, "_begin_node_move");
|
||||||
graph->connect("_end_node_move", this, "_end_node_move");
|
graph->connect_compat("_end_node_move", this, "_end_node_move");
|
||||||
graph->connect("delete_nodes_request", this, "_on_nodes_delete");
|
graph->connect_compat("delete_nodes_request", this, "_on_nodes_delete");
|
||||||
graph->connect("duplicate_nodes_request", this, "_on_nodes_duplicate");
|
graph->connect_compat("duplicate_nodes_request", this, "_on_nodes_duplicate");
|
||||||
graph->connect("gui_input", this, "_graph_gui_input");
|
graph->connect_compat("gui_input", this, "_graph_gui_input");
|
||||||
graph->set_drag_forwarding(this);
|
graph->set_drag_forwarding(this);
|
||||||
graph->hide();
|
graph->hide();
|
||||||
graph->connect("scroll_offset_changed", this, "_graph_ofs_changed");
|
graph->connect_compat("scroll_offset_changed", this, "_graph_ofs_changed");
|
||||||
|
|
||||||
/// Add Buttons to Top Bar/Zoom bar.
|
/// Add Buttons to Top Bar/Zoom bar.
|
||||||
HBoxContainer *graph_hbc = graph->get_zoom_hbox();
|
HBoxContainer *graph_hbc = graph->get_zoom_hbox();
|
||||||
@@ -4761,18 +4761,18 @@ VisualScriptEditor::VisualScriptEditor() {
|
|||||||
graph_hbc->add_child(base_lbl);
|
graph_hbc->add_child(base_lbl);
|
||||||
|
|
||||||
base_type_select = memnew(Button);
|
base_type_select = memnew(Button);
|
||||||
base_type_select->connect("pressed", this, "_change_base_type");
|
base_type_select->connect_compat("pressed", this, "_change_base_type");
|
||||||
graph_hbc->add_child(base_type_select);
|
graph_hbc->add_child(base_type_select);
|
||||||
|
|
||||||
Button *add_nds = memnew(Button);
|
Button *add_nds = memnew(Button);
|
||||||
add_nds->set_text(TTR("Add Nodes..."));
|
add_nds->set_text(TTR("Add Nodes..."));
|
||||||
graph_hbc->add_child(add_nds);
|
graph_hbc->add_child(add_nds);
|
||||||
add_nds->connect("pressed", this, "_add_node_dialog");
|
add_nds->connect_compat("pressed", this, "_add_node_dialog");
|
||||||
|
|
||||||
Button *fn_btn = memnew(Button);
|
Button *fn_btn = memnew(Button);
|
||||||
fn_btn->set_text(TTR("Add Function..."));
|
fn_btn->set_text(TTR("Add Function..."));
|
||||||
graph_hbc->add_child(fn_btn);
|
graph_hbc->add_child(fn_btn);
|
||||||
fn_btn->connect("pressed", this, "_create_function_dialog");
|
fn_btn->connect_compat("pressed", this, "_create_function_dialog");
|
||||||
|
|
||||||
// Add Function Dialog.
|
// Add Function Dialog.
|
||||||
VBoxContainer *function_vb = memnew(VBoxContainer);
|
VBoxContainer *function_vb = memnew(VBoxContainer);
|
||||||
@@ -4790,7 +4790,7 @@ VisualScriptEditor::VisualScriptEditor() {
|
|||||||
func_name_box->set_h_size_flags(SIZE_EXPAND_FILL);
|
func_name_box->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||||
func_name_box->set_placeholder(TTR("function_name"));
|
func_name_box->set_placeholder(TTR("function_name"));
|
||||||
func_name_box->set_text("");
|
func_name_box->set_text("");
|
||||||
func_name_box->connect("focus_entered", this, "_deselect_input_names");
|
func_name_box->connect_compat("focus_entered", this, "_deselect_input_names");
|
||||||
func_name_hbox->add_child(func_name_box);
|
func_name_hbox->add_child(func_name_box);
|
||||||
|
|
||||||
// Add minor setting for function if needed, here!
|
// Add minor setting for function if needed, here!
|
||||||
@@ -4800,7 +4800,7 @@ VisualScriptEditor::VisualScriptEditor() {
|
|||||||
Button *add_input_button = memnew(Button);
|
Button *add_input_button = memnew(Button);
|
||||||
add_input_button->set_h_size_flags(SIZE_EXPAND_FILL);
|
add_input_button->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||||
add_input_button->set_text(TTR("Add Input"));
|
add_input_button->set_text(TTR("Add Input"));
|
||||||
add_input_button->connect("pressed", this, "_add_func_input");
|
add_input_button->connect_compat("pressed", this, "_add_func_input");
|
||||||
function_vb->add_child(add_input_button);
|
function_vb->add_child(add_input_button);
|
||||||
|
|
||||||
func_input_scroll = memnew(ScrollContainer);
|
func_input_scroll = memnew(ScrollContainer);
|
||||||
@@ -4816,7 +4816,7 @@ VisualScriptEditor::VisualScriptEditor() {
|
|||||||
function_create_dialog->set_title(TTR("Create Function"));
|
function_create_dialog->set_title(TTR("Create Function"));
|
||||||
function_create_dialog->add_child(function_vb);
|
function_create_dialog->add_child(function_vb);
|
||||||
function_create_dialog->get_ok()->set_text(TTR("Create"));
|
function_create_dialog->get_ok()->set_text(TTR("Create"));
|
||||||
function_create_dialog->get_ok()->connect("pressed", this, "_create_function");
|
function_create_dialog->get_ok()->connect_compat("pressed", this, "_create_function");
|
||||||
add_child(function_create_dialog);
|
add_child(function_create_dialog);
|
||||||
|
|
||||||
select_func_text = memnew(Label);
|
select_func_text = memnew(Label);
|
||||||
@@ -4836,7 +4836,7 @@ VisualScriptEditor::VisualScriptEditor() {
|
|||||||
|
|
||||||
hint_text_timer = memnew(Timer);
|
hint_text_timer = memnew(Timer);
|
||||||
hint_text_timer->set_wait_time(4);
|
hint_text_timer->set_wait_time(4);
|
||||||
hint_text_timer->connect("timeout", this, "_hide_timer");
|
hint_text_timer->connect_compat("timeout", this, "_hide_timer");
|
||||||
add_child(hint_text_timer);
|
add_child(hint_text_timer);
|
||||||
|
|
||||||
// Allowed casts (connections).
|
// Allowed casts (connections).
|
||||||
@@ -4854,9 +4854,9 @@ VisualScriptEditor::VisualScriptEditor() {
|
|||||||
|
|
||||||
graph->add_valid_left_disconnect_type(TYPE_SEQUENCE);
|
graph->add_valid_left_disconnect_type(TYPE_SEQUENCE);
|
||||||
|
|
||||||
graph->connect("connection_request", this, "_graph_connected");
|
graph->connect_compat("connection_request", this, "_graph_connected");
|
||||||
graph->connect("disconnection_request", this, "_graph_disconnected");
|
graph->connect_compat("disconnection_request", this, "_graph_disconnected");
|
||||||
graph->connect("connection_to_empty", this, "_graph_connect_to_empty");
|
graph->connect_compat("connection_to_empty", this, "_graph_connect_to_empty");
|
||||||
|
|
||||||
edit_signal_dialog = memnew(AcceptDialog);
|
edit_signal_dialog = memnew(AcceptDialog);
|
||||||
edit_signal_dialog->get_ok()->set_text(TTR("Close"));
|
edit_signal_dialog->get_ok()->set_text(TTR("Close"));
|
||||||
@@ -4880,7 +4880,7 @@ VisualScriptEditor::VisualScriptEditor() {
|
|||||||
|
|
||||||
select_base_type = memnew(CreateDialog);
|
select_base_type = memnew(CreateDialog);
|
||||||
select_base_type->set_base_type("Object"); // Anything goes.
|
select_base_type->set_base_type("Object"); // Anything goes.
|
||||||
select_base_type->connect("create", this, "_change_base_type_callback");
|
select_base_type->connect_compat("create", this, "_change_base_type_callback");
|
||||||
add_child(select_base_type);
|
add_child(select_base_type);
|
||||||
|
|
||||||
undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
undo_redo = EditorNode::get_singleton()->get_undo_redo();
|
||||||
@@ -4892,22 +4892,22 @@ VisualScriptEditor::VisualScriptEditor() {
|
|||||||
|
|
||||||
default_value_edit = memnew(CustomPropertyEditor);
|
default_value_edit = memnew(CustomPropertyEditor);
|
||||||
add_child(default_value_edit);
|
add_child(default_value_edit);
|
||||||
default_value_edit->connect("variant_changed", this, "_default_value_changed");
|
default_value_edit->connect_compat("variant_changed", this, "_default_value_changed");
|
||||||
|
|
||||||
method_select = memnew(VisualScriptPropertySelector);
|
method_select = memnew(VisualScriptPropertySelector);
|
||||||
add_child(method_select);
|
add_child(method_select);
|
||||||
method_select->connect("selected", this, "_selected_method");
|
method_select->connect_compat("selected", this, "_selected_method");
|
||||||
error_line = -1;
|
error_line = -1;
|
||||||
|
|
||||||
new_connect_node_select = memnew(VisualScriptPropertySelector);
|
new_connect_node_select = memnew(VisualScriptPropertySelector);
|
||||||
add_child(new_connect_node_select);
|
add_child(new_connect_node_select);
|
||||||
new_connect_node_select->set_resizable(true);
|
new_connect_node_select->set_resizable(true);
|
||||||
new_connect_node_select->connect("selected", this, "_selected_connect_node");
|
new_connect_node_select->connect_compat("selected", this, "_selected_connect_node");
|
||||||
new_connect_node_select->get_cancel()->connect("pressed", this, "_cancel_connect_node");
|
new_connect_node_select->get_cancel()->connect_compat("pressed", this, "_cancel_connect_node");
|
||||||
|
|
||||||
new_virtual_method_select = memnew(VisualScriptPropertySelector);
|
new_virtual_method_select = memnew(VisualScriptPropertySelector);
|
||||||
add_child(new_virtual_method_select);
|
add_child(new_virtual_method_select);
|
||||||
new_virtual_method_select->connect("selected", this, "_selected_new_virtual_method");
|
new_virtual_method_select->connect_compat("selected", this, "_selected_new_virtual_method");
|
||||||
}
|
}
|
||||||
|
|
||||||
VisualScriptEditor::~VisualScriptEditor() {
|
VisualScriptEditor::~VisualScriptEditor() {
|
||||||
|
|||||||
@@ -1229,7 +1229,7 @@ public:
|
|||||||
|
|
||||||
//virtual int get_working_memory_size() const { return 0; }
|
//virtual int get_working_memory_size() const { return 0; }
|
||||||
//execute by parsing the tree directly
|
//execute by parsing the tree directly
|
||||||
virtual bool _execute(const Variant **p_inputs, VisualScriptExpression::ENode *p_node, Variant &r_ret, String &r_error_str, Variant::CallError &ce) {
|
virtual bool _execute(const Variant **p_inputs, VisualScriptExpression::ENode *p_node, Variant &r_ret, String &r_error_str, Callable::CallError &ce) {
|
||||||
|
|
||||||
switch (p_node->type) {
|
switch (p_node->type) {
|
||||||
case VisualScriptExpression::ENode::TYPE_INPUT: {
|
case VisualScriptExpression::ENode::TYPE_INPUT: {
|
||||||
@@ -1371,7 +1371,7 @@ public:
|
|||||||
|
|
||||||
r_ret = Variant::construct(constructor->data_type, (const Variant **)argp.ptr(), argp.size(), ce);
|
r_ret = Variant::construct(constructor->data_type, (const Variant **)argp.ptr(), argp.size(), ce);
|
||||||
|
|
||||||
if (ce.error != Variant::CallError::CALL_OK) {
|
if (ce.error != Callable::CallError::CALL_OK) {
|
||||||
r_error_str = "Invalid arguments to construct '" + Variant::get_type_name(constructor->data_type) + "'.";
|
r_error_str = "Invalid arguments to construct '" + Variant::get_type_name(constructor->data_type) + "'.";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1398,7 +1398,7 @@ public:
|
|||||||
|
|
||||||
VisualScriptBuiltinFunc::exec_func(bifunc->func, (const Variant **)argp.ptr(), &r_ret, ce, r_error_str);
|
VisualScriptBuiltinFunc::exec_func(bifunc->func, (const Variant **)argp.ptr(), &r_ret, ce, r_error_str);
|
||||||
|
|
||||||
if (ce.error != Variant::CallError::CALL_OK) {
|
if (ce.error != Callable::CallError::CALL_OK) {
|
||||||
r_error_str = "Builtin Call Failed. " + r_error_str;
|
r_error_str = "Builtin Call Failed. " + r_error_str;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1430,7 +1430,7 @@ public:
|
|||||||
|
|
||||||
r_ret = base.call(call->method, (const Variant **)argp.ptr(), argp.size(), ce);
|
r_ret = base.call(call->method, (const Variant **)argp.ptr(), argp.size(), ce);
|
||||||
|
|
||||||
if (ce.error != Variant::CallError::CALL_OK) {
|
if (ce.error != Callable::CallError::CALL_OK) {
|
||||||
r_error_str = "On call to '" + String(call->method) + "':";
|
r_error_str = "On call to '" + String(call->method) + "':";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1440,24 +1440,24 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
if (!expression->root || expression->error_set) {
|
if (!expression->root || expression->error_set) {
|
||||||
r_error_str = expression->error_str;
|
r_error_str = expression->error_str;
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool error = _execute(p_inputs, expression->root, *p_outputs[0], r_error_str, r_error);
|
bool error = _execute(p_inputs, expression->root, *p_outputs[0], r_error_str, r_error);
|
||||||
if (error && r_error.error == Variant::CallError::CALL_OK) {
|
if (error && r_error.error == Callable::CallError::CALL_OK) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if (!error && expression->output_type != Variant::NIL && !Variant::can_convert_strict(p_outputs[0]->get_type(), expression->output_type)) {
|
if (!error && expression->output_type != Variant::NIL && !Variant::can_convert_strict(p_outputs[0]->get_type(), expression->output_type)) {
|
||||||
|
|
||||||
r_error_str += "Can't convert expression result from " + Variant::get_type_name(p_outputs[0]->get_type()) + " to " + Variant::get_type_name(expression->output_type) + ".";
|
r_error_str += "Can't convert expression result from " + Variant::get_type_name(p_outputs[0]->get_type()) + " to " + Variant::get_type_name(expression->output_type) + ".";
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ public:
|
|||||||
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||||
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
if (with_value) {
|
if (with_value) {
|
||||||
*p_working_mem = *p_inputs[0];
|
*p_working_mem = *p_inputs[0];
|
||||||
@@ -237,7 +237,7 @@ public:
|
|||||||
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||||
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
if (p_start_mode == START_MODE_CONTINUE_SEQUENCE)
|
if (p_start_mode == START_MODE_CONTINUE_SEQUENCE)
|
||||||
return 2;
|
return 2;
|
||||||
@@ -323,7 +323,7 @@ public:
|
|||||||
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||||
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
bool keep_going = p_inputs[0]->operator bool();
|
bool keep_going = p_inputs[0]->operator bool();
|
||||||
|
|
||||||
@@ -410,7 +410,7 @@ public:
|
|||||||
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||||
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
if (p_start_mode == START_MODE_BEGIN_SEQUENCE) {
|
if (p_start_mode == START_MODE_BEGIN_SEQUENCE) {
|
||||||
p_working_mem[0] = *p_inputs[0];
|
p_working_mem[0] = *p_inputs[0];
|
||||||
@@ -418,7 +418,7 @@ public:
|
|||||||
bool can_iter = p_inputs[0]->iter_init(p_working_mem[1], valid);
|
bool can_iter = p_inputs[0]->iter_init(p_working_mem[1], valid);
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = RTR("Input type not iterable: ") + Variant::get_type_name(p_inputs[0]->get_type());
|
r_error_str = RTR("Input type not iterable: ") + Variant::get_type_name(p_inputs[0]->get_type());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -429,7 +429,7 @@ public:
|
|||||||
*p_outputs[0] = p_working_mem[0].iter_get(p_working_mem[1], valid);
|
*p_outputs[0] = p_working_mem[0].iter_get(p_working_mem[1], valid);
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = RTR("Iterator became invalid");
|
r_error_str = RTR("Iterator became invalid");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -440,7 +440,7 @@ public:
|
|||||||
bool can_iter = p_working_mem[0].iter_next(p_working_mem[1], valid);
|
bool can_iter = p_working_mem[0].iter_next(p_working_mem[1], valid);
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = RTR("Iterator became invalid: ") + Variant::get_type_name(p_inputs[0]->get_type());
|
r_error_str = RTR("Iterator became invalid: ") + Variant::get_type_name(p_inputs[0]->get_type());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -451,7 +451,7 @@ public:
|
|||||||
*p_outputs[0] = p_working_mem[0].iter_get(p_working_mem[1], valid);
|
*p_outputs[0] = p_working_mem[0].iter_get(p_working_mem[1], valid);
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = RTR("Iterator became invalid");
|
r_error_str = RTR("Iterator became invalid");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -549,7 +549,7 @@ public:
|
|||||||
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||||
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
if (p_start_mode == START_MODE_BEGIN_SEQUENCE) {
|
if (p_start_mode == START_MODE_BEGIN_SEQUENCE) {
|
||||||
|
|
||||||
@@ -645,7 +645,7 @@ public:
|
|||||||
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||||
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return false; }
|
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return false; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
if (p_start_mode == START_MODE_CONTINUE_SEQUENCE) {
|
if (p_start_mode == START_MODE_CONTINUE_SEQUENCE) {
|
||||||
return case_count; //exit
|
return case_count; //exit
|
||||||
@@ -836,14 +836,14 @@ public:
|
|||||||
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||||
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return false; }
|
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return false; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
Object *obj = *p_inputs[0];
|
Object *obj = *p_inputs[0];
|
||||||
|
|
||||||
*p_outputs[0] = Variant();
|
*p_outputs[0] = Variant();
|
||||||
|
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = "Instance is null";
|
r_error_str = "Instance is null";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -861,7 +861,7 @@ public:
|
|||||||
}
|
}
|
||||||
Ref<Script> cast_script = Ref<Resource>(ResourceCache::get(script));
|
Ref<Script> cast_script = Ref<Resource>(ResourceCache::get(script));
|
||||||
if (!cast_script.is_valid()) {
|
if (!cast_script.is_valid()) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = "Script path is not a script: " + script;
|
r_error_str = "Script path is not a script: " + script;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -788,7 +788,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
switch (call_mode) {
|
switch (call_mode) {
|
||||||
|
|
||||||
@@ -808,14 +808,14 @@ public:
|
|||||||
|
|
||||||
Node *node = Object::cast_to<Node>(instance->get_owner_ptr());
|
Node *node = Object::cast_to<Node>(instance->get_owner_ptr());
|
||||||
if (!node) {
|
if (!node) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = "Base object is not a Node!";
|
r_error_str = "Base object is not a Node!";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node *another = node->get_node(node_path);
|
Node *another = node->get_node(node_path);
|
||||||
if (!another) {
|
if (!another) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = "Path does not lead Node!";
|
r_error_str = "Path does not lead Node!";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -846,7 +846,7 @@ public:
|
|||||||
} else if (returns == 1) {
|
} else if (returns == 1) {
|
||||||
v.call(function, p_inputs + 1, input_args, r_error);
|
v.call(function, p_inputs + 1, input_args, r_error);
|
||||||
} else {
|
} else {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = "Invalid returns count for call_mode == CALL_MODE_INSTANCE";
|
r_error_str = "Invalid returns count for call_mode == CALL_MODE_INSTANCE";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -866,7 +866,7 @@ public:
|
|||||||
|
|
||||||
Object *object = Engine::get_singleton()->get_singleton_object(singleton);
|
Object *object = Engine::get_singleton()->get_singleton_object(singleton);
|
||||||
if (!object) {
|
if (!object) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = "Invalid singleton name: '" + String(singleton) + "'";
|
r_error_str = "Invalid singleton name: '" + String(singleton) + "'";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -884,7 +884,7 @@ public:
|
|||||||
if (!validate) {
|
if (!validate) {
|
||||||
|
|
||||||
//ignore call errors if validation is disabled
|
//ignore call errors if validation is disabled
|
||||||
r_error.error = Variant::CallError::CALL_OK;
|
r_error.error = Callable::CallError::CALL_OK;
|
||||||
r_error_str = String();
|
r_error_str = String();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1020,7 +1020,7 @@ void VisualScriptPropertySet::_adjust_input_index(PropertyInfo &pinfo) const {
|
|||||||
if (index != StringName()) {
|
if (index != StringName()) {
|
||||||
|
|
||||||
Variant v;
|
Variant v;
|
||||||
Variant::CallError ce;
|
Callable::CallError ce;
|
||||||
v = Variant::construct(pinfo.type, NULL, 0, ce);
|
v = Variant::construct(pinfo.type, NULL, 0, ce);
|
||||||
Variant i = v.get(index);
|
Variant i = v.get(index);
|
||||||
pinfo.type = i.get_type();
|
pinfo.type = i.get_type();
|
||||||
@@ -1167,7 +1167,7 @@ void VisualScriptPropertySet::_update_cache() {
|
|||||||
//not super efficient..
|
//not super efficient..
|
||||||
|
|
||||||
Variant v;
|
Variant v;
|
||||||
Variant::CallError ce;
|
Callable::CallError ce;
|
||||||
v = Variant::construct(basic_type, NULL, 0, ce);
|
v = Variant::construct(basic_type, NULL, 0, ce);
|
||||||
|
|
||||||
List<PropertyInfo> pinfo;
|
List<PropertyInfo> pinfo;
|
||||||
@@ -1409,7 +1409,7 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const {
|
|||||||
|
|
||||||
if (property.name == "index") {
|
if (property.name == "index") {
|
||||||
|
|
||||||
Variant::CallError ce;
|
Callable::CallError ce;
|
||||||
Variant v = Variant::construct(type_cache.type, NULL, 0, ce);
|
Variant v = Variant::construct(type_cache.type, NULL, 0, ce);
|
||||||
List<PropertyInfo> plist;
|
List<PropertyInfo> plist;
|
||||||
v.get_property_list(&plist);
|
v.get_property_list(&plist);
|
||||||
@@ -1578,7 +1578,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
switch (call_mode) {
|
switch (call_mode) {
|
||||||
|
|
||||||
@@ -1597,7 +1597,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = "Invalid set value '" + String(*p_inputs[0]) + "' on property '" + String(property) + "' of type " + object->get_class();
|
r_error_str = "Invalid set value '" + String(*p_inputs[0]) + "' on property '" + String(property) + "' of type " + object->get_class();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
@@ -1605,14 +1605,14 @@ public:
|
|||||||
|
|
||||||
Node *node = Object::cast_to<Node>(instance->get_owner_ptr());
|
Node *node = Object::cast_to<Node>(instance->get_owner_ptr());
|
||||||
if (!node) {
|
if (!node) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = "Base object is not a Node!";
|
r_error_str = "Base object is not a Node!";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node *another = node->get_node(node_path);
|
Node *another = node->get_node(node_path);
|
||||||
if (!another) {
|
if (!another) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = "Path does not lead Node!";
|
r_error_str = "Path does not lead Node!";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1629,7 +1629,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = "Invalid set value '" + String(*p_inputs[0]) + "' on property '" + String(property) + "' of type " + another->get_class();
|
r_error_str = "Invalid set value '" + String(*p_inputs[0]) + "' on property '" + String(property) + "' of type " + another->get_class();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1651,7 +1651,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = "Invalid set value '" + String(*p_inputs[1]) + "' (" + Variant::get_type_name(p_inputs[1]->get_type()) + ") on property '" + String(property) + "' of type " + Variant::get_type_name(v.get_type());
|
r_error_str = "Invalid set value '" + String(*p_inputs[1]) + "' (" + Variant::get_type_name(p_inputs[1]->get_type()) + ") on property '" + String(property) + "' of type " + Variant::get_type_name(v.get_type());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1875,7 +1875,7 @@ void VisualScriptPropertyGet::_update_cache() {
|
|||||||
//not super efficient..
|
//not super efficient..
|
||||||
|
|
||||||
Variant v;
|
Variant v;
|
||||||
Variant::CallError ce;
|
Callable::CallError ce;
|
||||||
v = Variant::construct(basic_type, NULL, 0, ce);
|
v = Variant::construct(basic_type, NULL, 0, ce);
|
||||||
|
|
||||||
List<PropertyInfo> pinfo;
|
List<PropertyInfo> pinfo;
|
||||||
@@ -2124,7 +2124,7 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const {
|
|||||||
|
|
||||||
if (property.name == "index") {
|
if (property.name == "index") {
|
||||||
|
|
||||||
Variant::CallError ce;
|
Callable::CallError ce;
|
||||||
Variant v = Variant::construct(type_cache, NULL, 0, ce);
|
Variant v = Variant::construct(type_cache, NULL, 0, ce);
|
||||||
List<PropertyInfo> plist;
|
List<PropertyInfo> plist;
|
||||||
v.get_property_list(&plist);
|
v.get_property_list(&plist);
|
||||||
@@ -2211,7 +2211,7 @@ public:
|
|||||||
VisualScriptPropertyGet *node;
|
VisualScriptPropertyGet *node;
|
||||||
VisualScriptInstance *instance;
|
VisualScriptInstance *instance;
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
switch (call_mode) {
|
switch (call_mode) {
|
||||||
|
|
||||||
@@ -2228,7 +2228,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = RTR("Invalid index property name.");
|
r_error_str = RTR("Invalid index property name.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2237,14 +2237,14 @@ public:
|
|||||||
|
|
||||||
Node *node = Object::cast_to<Node>(instance->get_owner_ptr());
|
Node *node = Object::cast_to<Node>(instance->get_owner_ptr());
|
||||||
if (!node) {
|
if (!node) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = RTR("Base object is not a Node!");
|
r_error_str = RTR("Base object is not a Node!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node *another = node->get_node(node_path);
|
Node *another = node->get_node(node_path);
|
||||||
if (!another) {
|
if (!another) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = RTR("Path does not lead Node!");
|
r_error_str = RTR("Path does not lead Node!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2258,7 +2258,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = vformat(RTR("Invalid index property name '%s' in node %s."), String(property), another->get_name());
|
r_error_str = vformat(RTR("Invalid index property name '%s' in node %s."), String(property), another->get_name());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2275,7 +2275,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = RTR("Invalid index property name.");
|
r_error_str = RTR("Invalid index property name.");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -2434,7 +2434,7 @@ public:
|
|||||||
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||||
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
Object *obj = instance->get_owner_ptr();
|
Object *obj = instance->get_owner_ptr();
|
||||||
|
|
||||||
@@ -2500,7 +2500,7 @@ void register_visual_script_func_nodes() {
|
|||||||
|
|
||||||
Variant::Type t = Variant::Type(i);
|
Variant::Type t = Variant::Type(i);
|
||||||
String type_name = Variant::get_type_name(t);
|
String type_name = Variant::get_type_name(t);
|
||||||
Variant::CallError ce;
|
Callable::CallError ce;
|
||||||
Variant vt = Variant::construct(t, NULL, 0, ce);
|
Variant vt = Variant::construct(t, NULL, 0, ce);
|
||||||
List<MethodInfo> ml;
|
List<MethodInfo> ml;
|
||||||
vt.get_method_list(&ml);
|
vt.get_method_list(&ml);
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ public:
|
|||||||
|
|
||||||
//virtual int get_working_memory_size() const { return 0; }
|
//virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
int ac = node->get_argument_count();
|
int ac = node->get_argument_count();
|
||||||
|
|
||||||
@@ -294,7 +294,7 @@ public:
|
|||||||
Variant::Type expected = node->get_argument_type(i);
|
Variant::Type expected = node->get_argument_type(i);
|
||||||
if (expected != Variant::NIL) {
|
if (expected != Variant::NIL) {
|
||||||
if (!Variant::can_convert_strict(p_inputs[i]->get_type(), expected)) {
|
if (!Variant::can_convert_strict(p_inputs[i]->get_type(), expected)) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||||
r_error.expected = expected;
|
r_error.expected = expected;
|
||||||
r_error.argument = i;
|
r_error.argument = i;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -762,7 +762,7 @@ public:
|
|||||||
int input_count = 0;
|
int input_count = 0;
|
||||||
virtual int get_working_memory_size() const { return 0; }
|
virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
if (input_count > 0) {
|
if (input_count > 0) {
|
||||||
Array arr;
|
Array arr;
|
||||||
@@ -1031,7 +1031,7 @@ public:
|
|||||||
|
|
||||||
//virtual int get_working_memory_size() const { return 0; }
|
//virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
bool valid;
|
bool valid;
|
||||||
if (unary) {
|
if (unary) {
|
||||||
@@ -1043,7 +1043,7 @@ public:
|
|||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
|
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
if (p_outputs[0]->get_type() == Variant::STRING) {
|
if (p_outputs[0]->get_type() == Variant::STRING) {
|
||||||
r_error_str = *p_outputs[0];
|
r_error_str = *p_outputs[0];
|
||||||
} else {
|
} else {
|
||||||
@@ -1165,7 +1165,7 @@ class VisualScriptNodeInstanceSelect : public VisualScriptNodeInstance {
|
|||||||
public:
|
public:
|
||||||
//virtual int get_working_memory_size() const { return 0; }
|
//virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
bool cond = *p_inputs[0];
|
bool cond = *p_inputs[0];
|
||||||
if (cond)
|
if (cond)
|
||||||
@@ -1285,10 +1285,10 @@ public:
|
|||||||
VisualScriptInstance *instance;
|
VisualScriptInstance *instance;
|
||||||
StringName variable;
|
StringName variable;
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
if (!instance->get_variable(variable, p_outputs[0])) {
|
if (!instance->get_variable(variable, p_outputs[0])) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = RTR("VariableGet not found in script: ") + "'" + String(variable) + "'";
|
r_error_str = RTR("VariableGet not found in script: ") + "'" + String(variable) + "'";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1407,11 +1407,11 @@ public:
|
|||||||
|
|
||||||
//virtual int get_working_memory_size() const { return 0; }
|
//virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
if (!instance->set_variable(variable, *p_inputs[0])) {
|
if (!instance->set_variable(variable, *p_inputs[0])) {
|
||||||
|
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = RTR("VariableSet not found in script: ") + "'" + String(variable) + "'";
|
r_error_str = RTR("VariableSet not found in script: ") + "'" + String(variable) + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1482,7 +1482,7 @@ void VisualScriptConstant::set_constant_type(Variant::Type p_type) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
type = p_type;
|
type = p_type;
|
||||||
Variant::CallError ce;
|
Callable::CallError ce;
|
||||||
value = Variant::construct(type, NULL, 0, ce);
|
value = Variant::construct(type, NULL, 0, ce);
|
||||||
ports_changed_notify();
|
ports_changed_notify();
|
||||||
_change_notify();
|
_change_notify();
|
||||||
@@ -1537,7 +1537,7 @@ public:
|
|||||||
Variant constant;
|
Variant constant;
|
||||||
//virtual int get_working_memory_size() const { return 0; }
|
//virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
*p_outputs[0] = constant;
|
*p_outputs[0] = constant;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1642,7 +1642,7 @@ public:
|
|||||||
Ref<Resource> preload;
|
Ref<Resource> preload;
|
||||||
//virtual int get_working_memory_size() const { return 0; }
|
//virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
*p_outputs[0] = preload;
|
*p_outputs[0] = preload;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1710,13 +1710,13 @@ class VisualScriptNodeInstanceIndexGet : public VisualScriptNodeInstance {
|
|||||||
public:
|
public:
|
||||||
//virtual int get_working_memory_size() const { return 0; }
|
//virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
bool valid;
|
bool valid;
|
||||||
*p_outputs[0] = p_inputs[0]->get(*p_inputs[1], &valid);
|
*p_outputs[0] = p_inputs[0]->get(*p_inputs[1], &valid);
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = "Invalid get: " + p_inputs[0]->get_construct_string();
|
r_error_str = "Invalid get: " + p_inputs[0]->get_construct_string();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1785,14 +1785,14 @@ class VisualScriptNodeInstanceIndexSet : public VisualScriptNodeInstance {
|
|||||||
public:
|
public:
|
||||||
//virtual int get_working_memory_size() const { return 0; }
|
//virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
bool valid;
|
bool valid;
|
||||||
*p_outputs[0] = *p_inputs[0];
|
*p_outputs[0] = *p_inputs[0];
|
||||||
p_outputs[0]->set(*p_inputs[1], *p_inputs[2], &valid);
|
p_outputs[0]->set(*p_inputs[1], *p_inputs[2], &valid);
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = "Invalid set: " + p_inputs[1]->get_construct_string();
|
r_error_str = "Invalid set: " + p_inputs[1]->get_construct_string();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1866,7 +1866,7 @@ public:
|
|||||||
int index;
|
int index;
|
||||||
//virtual int get_working_memory_size() const { return 0; }
|
//virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
*p_outputs[0] = GlobalConstants::get_global_constant_value(index);
|
*p_outputs[0] = GlobalConstants::get_global_constant_value(index);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1991,11 +1991,11 @@ public:
|
|||||||
bool valid;
|
bool valid;
|
||||||
//virtual int get_working_memory_size() const { return 0; }
|
//virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
r_error_str = "Invalid constant name, pick a valid class constant.";
|
r_error_str = "Invalid constant name, pick a valid class constant.";
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
*p_outputs[0] = value;
|
*p_outputs[0] = value;
|
||||||
@@ -2140,11 +2140,11 @@ public:
|
|||||||
bool valid;
|
bool valid;
|
||||||
//virtual int get_working_memory_size() const { return 0; }
|
//virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
r_error_str = "Invalid constant name, pick a valid basic type constant.";
|
r_error_str = "Invalid constant name, pick a valid basic type constant.";
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
*p_outputs[0] = value;
|
*p_outputs[0] = value;
|
||||||
@@ -2283,7 +2283,7 @@ public:
|
|||||||
float value;
|
float value;
|
||||||
//virtual int get_working_memory_size() const { return 0; }
|
//virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
*p_outputs[0] = value;
|
*p_outputs[0] = value;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2389,7 +2389,7 @@ public:
|
|||||||
|
|
||||||
//virtual int get_working_memory_size() const { return 0; }
|
//virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
*p_outputs[0] = singleton;
|
*p_outputs[0] = singleton;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2512,18 +2512,18 @@ public:
|
|||||||
|
|
||||||
//virtual int get_working_memory_size() const { return 0; }
|
//virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
Node *node = Object::cast_to<Node>(instance->get_owner_ptr());
|
Node *node = Object::cast_to<Node>(instance->get_owner_ptr());
|
||||||
if (!node) {
|
if (!node) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = "Base object is not a Node!";
|
r_error_str = "Base object is not a Node!";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node *another = node->get_node(path);
|
Node *another = node->get_node(path);
|
||||||
if (!another) {
|
if (!another) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = "Path does not lead Node!";
|
r_error_str = "Path does not lead Node!";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2696,18 +2696,18 @@ public:
|
|||||||
|
|
||||||
//virtual int get_working_memory_size() const { return 0; }
|
//virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
Node *node = Object::cast_to<Node>(instance->get_owner_ptr());
|
Node *node = Object::cast_to<Node>(instance->get_owner_ptr());
|
||||||
if (!node) {
|
if (!node) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = "Base object is not a Node!";
|
r_error_str = "Base object is not a Node!";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneTree *tree = node->get_tree();
|
SceneTree *tree = node->get_tree();
|
||||||
if (!tree) {
|
if (!tree) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = "Attempt to get SceneTree while node is not in the active tree.";
|
r_error_str = "Attempt to get SceneTree while node is not in the active tree.";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2803,7 +2803,7 @@ public:
|
|||||||
|
|
||||||
//virtual int get_working_memory_size() const { return 0; }
|
//virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
*p_outputs[0] = path;
|
*p_outputs[0] = path;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2885,7 +2885,7 @@ public:
|
|||||||
|
|
||||||
//virtual int get_working_memory_size() const { return 0; }
|
//virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
*p_outputs[0] = instance->get_owner_ptr();
|
*p_outputs[0] = instance->get_owner_ptr();
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3022,13 +3022,13 @@ public:
|
|||||||
int work_mem_size;
|
int work_mem_size;
|
||||||
|
|
||||||
virtual int get_working_memory_size() const { return work_mem_size; }
|
virtual int get_working_memory_size() const { return work_mem_size; }
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
if (node->get_script_instance()) {
|
if (node->get_script_instance()) {
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if (!node->get_script_instance()->has_method(VisualScriptLanguage::singleton->_step)) {
|
if (!node->get_script_instance()->has_method(VisualScriptLanguage::singleton->_step)) {
|
||||||
r_error_str = RTR("Custom node has no _step() method, can't process graph.");
|
r_error_str = RTR("Custom node has no _step() method, can't process graph.");
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -3055,13 +3055,13 @@ public:
|
|||||||
Variant ret = node->get_script_instance()->call(VisualScriptLanguage::singleton->_step, in_values, out_values, p_start_mode, work_mem);
|
Variant ret = node->get_script_instance()->call(VisualScriptLanguage::singleton->_step, in_values, out_values, p_start_mode, work_mem);
|
||||||
if (ret.get_type() == Variant::STRING) {
|
if (ret.get_type() == Variant::STRING) {
|
||||||
r_error_str = ret;
|
r_error_str = ret;
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
return 0;
|
return 0;
|
||||||
} else if (ret.is_num()) {
|
} else if (ret.is_num()) {
|
||||||
ret_out = ret;
|
ret_out = ret;
|
||||||
} else {
|
} else {
|
||||||
r_error_str = RTR("Invalid return value from _step(), must be integer (seq out), or string (error).");
|
r_error_str = RTR("Invalid return value from _step(), must be integer (seq out), or string (error).");
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3144,7 +3144,7 @@ void VisualScriptCustomNode::_bind_methods() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
VisualScriptCustomNode::VisualScriptCustomNode() {
|
VisualScriptCustomNode::VisualScriptCustomNode() {
|
||||||
connect("script_changed", this, "_script_changed");
|
connect_compat("script_changed", this, "_script_changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
@@ -3237,11 +3237,11 @@ public:
|
|||||||
|
|
||||||
//virtual int get_working_memory_size() const { return 0; }
|
//virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
r_error_str = "Node requires a script with a _subcall(<args>) method to work.";
|
r_error_str = "Node requires a script with a _subcall(<args>) method to work.";
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*p_outputs[0] = subcall->call(VisualScriptLanguage::singleton->_subcall, p_inputs, input_args, r_error);
|
*p_outputs[0] = subcall->call(VisualScriptLanguage::singleton->_subcall, p_inputs, input_args, r_error);
|
||||||
@@ -3368,7 +3368,7 @@ public:
|
|||||||
|
|
||||||
//virtual int get_working_memory_size() const { return 0; }
|
//virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -3483,11 +3483,11 @@ public:
|
|||||||
|
|
||||||
//virtual int get_working_memory_size() const { return 0; }
|
//virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
Variant::CallError ce;
|
Callable::CallError ce;
|
||||||
*p_outputs[0] = Variant::construct(type, p_inputs, argcount, ce);
|
*p_outputs[0] = Variant::construct(type, p_inputs, argcount, ce);
|
||||||
if (ce.error != Variant::CallError::CALL_OK) {
|
if (ce.error != Callable::CallError::CALL_OK) {
|
||||||
r_error_str = "Invalid arguments for constructor";
|
r_error_str = "Invalid arguments for constructor";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3612,7 +3612,7 @@ public:
|
|||||||
StringName name;
|
StringName name;
|
||||||
|
|
||||||
virtual int get_working_memory_size() const { return 1; }
|
virtual int get_working_memory_size() const { return 1; }
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
*p_outputs[0] = *p_working_mem;
|
*p_outputs[0] = *p_working_mem;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3733,7 +3733,7 @@ public:
|
|||||||
StringName name;
|
StringName name;
|
||||||
|
|
||||||
virtual int get_working_memory_size() const { return 1; }
|
virtual int get_working_memory_size() const { return 1; }
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
*p_working_mem = *p_inputs[0];
|
*p_working_mem = *p_inputs[0];
|
||||||
*p_outputs[0] = *p_working_mem;
|
*p_outputs[0] = *p_working_mem;
|
||||||
@@ -3868,7 +3868,7 @@ public:
|
|||||||
StringName action;
|
StringName action;
|
||||||
VisualScriptInputAction::Mode mode;
|
VisualScriptInputAction::Mode mode;
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case VisualScriptInputAction::MODE_PRESSED: {
|
case VisualScriptInputAction::MODE_PRESSED: {
|
||||||
@@ -4007,7 +4007,7 @@ void VisualScriptDeconstruct::_update_elements() {
|
|||||||
|
|
||||||
elements.clear();
|
elements.clear();
|
||||||
Variant v;
|
Variant v;
|
||||||
Variant::CallError ce;
|
Callable::CallError ce;
|
||||||
v = Variant::construct(type, NULL, 0, ce);
|
v = Variant::construct(type, NULL, 0, ce);
|
||||||
|
|
||||||
List<PropertyInfo> pinfo;
|
List<PropertyInfo> pinfo;
|
||||||
@@ -4065,7 +4065,7 @@ public:
|
|||||||
|
|
||||||
//virtual int get_working_memory_size() const { return 0; }
|
//virtual int get_working_memory_size() const { return 0; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
Variant in = *p_inputs[0];
|
Variant in = *p_inputs[0];
|
||||||
|
|
||||||
@@ -4074,7 +4074,7 @@ public:
|
|||||||
*p_outputs[i] = in.get(outputs[i], &valid);
|
*p_outputs[i] = in.get(outputs[i], &valid);
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
r_error_str = "Can't obtain element '" + String(outputs[i]) + "' from " + Variant::get_type_name(in.get_type());
|
r_error_str = "Can't obtain element '" + String(outputs[i]) + "' from " + Variant::get_type_name(in.get_type());
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ void VisualScriptPropertySelector::_update_search() {
|
|||||||
{
|
{
|
||||||
if (type != Variant::NIL) {
|
if (type != Variant::NIL) {
|
||||||
Variant v;
|
Variant v;
|
||||||
Variant::CallError ce;
|
Callable::CallError ce;
|
||||||
v = Variant::construct(type, NULL, 0, ce);
|
v = Variant::construct(type, NULL, 0, ce);
|
||||||
v.get_method_list(&methods);
|
v.get_method_list(&methods);
|
||||||
} else {
|
} else {
|
||||||
@@ -520,7 +520,7 @@ void VisualScriptPropertySelector::_notification(int p_what) {
|
|||||||
|
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||||
|
|
||||||
connect("confirmed", this, "_confirmed");
|
connect_compat("confirmed", this, "_confirmed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -703,23 +703,23 @@ VisualScriptPropertySelector::VisualScriptPropertySelector() {
|
|||||||
//set_child_rect(vbc);
|
//set_child_rect(vbc);
|
||||||
search_box = memnew(LineEdit);
|
search_box = memnew(LineEdit);
|
||||||
vbc->add_margin_child(TTR("Search:"), search_box);
|
vbc->add_margin_child(TTR("Search:"), search_box);
|
||||||
search_box->connect("text_changed", this, "_text_changed");
|
search_box->connect_compat("text_changed", this, "_text_changed");
|
||||||
search_box->connect("gui_input", this, "_sbox_input");
|
search_box->connect_compat("gui_input", this, "_sbox_input");
|
||||||
search_options = memnew(Tree);
|
search_options = memnew(Tree);
|
||||||
vbc->add_margin_child(TTR("Matches:"), search_options, true);
|
vbc->add_margin_child(TTR("Matches:"), search_options, true);
|
||||||
get_ok()->set_text(TTR("Open"));
|
get_ok()->set_text(TTR("Open"));
|
||||||
get_ok()->set_disabled(true);
|
get_ok()->set_disabled(true);
|
||||||
register_text_enter(search_box);
|
register_text_enter(search_box);
|
||||||
set_hide_on_ok(false);
|
set_hide_on_ok(false);
|
||||||
search_options->connect("item_activated", this, "_confirmed");
|
search_options->connect_compat("item_activated", this, "_confirmed");
|
||||||
search_options->connect("cell_selected", this, "_item_selected");
|
search_options->connect_compat("cell_selected", this, "_item_selected");
|
||||||
search_options->set_hide_root(true);
|
search_options->set_hide_root(true);
|
||||||
search_options->set_hide_folding(true);
|
search_options->set_hide_folding(true);
|
||||||
virtuals_only = false;
|
virtuals_only = false;
|
||||||
seq_connect = false;
|
seq_connect = false;
|
||||||
help_bit = memnew(EditorHelpBit);
|
help_bit = memnew(EditorHelpBit);
|
||||||
vbc->add_margin_child(TTR("Description:"), help_bit);
|
vbc->add_margin_child(TTR("Description:"), help_bit);
|
||||||
help_bit->connect("request_hide", this, "_closed");
|
help_bit->connect_compat("request_hide", this, "_closed");
|
||||||
search_options->set_columns(3);
|
search_options->set_columns(3);
|
||||||
search_options->set_column_expand(1, false);
|
search_options->set_column_expand(1, false);
|
||||||
search_options->set_column_expand(2, false);
|
search_options->set_column_expand(2, false);
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public:
|
|||||||
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||||
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return false; }
|
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return false; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
if (p_start_mode == START_MODE_RESUME_YIELD) {
|
if (p_start_mode == START_MODE_RESUME_YIELD) {
|
||||||
return 0; //resuming yield
|
return 0; //resuming yield
|
||||||
@@ -109,7 +109,7 @@ public:
|
|||||||
SceneTree *tree = Object::cast_to<SceneTree>(OS::get_singleton()->get_main_loop());
|
SceneTree *tree = Object::cast_to<SceneTree>(OS::get_singleton()->get_main_loop());
|
||||||
if (!tree) {
|
if (!tree) {
|
||||||
r_error_str = "Main Loop is not SceneTree";
|
r_error_str = "Main Loop is not SceneTree";
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -509,7 +509,7 @@ public:
|
|||||||
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
|
||||||
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
if (p_start_mode == START_MODE_RESUME_YIELD) {
|
if (p_start_mode == START_MODE_RESUME_YIELD) {
|
||||||
return 0; //resuming yield
|
return 0; //resuming yield
|
||||||
@@ -529,14 +529,14 @@ public:
|
|||||||
|
|
||||||
Node *node = Object::cast_to<Node>(instance->get_owner_ptr());
|
Node *node = Object::cast_to<Node>(instance->get_owner_ptr());
|
||||||
if (!node) {
|
if (!node) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = "Base object is not a Node!";
|
r_error_str = "Base object is not a Node!";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node *another = node->get_node(node_path);
|
Node *another = node->get_node(node_path);
|
||||||
if (!another) {
|
if (!another) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = "Path does not lead Node!";
|
r_error_str = "Path does not lead Node!";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -548,7 +548,7 @@ public:
|
|||||||
|
|
||||||
object = *p_inputs[0];
|
object = *p_inputs[0];
|
||||||
if (!object) {
|
if (!object) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = "Supplied instance input is null.";
|
r_error_str = "Supplied instance input is null.";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user