mirror of
https://github.com/godotengine/godot.git
synced 2025-10-23 01:43:36 +00:00
Reworked signal connection system, added support for Callable and Signal objects and made them default.
This commit is contained in:
parent
1a4be2cd8f
commit
69c95f4b4c
275 changed files with 3831 additions and 2948 deletions
|
@ -788,7 +788,7 @@ public:
|
|||
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) {
|
||||
|
||||
|
@ -808,14 +808,14 @@ public:
|
|||
|
||||
Node *node = Object::cast_to<Node>(instance->get_owner_ptr());
|
||||
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!";
|
||||
return 0;
|
||||
}
|
||||
|
||||
Node *another = node->get_node(node_path);
|
||||
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!";
|
||||
return 0;
|
||||
}
|
||||
|
@ -846,7 +846,7 @@ public:
|
|||
} else if (returns == 1) {
|
||||
v.call(function, p_inputs + 1, input_args, r_error);
|
||||
} 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";
|
||||
return 0;
|
||||
}
|
||||
|
@ -866,7 +866,7 @@ public:
|
|||
|
||||
Object *object = Engine::get_singleton()->get_singleton_object(singleton);
|
||||
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) + "'";
|
||||
return 0;
|
||||
}
|
||||
|
@ -884,7 +884,7 @@ public:
|
|||
if (!validate) {
|
||||
|
||||
//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();
|
||||
}
|
||||
|
||||
|
@ -1020,7 +1020,7 @@ void VisualScriptPropertySet::_adjust_input_index(PropertyInfo &pinfo) const {
|
|||
if (index != StringName()) {
|
||||
|
||||
Variant v;
|
||||
Variant::CallError ce;
|
||||
Callable::CallError ce;
|
||||
v = Variant::construct(pinfo.type, NULL, 0, ce);
|
||||
Variant i = v.get(index);
|
||||
pinfo.type = i.get_type();
|
||||
|
@ -1167,7 +1167,7 @@ void VisualScriptPropertySet::_update_cache() {
|
|||
//not super efficient..
|
||||
|
||||
Variant v;
|
||||
Variant::CallError ce;
|
||||
Callable::CallError ce;
|
||||
v = Variant::construct(basic_type, NULL, 0, ce);
|
||||
|
||||
List<PropertyInfo> pinfo;
|
||||
|
@ -1409,7 +1409,7 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const {
|
|||
|
||||
if (property.name == "index") {
|
||||
|
||||
Variant::CallError ce;
|
||||
Callable::CallError ce;
|
||||
Variant v = Variant::construct(type_cache.type, NULL, 0, ce);
|
||||
List<PropertyInfo> 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) {
|
||||
|
||||
|
@ -1597,7 +1597,7 @@ public:
|
|||
}
|
||||
|
||||
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();
|
||||
}
|
||||
} break;
|
||||
|
@ -1605,14 +1605,14 @@ public:
|
|||
|
||||
Node *node = Object::cast_to<Node>(instance->get_owner_ptr());
|
||||
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!";
|
||||
return 0;
|
||||
}
|
||||
|
||||
Node *another = node->get_node(node_path);
|
||||
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!";
|
||||
return 0;
|
||||
}
|
||||
|
@ -1629,7 +1629,7 @@ public:
|
|||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -1651,7 +1651,7 @@ public:
|
|||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
|
@ -1875,7 +1875,7 @@ void VisualScriptPropertyGet::_update_cache() {
|
|||
//not super efficient..
|
||||
|
||||
Variant v;
|
||||
Variant::CallError ce;
|
||||
Callable::CallError ce;
|
||||
v = Variant::construct(basic_type, NULL, 0, ce);
|
||||
|
||||
List<PropertyInfo> pinfo;
|
||||
|
@ -2124,7 +2124,7 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const {
|
|||
|
||||
if (property.name == "index") {
|
||||
|
||||
Variant::CallError ce;
|
||||
Callable::CallError ce;
|
||||
Variant v = Variant::construct(type_cache, NULL, 0, ce);
|
||||
List<PropertyInfo> plist;
|
||||
v.get_property_list(&plist);
|
||||
|
@ -2211,7 +2211,7 @@ public:
|
|||
VisualScriptPropertyGet *node;
|
||||
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) {
|
||||
|
||||
|
@ -2228,7 +2228,7 @@ public:
|
|||
}
|
||||
|
||||
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.");
|
||||
return 0;
|
||||
}
|
||||
|
@ -2237,14 +2237,14 @@ public:
|
|||
|
||||
Node *node = Object::cast_to<Node>(instance->get_owner_ptr());
|
||||
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!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Node *another = node->get_node(node_path);
|
||||
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!");
|
||||
return 0;
|
||||
}
|
||||
|
@ -2258,7 +2258,7 @@ public:
|
|||
}
|
||||
|
||||
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());
|
||||
return 0;
|
||||
}
|
||||
|
@ -2275,7 +2275,7 @@ public:
|
|||
}
|
||||
|
||||
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.");
|
||||
}
|
||||
};
|
||||
|
@ -2434,7 +2434,7 @@ public:
|
|||
//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 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();
|
||||
|
||||
|
@ -2500,7 +2500,7 @@ void register_visual_script_func_nodes() {
|
|||
|
||||
Variant::Type t = Variant::Type(i);
|
||||
String type_name = Variant::get_type_name(t);
|
||||
Variant::CallError ce;
|
||||
Callable::CallError ce;
|
||||
Variant vt = Variant::construct(t, NULL, 0, ce);
|
||||
List<MethodInfo> ml;
|
||||
vt.get_method_list(&ml);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue