diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-02-20 11:30:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-20 11:30:56 +0100 |
commit | bd61281a5f515065b05be008dd3d6b73a03f5a7c (patch) | |
tree | 0add52fc270f808b4b2ad0bf7c970d72338c667e | |
parent | 1a4be2cd8fdd9ba26f016f3e2d83febfe8ae141c (diff) | |
parent | 69c95f4b4c128a22777af1e155bc24c7033decca (diff) |
Merge pull request #36368 from reduz/variant-rework
Reworked signal system, added support for Callable and Signal
275 files changed, 3832 insertions, 2949 deletions
diff --git a/core/array.cpp b/core/array.cpp index 2253d05605..7eb15ea934 100644 --- a/core/array.cpp +++ b/core/array.cpp @@ -308,9 +308,9 @@ struct _ArrayVariantSortCustom { _FORCE_INLINE_ bool operator()(const Variant &p_l, const Variant &p_r) const { const Variant *args[2] = { &p_l, &p_r }; - Variant::CallError err; + Callable::CallError err; bool res = obj->call(func, args, 2, err); - if (err.error != Variant::CallError::CALL_OK) + if (err.error != Callable::CallError::CALL_OK) res = false; return res; } diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 583a44846f..f5a351f16a 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -2620,29 +2620,29 @@ void _Thread::_start_func(void *ud) { Ref<_Thread> *tud = (Ref<_Thread> *)ud; Ref<_Thread> t = *tud; memdelete(tud); - Variant::CallError ce; + Callable::CallError ce; const Variant *arg[1] = { &t->userdata }; Thread::set_name(t->target_method); t->ret = t->target_instance->call(t->target_method, arg, 1, ce); - if (ce.error != Variant::CallError::CALL_OK) { + if (ce.error != Callable::CallError::CALL_OK) { String reason; switch (ce.error) { - case Variant::CallError::CALL_ERROR_INVALID_ARGUMENT: { + case Callable::CallError::CALL_ERROR_INVALID_ARGUMENT: { reason = "Invalid Argument #" + itos(ce.argument); } break; - case Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS: { + case Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS: { reason = "Too Many Arguments"; } break; - case Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS: { + case Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS: { reason = "Too Few Arguments"; } break; - case Variant::CallError::CALL_ERROR_INVALID_METHOD: { + case Callable::CallError::CALL_ERROR_INVALID_METHOD: { reason = "Method Not Found"; } break; diff --git a/core/callable.cpp b/core/callable.cpp new file mode 100644 index 0000000000..34b79cea10 --- /dev/null +++ b/core/callable.cpp @@ -0,0 +1,357 @@ +/*************************************************************************/ +/* callable.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "callable.h" +#include "core/script_language.h" +#include "message_queue.h" +#include "object.h" +#include "reference.h" + +void Callable::call_deferred(const Variant **p_arguments, int p_argcount) const { + MessageQueue::get_singleton()->push_callable(*this, p_arguments, p_argcount); +} + +void Callable::call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, CallError &r_call_error) const { + + if (is_null()) { + r_call_error.error = CallError::CALL_ERROR_INSTANCE_IS_NULL; + r_call_error.argument = 0; + r_call_error.expected = 0; + r_return_value = Variant(); + } else if (is_custom()) { + custom->call(p_arguments, p_argcount, r_return_value, r_call_error); + } else { + Object *obj = ObjectDB::get_instance(ObjectID(object)); + r_return_value = obj->call(method, p_arguments, p_argcount, r_call_error); + } +} + +Object *Callable::get_object() const { + if (is_null()) { + return nullptr; + } else if (is_custom()) { + return ObjectDB::get_instance(custom->get_object()); + } else { + return ObjectDB::get_instance(ObjectID(object)); + } +} + +ObjectID Callable::get_object_id() const { + if (is_null()) { + return ObjectID(); + } else if (is_custom()) { + return custom->get_object(); + } else { + return ObjectID(object); + } +} +StringName Callable::get_method() const { + ERR_FAIL_COND_V(is_custom(), StringName()); + return method; +} +uint32_t Callable::hash() const { + if (is_custom()) { + return custom->hash(); + } else { + uint32_t hash = method.hash(); + return hash_djb2_one_64(object, hash); + } +} + +bool Callable::operator==(const Callable &p_callable) const { + bool custom_a = is_custom(); + bool custom_b = p_callable.is_custom(); + + if (custom_a == custom_b) { + if (custom_a) { + if (custom == p_callable.custom) { + return true; //same pointer, dont even compare + } + + CallableCustom::CompareEqualFunc eq_a = custom->get_compare_equal_func(); + CallableCustom::CompareEqualFunc eq_b = p_callable.custom->get_compare_equal_func(); + if (eq_a == eq_b) { + return eq_a(custom, p_callable.custom); + } else { + return false; + } + } else { + return object == p_callable.object && method == p_callable.method; + } + } else { + return false; + } +} +bool Callable::operator!=(const Callable &p_callable) const { + return !(*this == p_callable); +} +bool Callable::operator<(const Callable &p_callable) const { + bool custom_a = is_custom(); + bool custom_b = p_callable.is_custom(); + + if (custom_a == custom_b) { + if (custom_a) { + if (custom == p_callable.custom) { + return false; //same pointer, dont even compare + } + + CallableCustom::CompareLessFunc less_a = custom->get_compare_less_func(); + CallableCustom::CompareLessFunc less_b = p_callable.custom->get_compare_less_func(); + if (less_a == less_b) { + return less_a(custom, p_callable.custom); + } else { + return less_a < less_b; //it's something.. + } + + } else { + if (object == p_callable.object) { + return method < p_callable.method; + } else { + return object < p_callable.object; + } + } + } else { + return int(custom_a ? 1 : 0) < int(custom_b ? 1 : 0); + } +} + +void Callable::operator=(const Callable &p_callable) { + if (is_custom()) { + if (p_callable.is_custom()) { + if (custom == p_callable.custom) { + return; + } + } + + if (custom->ref_count.unref()) { + memdelete(custom); + } + } + + if (p_callable.is_custom()) { + method = StringName(); + if (!p_callable.custom->ref_count.ref()) { + object = 0; + } else { + object = 0; + custom = p_callable.custom; + } + } else { + method = p_callable.method; + object = p_callable.object; + } +} + +Callable::operator String() const { + + if (is_custom()) { + return custom->get_as_text(); + } else { + if (is_null()) { + return "null::null"; + } + + Object *base = get_object(); + if (base) { + String class_name = base->get_class(); + Ref<Script> script = base->get_script(); + if (script.is_valid() && script->get_path().is_resource_file()) { + + class_name += "(" + script->get_path().get_file() + ")"; + } + return class_name + "::" + String(method); + } else { + return "null::" + String(method); + } + } +} + +Callable::Callable(const Object *p_object, const StringName &p_method) { + if (p_method == StringName()) { + object = 0; + ERR_FAIL_MSG("Method argument to Callable constructor must be a non-empty string"); + } + if (p_object == nullptr) { + object = 0; + ERR_FAIL_MSG("Object argument to Callable constructor must be non-null"); + } + + object = p_object->get_instance_id(); + method = p_method; +} + +Callable::Callable(ObjectID p_object, const StringName &p_method) { + if (p_method == StringName()) { + object = 0; + ERR_FAIL_MSG("Method argument to Callable constructor must be a non-empty string"); + } + + object = p_object; + method = p_method; +} +Callable::Callable(CallableCustom *p_custom) { + if (p_custom->referenced) { + object = 0; + ERR_FAIL_MSG("Callable custom is already referenced"); + } + p_custom->referenced = true; + object = 0; //ensure object is all zero, since pointer may be 32 bits + custom = p_custom; +} +Callable::Callable(const Callable &p_callable) { + if (p_callable.is_custom()) { + if (!p_callable.custom->ref_count.ref()) { + object = 0; + } else { + object = 0; + custom = p_callable.custom; + } + } else { + method = p_callable.method; + object = p_callable.object; + } +} + +Callable::~Callable() { + if (is_custom()) { + if (custom->ref_count.unref()) { + memdelete(custom); + } + } +} + +Callable::Callable() { + object = 0; +} + +CallableCustom::CallableCustom() { + referenced = false; + ref_count.init(); +} + +////////////////////////////////// + +Object *Signal::get_object() const { + return ObjectDB::get_instance(object); +} +ObjectID Signal::get_object_id() const { + return object; +} +StringName Signal::get_name() const { + return name; +} + +bool Signal::operator==(const Signal &p_signal) const { + return object == p_signal.object && name == p_signal.name; +} + +bool Signal::operator!=(const Signal &p_signal) const { + return object != p_signal.object || name != p_signal.name; +} + +bool Signal::operator<(const Signal &p_signal) const { + if (object == p_signal.object) { + return name < p_signal.name; + } else { + return object < p_signal.object; + } +} + +Signal::operator String() const { + Object *base = get_object(); + if (base) { + String class_name = base->get_class(); + Ref<Script> script = base->get_script(); + if (script.is_valid() && script->get_path().is_resource_file()) { + + class_name += "(" + script->get_path().get_file() + ")"; + } + return class_name + "::[signal]" + String(name); + } else { + return "null::[signal]" + String(name); + } +} + +Error Signal::emit(const Variant **p_arguments, int p_argcount) const { + Object *obj = ObjectDB::get_instance(object); + if (!obj) { + return ERR_INVALID_DATA; + } + + return obj->emit_signal(name, p_arguments, p_argcount); +} +Error Signal::connect(const Callable &p_callable, const Vector<Variant> &p_binds, uint32_t p_flags) { + + Object *object = get_object(); + ERR_FAIL_COND_V(!object, ERR_UNCONFIGURED); + + return object->connect(name, p_callable, p_binds, p_flags); +} +void Signal::disconnect(const Callable &p_callable) { + Object *object = get_object(); + ERR_FAIL_COND(!object); + object->disconnect(name, p_callable); +} +bool Signal::is_connected(const Callable &p_callable) const { + Object *object = get_object(); + ERR_FAIL_COND_V(!object, false); + + return object->is_connected(name, p_callable); +} + +Array Signal::get_connections() const { + Object *object = get_object(); + if (!object) { + return Array(); + } + + List<Object::Connection> connections; + object->get_signal_connection_list(name, &connections); + + Array arr; + for (List<Object::Connection>::Element *E = connections.front(); E; E = E->next()) { + arr.push_back(E->get()); + } + return arr; +} +Signal::Signal(const Object *p_object, const StringName &p_name) { + + ERR_FAIL_COND_MSG(p_object == nullptr, "Object argument to Signal constructor must be non-null"); + + object = p_object->get_instance_id(); + name = p_name; +} +Signal::Signal(ObjectID p_object, const StringName &p_name) { + + object = p_object; + name = p_name; +} +Signal::Signal() { +} diff --git a/core/callable.h b/core/callable.h new file mode 100644 index 0000000000..8ea5377ce8 --- /dev/null +++ b/core/callable.h @@ -0,0 +1,162 @@ +/*************************************************************************/ +/* callable.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef CALLABLE_H +#define CALLABLE_H + +#include "core/list.h" +#include "core/object_id.h" +#include "core/string_name.h" + +class Object; +class Variant; +class CallableCustom; + +// This is an abstraction of things that can be called +// it is used for signals and other cases where effient +// calling of functions is required. +// It is designed for the standard case (object and method) +// but can be optimized or customized. + +class Callable { + + //needs to be max 16 bytes in 64 bits + StringName method; + union { + uint64_t object; + CallableCustom *custom; + }; + +public: + struct CallError { + enum Error { + CALL_OK, + CALL_ERROR_INVALID_METHOD, + CALL_ERROR_INVALID_ARGUMENT, // expected is variant type + CALL_ERROR_TOO_MANY_ARGUMENTS, // expected is number of arguments + CALL_ERROR_TOO_FEW_ARGUMENTS, // expected is number of arguments + CALL_ERROR_INSTANCE_IS_NULL, + }; + Error error; + int argument; + int expected; + }; + + void call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, CallError &r_call_error) const; + void call_deferred(const Variant **p_arguments, int p_argcount) const; + + _FORCE_INLINE_ bool is_null() const { + return method == StringName() && object == 0; + } + _FORCE_INLINE_ bool is_custom() const { + return method == StringName() && custom != 0; + } + _FORCE_INLINE_ bool is_standard() const { + return method != StringName(); + } + + Object *get_object() const; + ObjectID get_object_id() const; + StringName get_method() const; + + uint32_t hash() const; + + bool operator==(const Callable &p_callable) const; + bool operator!=(const Callable &p_callable) const; + bool operator<(const Callable &p_callable) const; + + void operator=(const Callable &p_callable); + + operator String() const; + + Callable(const Object *p_object, const StringName &p_method); + Callable(ObjectID p_object, const StringName &p_method); + Callable(CallableCustom *p_custom); + Callable(const Callable &p_callable); + Callable(); + ~Callable(); +}; + +class CallableCustom { + friend class Callable; + SafeRefCount ref_count; + bool referenced; + +public: + typedef bool (*CompareEqualFunc)(const CallableCustom *p_a, const CallableCustom *p_b); + typedef bool (*CompareLessFunc)(const CallableCustom *p_a, const CallableCustom *p_b); + + //for every type that inherits, these must always be the same for this type + virtual uint32_t hash() const = 0; + virtual String get_as_text() const = 0; + virtual CompareEqualFunc get_compare_equal_func() const = 0; + virtual CompareLessFunc get_compare_less_func() const = 0; + virtual ObjectID get_object() const = 0; //must always be able to provide an object + virtual void call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const = 0; + + CallableCustom(); + virtual ~CallableCustom() {} +}; + +// This is just a proxy object to object signals, its only +// allocated on demand by/for scripting languages so it can +// be put inside a Variant, but it is not +// used by the engine itself. + +class Signal { + StringName name; + ObjectID object; + +public: + _FORCE_INLINE_ bool is_null() const { + return object.is_null() && name == StringName(); + } + Object *get_object() const; + ObjectID get_object_id() const; + StringName get_name() const; + + bool operator==(const Signal &p_signal) const; + bool operator!=(const Signal &p_signal) const; + bool operator<(const Signal &p_signal) const; + + operator String() const; + + Error emit(const Variant **p_arguments, int p_argcount) const; + Error connect(const Callable &p_callable, const Vector<Variant> &p_binds = Vector<Variant>(), uint32_t p_flags = 0); + void disconnect(const Callable &p_callable); + bool is_connected(const Callable &p_callable) const; + + Array get_connections() const; + Signal(const Object *p_object, const StringName &p_name); + Signal(ObjectID p_object, const StringName &p_name); + Signal(); +}; + +#endif // CALLABLE_H diff --git a/core/class_db.cpp b/core/class_db.cpp index a2941d70f6..35e216a58f 100644 --- a/core/class_db.cpp +++ b/core/class_db.cpp @@ -1033,7 +1033,7 @@ bool ClassDB::set_property(Object *p_object, const StringName &p_property, const return true; //return true but do nothing } - Variant::CallError ce; + Callable::CallError ce; if (psg->index >= 0) { Variant index = psg->index; @@ -1055,7 +1055,7 @@ bool ClassDB::set_property(Object *p_object, const StringName &p_property, const } if (r_valid) - *r_valid = ce.error == Variant::CallError::CALL_OK; + *r_valid = ce.error == Callable::CallError::CALL_OK; return true; } @@ -1078,12 +1078,12 @@ bool ClassDB::get_property(Object *p_object, const StringName &p_property, Varia if (psg->index >= 0) { Variant index = psg->index; const Variant *arg[1] = { &index }; - Variant::CallError ce; + Callable::CallError ce; r_value = p_object->call(psg->getter, arg, 1, ce); } else { - Variant::CallError ce; + Callable::CallError ce; if (psg->_getptr) { r_value = psg->_getptr->call(p_object, NULL, 0, ce); @@ -1094,13 +1094,23 @@ bool ClassDB::get_property(Object *p_object, const StringName &p_property, Varia return true; } - const int *c = check->constant_map.getptr(p_property); + const int *c = check->constant_map.getptr(p_property); //constants count if (c) { r_value = *c; return true; } + if (check->method_map.has(p_property)) { //methods count + r_value = Callable(p_object, p_property); + return true; + } + + if (check->signal_map.has(p_property)) { //signals count + r_value = Signal(p_object, p_property); + return true; + } + check = check->inherits_ptr; } diff --git a/core/core_string_names.cpp b/core/core_string_names.cpp index bafb800e41..253d5f1acb 100644 --- a/core/core_string_names.cpp +++ b/core/core_string_names.cpp @@ -70,5 +70,9 @@ CoreStringNames::CoreStringNames() : r8(StaticCString::create("r8")), g8(StaticCString::create("g8")), b8(StaticCString::create("b8")), - a8(StaticCString::create("a8")) { + a8(StaticCString::create("a8")), + call(StaticCString::create("call")), + call_deferred(StaticCString::create("call_deferred")), + emit(StaticCString::create("emit")), + notification(StaticCString::create("notification")) { } diff --git a/core/core_string_names.h b/core/core_string_names.h index a507a20935..42416d3f75 100644 --- a/core/core_string_names.h +++ b/core/core_string_names.h @@ -90,6 +90,11 @@ public: StringName g8; StringName b8; StringName a8; + + StringName call; + StringName call_deferred; + StringName emit; + StringName notification; }; #endif // SCENE_STRING_NAMES_H diff --git a/core/func_ref.cpp b/core/func_ref.cpp index e20188c813..338c17946b 100644 --- a/core/func_ref.cpp +++ b/core/func_ref.cpp @@ -30,16 +30,16 @@ #include "func_ref.h" -Variant FuncRef::call_func(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant FuncRef::call_func(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { if (id.is_null()) { - r_error.error = Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL; + r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL; return Variant(); } Object *obj = ObjectDB::get_instance(id); if (!obj) { - r_error.error = Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL; + r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL; return Variant(); } diff --git a/core/func_ref.h b/core/func_ref.h index 1d1ca47ad7..8cb3be6e61 100644 --- a/core/func_ref.h +++ b/core/func_ref.h @@ -43,7 +43,7 @@ protected: static void _bind_methods(); public: - Variant call_func(const Variant **p_args, int p_argcount, Variant::CallError &r_error); + Variant call_func(const Variant **p_args, int p_argcount, Callable::CallError &r_error); Variant call_funcv(const Array &p_args); void set_instance(Object *p_obj); void set_function(const StringName &p_func); diff --git a/core/global_constants.cpp b/core/global_constants.cpp index 94713b4ee6..b990ec9276 100644 --- a/core/global_constants.cpp +++ b/core/global_constants.cpp @@ -609,6 +609,8 @@ void register_global_constants() { BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_NODE_PATH", Variant::NODE_PATH); // 15 BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RID", Variant::_RID); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_OBJECT", Variant::OBJECT); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_CALLABLE", Variant::CALLABLE); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_SIGNAL", Variant::SIGNAL); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_DICTIONARY", Variant::DICTIONARY); // 20 BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_ARRAY", Variant::ARRAY); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RAW_ARRAY", Variant::PACKED_BYTE_ARRAY); diff --git a/core/io/dtls_server.cpp b/core/io/dtls_server.cpp index aa302ced8f..07e6abb1c9 100644 --- a/core/io/dtls_server.cpp +++ b/core/io/dtls_server.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/core/io/dtls_server.h b/core/io/dtls_server.h index ebef13da64..7b08138f7f 100644 --- a/core/io/dtls_server.h +++ b/core/io/dtls_server.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index 6548faac9f..ab88f4d85c 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -455,6 +455,15 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int } } break; + case Variant::CALLABLE: { + + r_variant = Callable(); + } break; + case Variant::SIGNAL: { + + r_variant = Signal(); + } break; + case Variant::DICTIONARY: { ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA); @@ -1075,6 +1084,12 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo case Variant::_RID: { } break; + case Variant::CALLABLE: { + + } break; + case Variant::SIGNAL: { + + } break; case Variant::OBJECT: { if (p_full_objects) { diff --git a/core/io/multiplayer_api.cpp b/core/io/multiplayer_api.cpp index abe629ecba..1fcd00c0e4 100644 --- a/core/io/multiplayer_api.cpp +++ b/core/io/multiplayer_api.cpp @@ -145,22 +145,22 @@ void MultiplayerAPI::set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_pee "Supplied NetworkedMultiplayerPeer must be connecting or connected."); if (network_peer.is_valid()) { - network_peer->disconnect("peer_connected", this, "_add_peer"); - network_peer->disconnect("peer_disconnected", this, "_del_peer"); - network_peer->disconnect("connection_succeeded", this, "_connected_to_server"); - network_peer->disconnect("connection_failed", this, "_connection_failed"); - network_peer->disconnect("server_disconnected", this, "_server_disconnected"); + network_peer->disconnect_compat("peer_connected", this, "_add_peer"); + network_peer->disconnect_compat("peer_disconnected", this, "_del_peer"); + network_peer->disconnect_compat("connection_succeeded", this, "_connected_to_server"); + network_peer->disconnect_compat("connection_failed", this, "_connection_failed"); + network_peer->disconnect_compat("server_disconnected", this, "_server_disconnected"); clear(); } network_peer = p_peer; if (network_peer.is_valid()) { - network_peer->connect("peer_connected", this, "_add_peer"); - network_peer->connect("peer_disconnected", this, "_del_peer"); - network_peer->connect("connection_succeeded", this, "_connected_to_server"); - network_peer->connect("connection_failed", this, "_connection_failed"); - network_peer->connect("server_disconnected", this, "_server_disconnected"); + network_peer->connect_compat("peer_connected", this, "_add_peer"); + network_peer->connect_compat("peer_disconnected", this, "_del_peer"); + network_peer->connect_compat("connection_succeeded", this, "_connected_to_server"); + network_peer->connect_compat("connection_failed", this, "_connection_failed"); + network_peer->connect_compat("server_disconnected", this, "_server_disconnected"); } } @@ -368,10 +368,10 @@ void MultiplayerAPI::_process_rpc(Node *p_node, const uint16_t p_rpc_method_id, p_offset += vlen; } - Variant::CallError ce; + Callable::CallError ce; p_node->call(name, (const Variant **)argp.ptr(), argc, ce); - if (ce.error != Variant::CallError::CALL_OK) { + if (ce.error != Callable::CallError::CALL_OK) { String error = Variant::get_call_error_text(p_node, name, (const Variant **)argp.ptr(), argc, ce); error = "RPC - " + error; ERR_PRINT(error); @@ -989,10 +989,10 @@ void MultiplayerAPI::rpcp(Node *p_node, int p_peer_id, bool p_unreliable, const if (call_local_native) { int temp_id = rpc_sender_id; rpc_sender_id = get_network_unique_id(); - Variant::CallError ce; + Callable::CallError ce; p_node->call(p_method, p_arg, p_argcount, ce); rpc_sender_id = temp_id; - if (ce.error != Variant::CallError::CALL_OK) { + if (ce.error != Callable::CallError::CALL_OK) { String error = Variant::get_call_error_text(p_node, p_method, p_arg, p_argcount, ce); error = "rpc() aborted in local call: - " + error + "."; ERR_PRINT(error); @@ -1003,11 +1003,11 @@ void MultiplayerAPI::rpcp(Node *p_node, int p_peer_id, bool p_unreliable, const if (call_local_script) { int temp_id = rpc_sender_id; rpc_sender_id = get_network_unique_id(); - Variant::CallError ce; - ce.error = Variant::CallError::CALL_OK; + Callable::CallError ce; + ce.error = Callable::CallError::CALL_OK; p_node->get_script_instance()->call(p_method, p_arg, p_argcount, ce); rpc_sender_id = temp_id; - if (ce.error != Variant::CallError::CALL_OK) { + if (ce.error != Callable::CallError::CALL_OK) { String error = Variant::get_call_error_text(p_node, p_method, p_arg, p_argcount, ce); error = "rpc() aborted in script local call: - " + error + "."; ERR_PRINT(error); diff --git a/core/io/packet_peer_dtls.cpp b/core/io/packet_peer_dtls.cpp index 64007c7e3b..01218a6881 100644 --- a/core/io/packet_peer_dtls.cpp +++ b/core/io/packet_peer_dtls.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/core/io/packet_peer_dtls.h b/core/io/packet_peer_dtls.h index b7cabb6ae0..4f9f4535bc 100644 --- a/core/io/packet_peer_dtls.h +++ b/core/io/packet_peer_dtls.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index d4c1fd2e9b..991853e86d 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -73,6 +73,8 @@ enum { VARIANT_VECTOR2_ARRAY = 37, VARIANT_INT64 = 40, VARIANT_DOUBLE = 41, + VARIANT_CALLABLE = 42, + VARIANT_SIGNAL = 43, OBJECT_EMPTY = 0, OBJECT_EXTERNAL_RESOURCE = 1, OBJECT_INTERNAL_RESOURCE = 2, @@ -363,6 +365,15 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { } } break; + case VARIANT_CALLABLE: { + + r_v = Callable(); + } break; + case VARIANT_SIGNAL: { + + r_v = Signal(); + } break; + case VARIANT_DICTIONARY: { uint32_t len = f->get_32(); @@ -1440,6 +1451,17 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia } } break; + case Variant::CALLABLE: { + + f->store_32(VARIANT_CALLABLE); + WARN_PRINT("Can't save Callables."); + } break; + case Variant::SIGNAL: { + + f->store_32(VARIANT_SIGNAL); + WARN_PRINT("Can't save Signals."); + } break; + case Variant::DICTIONARY: { f->store_32(VARIANT_DICTIONARY); diff --git a/core/io/udp_server.cpp b/core/io/udp_server.cpp index f041bf097f..16b7863cdd 100644 --- a/core/io/udp_server.cpp +++ b/core/io/udp_server.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/core/io/udp_server.h b/core/io/udp_server.h index 5182a04246..90bb82b62b 100644 --- a/core/io/udp_server.h +++ b/core/io/udp_server.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/core/make_binders.py b/core/make_binders.py index 11cfbf6e79..c42b91fbe5 100644 --- a/core/make_binders.py +++ b/core/make_binders.py @@ -32,22 +32,22 @@ public: return T::get_class_static(); } - virtual Variant call(Object* p_object,const Variant** p_args,int p_arg_count, Variant::CallError& r_error) { + virtual Variant call(Object* p_object,const Variant** p_args,int p_arg_count, Callable::CallError& r_error) { T *instance=Object::cast_to<T>(p_object); - r_error.error=Variant::CallError::CALL_OK; + r_error.error=Callable::CallError::CALL_OK; #ifdef DEBUG_METHODS_ENABLED ERR_FAIL_COND_V(!instance,Variant()); if (p_arg_count>get_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=get_argument_count(); return Variant(); } if (p_arg_count<(get_argument_count()-get_default_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=get_argument_count()-get_default_argument_count(); return Variant(); } @@ -126,23 +126,23 @@ public: return type_name; } - virtual Variant call(Object* p_object,const Variant** p_args,int p_arg_count, Variant::CallError& r_error) { + virtual Variant call(Object* p_object,const Variant** p_args,int p_arg_count, Callable::CallError& r_error) { __UnexistingClass *instance = (__UnexistingClass*)p_object; - r_error.error=Variant::CallError::CALL_OK; + r_error.error=Callable::CallError::CALL_OK; #ifdef DEBUG_METHODS_ENABLED ERR_FAIL_COND_V(!instance,Variant()); if (p_arg_count>get_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=get_argument_count(); return Variant(); } if (p_arg_count<(get_argument_count()-get_default_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=get_argument_count()-get_default_argument_count(); return Variant(); } @@ -223,22 +223,22 @@ public: return T::get_class_static(); } - virtual Variant call(Object* p_object,const Variant** p_args,int p_arg_count, Variant::CallError& r_error) { + virtual Variant call(Object* p_object,const Variant** p_args,int p_arg_count, Callable::CallError& r_error) { T *instance=Object::cast_to<T>(p_object); - r_error.error=Variant::CallError::CALL_OK; + r_error.error=Callable::CallError::CALL_OK; #ifdef DEBUG_METHODS_ENABLED ERR_FAIL_COND_V(!instance,Variant()); if (p_arg_count>get_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=get_argument_count(); return Variant(); } if (p_arg_count<(get_argument_count()-get_default_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=get_argument_count()-get_default_argument_count(); return Variant(); } diff --git a/core/math/expression.cpp b/core/math/expression.cpp index c7229ef688..1130935567 100644 --- a/core/math/expression.cpp +++ b/core/math/expression.cpp @@ -208,16 +208,16 @@ int Expression::get_func_argument_count(BuiltinFunc p_func) { return 0; } -#define VALIDATE_ARG_NUM(m_arg) \ - if (!p_inputs[m_arg]->is_num()) { \ - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; \ - r_error.argument = m_arg; \ - r_error.expected = Variant::REAL; \ - return; \ +#define VALIDATE_ARG_NUM(m_arg) \ + if (!p_inputs[m_arg]->is_num()) { \ + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; \ + r_error.argument = m_arg; \ + r_error.expected = Variant::REAL; \ + return; \ } -void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant *r_return, Variant::CallError &r_error, String &r_error_str) { - r_error.error = Variant::CallError::CALL_OK; +void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant *r_return, Callable::CallError &r_error, String &r_error_str) { + r_error.error = Callable::CallError::CALL_OK; switch (p_func) { case MATH_SIN: { @@ -320,7 +320,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant *r_return = Math::abs(r); } 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.expected = Variant::REAL; } @@ -337,7 +337,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant *r_return = r < 0.0 ? -1.0 : (r > 0.0 ? +1.0 : 0.0); } 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.expected = Variant::REAL; } @@ -580,7 +580,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant 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.expected = Variant::OBJECT; @@ -614,7 +614,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant 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.expected = Variant::OBJECT; @@ -622,7 +622,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant } 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.expected = Variant::STRING; @@ -644,7 +644,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant if (type < 0 || type >= Variant::VARIANT_MAX) { 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.expected = Variant::INT; return; @@ -675,7 +675,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant 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.expected = Variant::STRING; @@ -687,7 +687,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant if (str.length() != 1) { r_error_str = RTR("Expected a string of length 1 (a character)."); - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; r_error.expected = Variant::STRING; @@ -732,7 +732,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant case STR_TO_VAR: { 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.expected = Variant::STRING; @@ -747,7 +747,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant Error err = VariantParser::parse(&ss, *r_return, errs, line); 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.expected = Variant::STRING; *r_return = "Parse error at line " + itos(line) + ": " + errs; @@ -762,7 +762,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant int len; Error err = encode_variant(*p_inputs[0], NULL, len, full_objects); 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.expected = Variant::NIL; r_error_str = "Unexpected error encoding variable to bytes, likely unserializable type found (Object or RID)."; @@ -779,7 +779,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant case BYTES_TO_VAR: { 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.expected = Variant::PACKED_BYTE_ARRAY; @@ -794,7 +794,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant Error err = decode_variant(ret, r, varr.size(), NULL, allow_objects); if (err != OK) { 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.expected = Variant::PACKED_BYTE_ARRAY; return; @@ -2071,10 +2071,10 @@ bool Expression::_execute(const Array &p_inputs, Object *p_instance, Expression: argp.write[i] = &arr[i]; } - Variant::CallError ce; + Callable::CallError 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 = vformat(RTR("Invalid arguments to construct '%s'"), Variant::get_type_name(constructor->data_type)); return true; } @@ -2099,10 +2099,10 @@ bool Expression::_execute(const Array &p_inputs, Object *p_instance, Expression: argp.write[i] = &arr[i]; } - Variant::CallError ce; + Callable::CallError ce; 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; return true; } @@ -2134,10 +2134,10 @@ bool Expression::_execute(const Array &p_inputs, Object *p_instance, Expression: argp.write[i] = &arr[i]; } - Variant::CallError ce; + Callable::CallError 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 = vformat(RTR("On call to '%s':"), String(call->method)); return true; } diff --git a/core/math/expression.h b/core/math/expression.h index 1cd1415dcf..bbf946bb0a 100644 --- a/core/math/expression.h +++ b/core/math/expression.h @@ -111,7 +111,7 @@ public: static int get_func_argument_count(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); private: diff --git a/core/message_queue.cpp b/core/message_queue.cpp index 42390935d4..235003627e 100644 --- a/core/message_queue.cpp +++ b/core/message_queue.cpp @@ -30,6 +30,7 @@ #include "message_queue.h" +#include "core/core_string_names.h" #include "core/project_settings.h" #include "core/script_language.h" @@ -42,37 +43,7 @@ MessageQueue *MessageQueue::get_singleton() { Error MessageQueue::push_call(ObjectID p_id, const StringName &p_method, const Variant **p_args, int p_argcount, bool p_show_error) { - _THREAD_SAFE_METHOD_ - - int room_needed = sizeof(Message) + sizeof(Variant) * p_argcount; - - if ((buffer_end + room_needed) >= buffer_size) { - String type; - if (ObjectDB::get_instance(p_id)) - type = ObjectDB::get_instance(p_id)->get_class(); - print_line("Failed method: " + type + ":" + p_method + " target ID: " + itos(p_id)); - statistics(); - ERR_FAIL_V_MSG(ERR_OUT_OF_MEMORY, "Message queue out of memory. Try increasing 'memory/limits/message_queue/max_size_kb' in project settings."); - } - - Message *msg = memnew_placement(&buffer[buffer_end], Message); - msg->args = p_argcount; - msg->instance_id = p_id; - msg->target = p_method; - msg->type = TYPE_CALL; - if (p_show_error) - msg->type |= FLAG_SHOW_ERROR; - - buffer_end += sizeof(Message); - - for (int i = 0; i < p_argcount; i++) { - - Variant *v = memnew_placement(&buffer[buffer_end], Variant); - buffer_end += sizeof(Variant); - *v = *p_args[i]; - } - - return OK; + return push_callable(Callable(p_id, p_method), p_args, p_argcount, p_show_error); } Error MessageQueue::push_call(ObjectID p_id, const StringName &p_method, VARIANT_ARG_DECLARE) { @@ -107,8 +78,7 @@ Error MessageQueue::push_set(ObjectID p_id, const StringName &p_prop, const Vari Message *msg = memnew_placement(&buffer[buffer_end], Message); msg->args = 1; - msg->instance_id = p_id; - msg->target = p_prop; + msg->callable = Callable(p_id, p_prop); msg->type = TYPE_SET; buffer_end += sizeof(Message); @@ -137,7 +107,7 @@ Error MessageQueue::push_notification(ObjectID p_id, int p_notification) { Message *msg = memnew_placement(&buffer[buffer_end], Message); msg->type = TYPE_NOTIFICATION; - msg->instance_id = p_id; + msg->callable = Callable(p_id, CoreStringNames::get_singleton()->notification); //name is meaningless but callable needs it //msg->target; msg->notification = p_notification; @@ -160,18 +130,49 @@ Error MessageQueue::push_set(Object *p_object, const StringName &p_prop, const V return push_set(p_object->get_instance_id(), p_prop, p_value); } +Error MessageQueue::push_callable(const Callable &p_callable, const Variant **p_args, int p_argcount, bool p_show_error) { + + _THREAD_SAFE_METHOD_ + + int room_needed = sizeof(Message) + sizeof(Variant) * p_argcount; + + if ((buffer_end + room_needed) >= buffer_size) { + print_line("Failed method: " + p_callable); + statistics(); + ERR_FAIL_V_MSG(ERR_OUT_OF_MEMORY, "Message queue out of memory. Try increasing 'memory/limits/message_queue/max_size_kb' in project settings."); + } + + Message *msg = memnew_placement(&buffer[buffer_end], Message); + msg->args = p_argcount; + msg->callable = p_callable; + msg->type = TYPE_CALL; + if (p_show_error) + msg->type |= FLAG_SHOW_ERROR; + + buffer_end += sizeof(Message); + + for (int i = 0; i < p_argcount; i++) { + + Variant *v = memnew_placement(&buffer[buffer_end], Variant); + buffer_end += sizeof(Variant); + *v = *p_args[i]; + } + + return OK; +} + void MessageQueue::statistics() { Map<StringName, int> set_count; Map<int, int> notify_count; - Map<StringName, int> call_count; + Map<Callable, int> call_count; int null_count = 0; uint32_t read_pos = 0; while (read_pos < buffer_end) { Message *message = (Message *)&buffer[read_pos]; - Object *target = ObjectDB::get_instance(message->instance_id); + Object *target = message->callable.get_object(); if (target != NULL) { @@ -179,10 +180,10 @@ void MessageQueue::statistics() { case TYPE_CALL: { - if (!call_count.has(message->target)) - call_count[message->target] = 0; + if (!call_count.has(message->callable)) + call_count[message->callable] = 0; - call_count[message->target]++; + call_count[message->callable]++; } break; case TYPE_NOTIFICATION: { @@ -195,10 +196,11 @@ void MessageQueue::statistics() { } break; case TYPE_SET: { - if (!set_count.has(message->target)) - set_count[message->target] = 0; + StringName t = message->callable.get_method(); + if (!set_count.has(t)) + set_count[t] = 0; - set_count[message->target]++; + set_count[t]++; } break; } @@ -222,7 +224,7 @@ void MessageQueue::statistics() { print_line("SET " + E->key() + ": " + itos(E->get())); } - for (Map<StringName, int>::Element *E = call_count.front(); E; E = E->next()) { + for (Map<Callable, int>::Element *E = call_count.front(); E; E = E->next()) { print_line("CALL " + E->key() + ": " + itos(E->get())); } @@ -236,7 +238,7 @@ int MessageQueue::get_max_buffer_usage() const { return buffer_max_used; } -void MessageQueue::_call_function(Object *p_target, const StringName &p_func, const Variant *p_args, int p_argcount, bool p_show_error) { +void MessageQueue::_call_function(const Callable &p_callable, const Variant *p_args, int p_argcount, bool p_show_error) { const Variant **argptrs = NULL; if (p_argcount) { @@ -246,11 +248,12 @@ void MessageQueue::_call_function(Object *p_target, const StringName &p_func, co } } - Variant::CallError ce; - p_target->call(p_func, argptrs, p_argcount, ce); - if (p_show_error && ce.error != Variant::CallError::CALL_OK) { + Callable::CallError ce; + Variant ret; + p_callable.call(argptrs, p_argcount, ret, ce); + if (p_show_error && ce.error != Callable::CallError::CALL_OK) { - ERR_PRINT("Error calling deferred method: " + Variant::get_call_error_text(p_target, p_func, argptrs, p_argcount, ce) + "."); + ERR_PRINT("Error calling deferred method: " + Variant::get_callable_error_text(p_callable, argptrs, p_argcount, ce) + "."); } } @@ -283,7 +286,7 @@ void MessageQueue::flush() { _THREAD_SAFE_UNLOCK_ - Object *target = ObjectDB::get_instance(message->instance_id); + Object *target = message->callable.get_object(); if (target != NULL) { @@ -294,7 +297,7 @@ void MessageQueue::flush() { // messages don't expect a return value - _call_function(target, message->target, args, message->args, message->type & FLAG_SHOW_ERROR); + _call_function(message->callable, args, message->args, message->type & FLAG_SHOW_ERROR); } break; case TYPE_NOTIFICATION: { @@ -307,7 +310,7 @@ void MessageQueue::flush() { Variant *arg = (Variant *)(message + 1); // messages don't expect a return value - target->set(message->target, *arg); + target->set(message->callable.get_method(), *arg); } break; } diff --git a/core/message_queue.h b/core/message_queue.h index e9a92ff5b7..9ba748bb42 100644 --- a/core/message_queue.h +++ b/core/message_queue.h @@ -54,8 +54,7 @@ class MessageQueue { struct Message { - ObjectID instance_id; - StringName target; + Callable callable; int16_t type; union { int16_t notification; @@ -68,7 +67,7 @@ class MessageQueue { uint32_t buffer_max_used; uint32_t buffer_size; - void _call_function(Object *p_target, const StringName &p_func, const Variant *p_args, int p_argcount, bool p_show_error); + void _call_function(const Callable &p_callable, const Variant *p_args, int p_argcount, bool p_show_error); static MessageQueue *singleton; @@ -81,6 +80,7 @@ public: Error push_call(ObjectID p_id, const StringName &p_method, VARIANT_ARG_LIST); Error push_notification(ObjectID p_id, int p_notification); Error push_set(ObjectID p_id, const StringName &p_prop, const Variant &p_value); + Error push_callable(const Callable &p_callable, const Variant **p_args, int p_argcount, bool p_show_error = false); Error push_call(Object *p_object, const StringName &p_method, VARIANT_ARG_LIST); Error push_notification(Object *p_object, int p_notification); diff --git a/core/method_bind.h b/core/method_bind.h index 1860d227f7..72be141fd3 100644 --- a/core/method_bind.h +++ b/core/method_bind.h @@ -155,7 +155,7 @@ struct VariantObjectClassChecker<Control *> { Variant::Type argtype = get_argument_type(m_arg - 1); \ if (!Variant::can_convert_strict(p_args[m_arg - 1]->get_type(), argtype) || \ !VariantObjectClassChecker<P##m_arg>::check(*p_args[m_arg - 1])) { \ - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; \ + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; \ r_error.argument = m_arg - 1; \ r_error.expected = argtype; \ return Variant(); \ @@ -278,7 +278,7 @@ public: _FORCE_INLINE_ int get_argument_count() const { return argument_count; }; - virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Variant::CallError &r_error) = 0; + virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) = 0; #ifdef PTRCALL_ENABLED virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) = 0; @@ -300,7 +300,7 @@ public: template <class T> class MethodBindVarArg : public MethodBind { public: - typedef Variant (T::*NativeCall)(const Variant **, int, Variant::CallError &); + typedef Variant (T::*NativeCall)(const Variant **, int, Callable::CallError &); protected: NativeCall call_method; @@ -338,7 +338,7 @@ public: } #endif - virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Variant::CallError &r_error) { + virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) { T *instance = static_cast<T *>(p_object); return (instance->*call_method)(p_args, p_arg_count, r_error); @@ -389,7 +389,7 @@ public: }; template <class T> -MethodBind *create_vararg_method_bind(Variant (T::*p_method)(const Variant **, int, Variant::CallError &), const MethodInfo &p_info, bool p_return_nil_is_variant) { +MethodBind *create_vararg_method_bind(Variant (T::*p_method)(const Variant **, int, Callable::CallError &), const MethodInfo &p_info, bool p_return_nil_is_variant) { MethodBindVarArg<T> *a = memnew((MethodBindVarArg<T>)); a->set_method(p_method); diff --git a/core/method_ptrcall.h b/core/method_ptrcall.h index 6ccf41229f..42d71dea46 100644 --- a/core/method_ptrcall.h +++ b/core/method_ptrcall.h @@ -128,6 +128,8 @@ MAKE_PTRARG_BY_REFERENCE(Color); MAKE_PTRARG(NodePath); MAKE_PTRARG(RID); MAKE_PTRARG(Dictionary); +MAKE_PTRARG(Callable); +MAKE_PTRARG(Signal); MAKE_PTRARG(Array); MAKE_PTRARG(PackedByteArray); MAKE_PTRARG(PackedIntArray); diff --git a/core/object.cpp b/core/object.cpp index f0b708f047..d5db383cbc 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -335,10 +335,8 @@ MethodInfo::MethodInfo(const PropertyInfo &p_ret, const String &p_name, const Pr Object::Connection::operator Variant() const { Dictionary d; - d["source"] = source; d["signal"] = signal; - d["target"] = target; - d["method"] = method; + d["callable"] = callable; d["flags"] = flags; d["binds"] = binds; return d; @@ -346,34 +344,19 @@ Object::Connection::operator Variant() const { bool Object::Connection::operator<(const Connection &p_conn) const { - if (source == p_conn.source) { - - if (signal == p_conn.signal) { - - if (target == p_conn.target) { - - return method < p_conn.method; - } else { - - return target < p_conn.target; - } - } else - return signal < p_conn.signal; + if (signal == p_conn.signal) { + return callable < p_conn.callable; } else { - return source < p_conn.source; + return signal < p_conn.signal; } } Object::Connection::Connection(const Variant &p_variant) { Dictionary d = p_variant; - if (d.has("source")) - source = d["source"]; if (d.has("signal")) signal = d["signal"]; - if (d.has("target")) - target = d["target"]; - if (d.has("method")) - method = d["method"]; + if (d.has("callable")) + callable = d["callable"]; if (d.has("flags")) flags = d["flags"]; if (d.has("binds")) @@ -655,16 +638,16 @@ void Object::get_method_list(List<MethodInfo> *p_list) const { } } -Variant Object::_call_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant Object::_call_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { if (p_argcount < 1) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; r_error.argument = 0; return Variant(); } if (p_args[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.expected = Variant::STRING; return Variant(); @@ -675,22 +658,22 @@ Variant Object::_call_bind(const Variant **p_args, int p_argcount, Variant::Call return call(method, &p_args[1], p_argcount - 1, r_error); } -Variant Object::_call_deferred_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant Object::_call_deferred_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { if (p_argcount < 1) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; r_error.argument = 0; return Variant(); } if (p_args[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.expected = Variant::STRING; return Variant(); } - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; StringName method = *p_args[0]; @@ -700,29 +683,29 @@ Variant Object::_call_deferred_bind(const Variant **p_args, int p_argcount, Vari } #ifdef DEBUG_ENABLED -static void _test_call_error(const StringName &p_func, const Variant::CallError &error) { +static void _test_call_error(const StringName &p_func, const Callable::CallError &error) { switch (error.error) { - case Variant::CallError::CALL_OK: - case Variant::CallError::CALL_ERROR_INVALID_METHOD: + case Callable::CallError::CALL_OK: + case Callable::CallError::CALL_ERROR_INVALID_METHOD: break; - case Variant::CallError::CALL_ERROR_INVALID_ARGUMENT: { + case Callable::CallError::CALL_ERROR_INVALID_ARGUMENT: { - ERR_FAIL_MSG("Error calling function: " + String(p_func) + " - Invalid type for argument " + itos(error.argument) + ", expected " + Variant::get_type_name(error.expected) + "."); + ERR_FAIL_MSG("Error calling function: " + String(p_func) + " - Invalid type for argument " + itos(error.argument) + ", expected " + Variant::get_type_name(Variant::Type(error.expected)) + "."); break; } - case Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS: { + case Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS: { ERR_FAIL_MSG("Error calling function: " + String(p_func) + " - Too many arguments, expected " + itos(error.argument) + "."); break; } - case Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS: { + case Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS: { ERR_FAIL_MSG("Error calling function: " + String(p_func) + " - Too few arguments, expected " + itos(error.argument) + "."); break; } - case Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL: + case Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL: break; } } @@ -749,7 +732,7 @@ void Object::call_multilevel(const StringName &p_method, const Variant **p_args, //Variant ret; OBJ_DEBUG_LOCK - Variant::CallError error; + Callable::CallError error; if (script_instance) { script_instance->call_multilevel(p_method, p_args, p_argcount); @@ -769,7 +752,7 @@ void Object::call_multilevel_reversed(const StringName &p_method, const Variant MethodBind *method = ClassDB::get_method(get_class_name(), p_method); - Variant::CallError error; + Callable::CallError error; OBJ_DEBUG_LOCK if (method) { @@ -823,9 +806,9 @@ Variant Object::callv(const StringName &p_method, const Array &p_args) { } } - Variant::CallError ce; + Callable::CallError ce; Variant ret = call(p_method, argptrs, p_args.size(), ce); - if (ce.error != Variant::CallError::CALL_OK) { + if (ce.error != Callable::CallError::CALL_OK) { ERR_FAIL_V_MSG(Variant(), "Error calling method from 'callv': " + Variant::get_call_error_text(this, p_method, argptrs, p_args.size(), ce) + "."); } return ret; @@ -842,7 +825,7 @@ Variant Object::call(const StringName &p_name, VARIANT_ARG_DECLARE) { argc++; } - Variant::CallError error; + Callable::CallError error; Variant ret = call(p_name, argptr, argc, error); return ret; @@ -859,38 +842,38 @@ void Object::call_multilevel(const StringName &p_name, VARIANT_ARG_DECLARE) { argc++; } - //Variant::CallError error; + //Callable::CallError error; call_multilevel(p_name, argptr, argc); } -Variant Object::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant Object::call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; if (p_method == CoreStringNames::get_singleton()->_free) { //free must be here, before anything, always ready #ifdef DEBUG_ENABLED if (p_argcount != 0) { r_error.argument = 0; - r_error.error = Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; return Variant(); } if (Object::cast_to<Reference>(this)) { r_error.argument = 0; - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; ERR_FAIL_V_MSG(Variant(), "Can't 'free' a reference."); } if (_lock_index.get() > 1) { r_error.argument = 0; - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; ERR_FAIL_V_MSG(Variant(), "Object is locked and can't be freed."); } #endif //must be here, must be before everything, memdelete(this); - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; return Variant(); } @@ -901,15 +884,15 @@ Variant Object::call(const StringName &p_method, const Variant **p_args, int p_a //force jumptable switch (r_error.error) { - case Variant::CallError::CALL_OK: + case Callable::CallError::CALL_OK: return ret; - case Variant::CallError::CALL_ERROR_INVALID_METHOD: + case Callable::CallError::CALL_ERROR_INVALID_METHOD: break; - case Variant::CallError::CALL_ERROR_INVALID_ARGUMENT: - case Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS: - case Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS: + case Callable::CallError::CALL_ERROR_INVALID_ARGUMENT: + case Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS: + case Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS: return ret; - case Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL: { + case Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL: { } } } @@ -919,7 +902,7 @@ Variant Object::call(const StringName &p_method, const Variant **p_args, int p_a if (method) { ret = method->call(this, p_args, p_argcount, r_error); } else { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; } return ret; @@ -1102,7 +1085,7 @@ void Object::add_user_signal(const MethodInfo &p_signal) { ERR_FAIL_COND_MSG(p_signal.name == "", "Signal name cannot be empty."); ERR_FAIL_COND_MSG(ClassDB::has_signal(get_class_name(), p_signal.name), "User signal's name conflicts with a built-in signal of '" + get_class_name() + "'."); ERR_FAIL_COND_MSG(signal_map.has(p_signal.name), "Trying to add already existing signal '" + p_signal.name + "'."); - Signal s; + SignalData s; s.user = p_signal; signal_map[p_signal.name] = s; } @@ -1117,23 +1100,22 @@ bool Object::_has_user_signal(const StringName &p_name) const { struct _ObjectSignalDisconnectData { StringName signal; - Object *target; - StringName method; + Callable callable; }; -Variant Object::_emit_signal(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant Object::_emit_signal(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; ERR_FAIL_COND_V(p_argcount < 1, Variant()); if (p_args[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.expected = Variant::STRING; ERR_FAIL_COND_V(p_args[0]->get_type() != Variant::STRING, Variant()); } - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; StringName signal = *p_args[0]; @@ -1154,7 +1136,7 @@ Error Object::emit_signal(const StringName &p_name, const Variant **p_args, int if (_block_signals) return ERR_CANT_ACQUIRE_RESOURCE; //no emit, signals blocked - Signal *s = signal_map.getptr(p_name); + SignalData *s = signal_map.getptr(p_name); if (!s) { #ifdef DEBUG_ENABLED bool signal_is_valid = ClassDB::has_signal(get_class_name(), p_name); @@ -1170,7 +1152,7 @@ Error Object::emit_signal(const StringName &p_name, const Variant **p_args, int //copy on write will ensure that disconnecting the signal or even deleting the object will not affect the signal calling. //this happens automatically and will not change the performance of calling. //awesome, isn't it? - VMap<Signal::Target, Signal::Slot> slot_map = s->slot_map; + VMap<Callable, SignalData::Slot> slot_map = s->slot_map; int ssize = slot_map.size(); @@ -1184,7 +1166,7 @@ Error Object::emit_signal(const StringName &p_name, const Variant **p_args, int const Connection &c = slot_map.getv(i).conn; - Object *target = ObjectDB::get_instance(slot_map.getk(i)._id); + Object *target = c.callable.get_object(); if (!target) { // Target might have been deleted during signal callback, this is expected and OK. continue; @@ -1209,22 +1191,23 @@ Error Object::emit_signal(const StringName &p_name, const Variant **p_args, int } if (c.flags & CONNECT_DEFERRED) { - MessageQueue::get_singleton()->push_call(target->get_instance_id(), c.method, args, argc, true); + MessageQueue::get_singleton()->push_callable(c.callable, args, argc, true); } else { - Variant::CallError ce; + Callable::CallError ce; _emitting = true; - target->call(c.method, args, argc, ce); + Variant ret; + c.callable.call(args, argc, ret, ce); _emitting = false; - if (ce.error != Variant::CallError::CALL_OK) { + if (ce.error != Callable::CallError::CALL_OK) { #ifdef DEBUG_ENABLED if (c.flags & CONNECT_PERSIST && Engine::get_singleton()->is_editor_hint() && (script.is_null() || !Ref<Script>(script)->is_tool())) continue; #endif - if (ce.error == Variant::CallError::CALL_ERROR_INVALID_METHOD && !ClassDB::class_exists(target->get_class_name())) { + if (ce.error == Callable::CallError::CALL_ERROR_INVALID_METHOD && !ClassDB::class_exists(target->get_class_name())) { //most likely object is not initialized yet, do not throw error. } else { - ERR_PRINT("Error calling method from signal '" + String(p_name) + "': " + Variant::get_call_error_text(target, c.method, args, argc, ce) + "."); + ERR_PRINT("Error calling from signal '" + String(p_name) + "': " + Variant::get_callable_error_text(c.callable, args, argc, ce) + "."); err = ERR_METHOD_NOT_FOUND; } } @@ -1241,8 +1224,7 @@ Error Object::emit_signal(const StringName &p_name, const Variant **p_args, int _ObjectSignalDisconnectData dd; dd.signal = p_name; - dd.target = target; - dd.method = c.method; + dd.callable = c.callable; disconnect_data.push_back(dd); } } @@ -1250,7 +1232,8 @@ Error Object::emit_signal(const StringName &p_name, const Variant **p_args, int while (!disconnect_data.empty()) { const _ObjectSignalDisconnectData &dd = disconnect_data.front()->get(); - disconnect(dd.signal, dd.target, dd.method); + + _disconnect(dd.signal, dd.callable); disconnect_data.pop_front(); } @@ -1322,15 +1305,8 @@ Array Object::_get_signal_connection_list(const String &p_signal) const { for (List<Connection>::Element *E = conns.front(); E; E = E->next()) { Connection &c = E->get(); - if (c.signal == p_signal) { - Dictionary rc; - rc["signal"] = c.signal; - rc["method"] = c.method; - rc["source"] = c.source; - rc["target"] = c.target; - rc["binds"] = c.binds; - rc["flags"] = c.flags; - ret.push_back(rc); + if (c.signal.get_name() == p_signal) { + ret.push_back(c); } } @@ -1342,11 +1318,7 @@ Array Object::_get_incoming_connections() const { Array ret; int connections_amount = connections.size(); for (int idx_conn = 0; idx_conn < connections_amount; idx_conn++) { - Dictionary conn_data; - conn_data["source"] = connections[idx_conn].source; - conn_data["signal_name"] = connections[idx_conn].signal; - conn_data["method_name"] = connections[idx_conn].method; - ret.push_back(conn_data); + ret.push_back(connections[idx_conn]); } return ret; @@ -1380,7 +1352,7 @@ void Object::get_all_signal_connections(List<Connection> *p_connections) const { while ((S = signal_map.next(S))) { - const Signal *s = &signal_map[*S]; + const SignalData *s = &signal_map[*S]; for (int i = 0; i < s->slot_map.size(); i++) { @@ -1391,7 +1363,7 @@ void Object::get_all_signal_connections(List<Connection> *p_connections) const { void Object::get_signal_connection_list(const StringName &p_signal, List<Connection> *p_connections) const { - const Signal *s = signal_map.getptr(p_signal); + const SignalData *s = signal_map.getptr(p_signal); if (!s) return; //nothing @@ -1406,7 +1378,7 @@ int Object::get_persistent_signal_connection_count() const { while ((S = signal_map.next(S))) { - const Signal *s = &signal_map[*S]; + const SignalData *s = &signal_map[*S]; for (int i = 0; i < s->slot_map.size(); i++) { if (s->slot_map.getv(i).conn.flags & CONNECT_PERSIST) { @@ -1425,11 +1397,15 @@ void Object::get_signals_connected_to_this(List<Connection> *p_connections) cons } } -Error Object::connect(const StringName &p_signal, Object *p_to_object, const StringName &p_to_method, const Vector<Variant> &p_binds, uint32_t p_flags) { +Error Object::connect_compat(const StringName &p_signal, Object *p_to_object, const StringName &p_to_method, const Vector<Variant> &p_binds, uint32_t p_flags) { + + return connect(p_signal, Callable(p_to_object, p_to_method), p_binds, p_flags); +} +Error Object::connect(const StringName &p_signal, const Callable &p_callable, const Vector<Variant> &p_binds, uint32_t p_flags) { - ERR_FAIL_NULL_V(p_to_object, ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(p_callable.is_null(), ERR_INVALID_PARAMETER); - Signal *s = signal_map.getptr(p_signal); + SignalData *s = signal_map.getptr(p_signal); if (!s) { bool signal_is_valid = ClassDB::has_signal(get_class_name(), p_signal); //check in script @@ -1448,33 +1424,32 @@ Error Object::connect(const StringName &p_signal, Object *p_to_object, const Str #endif } - ERR_FAIL_COND_V_MSG(!signal_is_valid, ERR_INVALID_PARAMETER, "In Object of type '" + String(get_class()) + "': Attempt to connect nonexistent signal '" + p_signal + "' to method '" + p_to_object->get_class() + "." + p_to_method + "'."); + ERR_FAIL_COND_V_MSG(!signal_is_valid, ERR_INVALID_PARAMETER, "In Object of type '" + String(get_class()) + "': Attempt to connect nonexistent signal '" + p_signal + "' to callable '" + p_callable + "'."); - signal_map[p_signal] = Signal(); + signal_map[p_signal] = SignalData(); s = &signal_map[p_signal]; } - Signal::Target target(p_to_object->get_instance_id(), p_to_method); + Callable target = p_callable; + if (s->slot_map.has(target)) { if (p_flags & CONNECT_REFERENCE_COUNTED) { s->slot_map[target].reference_count++; return OK; } else { - ERR_FAIL_V_MSG(ERR_INVALID_PARAMETER, "Signal '" + p_signal + "' is already connected to given method '" + p_to_method + "' in that object."); + ERR_FAIL_V_MSG(ERR_INVALID_PARAMETER, "Signal '" + p_signal + "' is already connected to given callable '" + p_callable + "' in that object."); } } - Signal::Slot slot; + SignalData::Slot slot; Connection conn; - conn.source = this; - conn.target = p_to_object; - conn.method = p_to_method; - conn.signal = p_signal; + conn.callable = target; + conn.signal = ::Signal(this, p_signal); conn.flags = p_flags; conn.binds = p_binds; slot.conn = conn; - slot.cE = p_to_object->connections.push_back(conn); + slot.cE = p_callable.get_object()->connections.push_back(conn); if (p_flags & CONNECT_REFERENCE_COUNTED) { slot.reference_count = 1; } @@ -1484,10 +1459,15 @@ Error Object::connect(const StringName &p_signal, Object *p_to_object, const Str return OK; } -bool Object::is_connected(const StringName &p_signal, Object *p_to_object, const StringName &p_to_method) const { +bool Object::is_connected_compat(const StringName &p_signal, Object *p_to_object, const StringName &p_to_method) const { - ERR_FAIL_NULL_V(p_to_object, false); - const Signal *s = signal_map.getptr(p_signal); + return is_connected(p_signal, Callable(p_to_object, p_to_method)); +} + +bool Object::is_connected(const StringName &p_signal, const Callable &p_callable) const { + + ERR_FAIL_COND_V(p_callable.is_null(), false); + const SignalData *s = signal_map.getptr(p_signal); if (!s) { bool signal_is_valid = ClassDB::has_signal(get_class_name(), p_signal); if (signal_is_valid) @@ -1499,28 +1479,31 @@ bool Object::is_connected(const StringName &p_signal, Object *p_to_object, const ERR_FAIL_V_MSG(false, "Nonexistent signal: " + p_signal + "."); } - Signal::Target target(p_to_object->get_instance_id(), p_to_method); + Callable target = p_callable; return s->slot_map.has(target); //const Map<Signal::Target,Signal::Slot>::Element *E = s->slot_map.find(target); //return (E!=NULL); } -void Object::disconnect(const StringName &p_signal, Object *p_to_object, const StringName &p_to_method) { +void Object::disconnect_compat(const StringName &p_signal, Object *p_to_object, const StringName &p_to_method) { - _disconnect(p_signal, p_to_object, p_to_method); + _disconnect(p_signal, Callable(p_to_object, p_to_method)); } -void Object::_disconnect(const StringName &p_signal, Object *p_to_object, const StringName &p_to_method, bool p_force) { - ERR_FAIL_NULL(p_to_object); - Signal *s = signal_map.getptr(p_signal); - ERR_FAIL_COND_MSG(!s, vformat("Nonexistent signal '%s' in %s.", p_signal, to_string())); +void Object::disconnect(const StringName &p_signal, const Callable &p_callable) { + _disconnect(p_signal, p_callable); +} + +void Object::_disconnect(const StringName &p_signal, const Callable &p_callable, bool p_force) { - Signal::Target target(p_to_object->get_instance_id(), p_to_method); + ERR_FAIL_COND(p_callable.is_null()); + SignalData *s = signal_map.getptr(p_signal); + ERR_FAIL_COND_MSG(!s, vformat("Nonexistent signal '%s' in %s.", p_signal, to_string())); - ERR_FAIL_COND_MSG(!s->slot_map.has(target), "Disconnecting nonexistent signal '" + p_signal + "', slot: " + itos(target._id) + ":" + target.method + "."); + ERR_FAIL_COND_MSG(!s->slot_map.has(p_callable), "Disconnecting nonexistent signal '" + p_signal + "', callable: " + p_callable + "."); - Signal::Slot *slot = &s->slot_map[target]; + SignalData::Slot *slot = &s->slot_map[p_callable]; if (!p_force) { slot->reference_count--; // by default is zero, if it was not referenced it will go below it @@ -1528,9 +1511,10 @@ void Object::_disconnect(const StringName &p_signal, Object *p_to_object, const return; } } - - p_to_object->connections.erase(slot->cE); - s->slot_map.erase(target); + Object *object = p_callable.get_object(); + ERR_FAIL_COND(!object); + object->connections.erase(slot->cE); + s->slot_map.erase(p_callable); if (s->slot_map.empty() && ClassDB::has_signal(get_class_name(), p_signal)) { //not user signal, delete @@ -1710,9 +1694,9 @@ void Object::_bind_methods() { ClassDB::bind_method(D_METHOD("get_signal_connection_list", "signal"), &Object::_get_signal_connection_list); ClassDB::bind_method(D_METHOD("get_incoming_connections"), &Object::_get_incoming_connections); - ClassDB::bind_method(D_METHOD("connect", "signal", "target", "method", "binds", "flags"), &Object::connect, DEFVAL(Array()), DEFVAL(0)); - ClassDB::bind_method(D_METHOD("disconnect", "signal", "target", "method"), &Object::disconnect); - ClassDB::bind_method(D_METHOD("is_connected", "signal", "target", "method"), &Object::is_connected); + ClassDB::bind_method(D_METHOD("connect", "signal", "callable", "binds", "flags"), &Object::connect, DEFVAL(Array()), DEFVAL(0)); + ClassDB::bind_method(D_METHOD("disconnect", "signal", "callable"), &Object::disconnect); + ClassDB::bind_method(D_METHOD("is_connected", "signal", "callable"), &Object::is_connected); ClassDB::bind_method(D_METHOD("set_block_signals", "enable"), &Object::set_block_signals); ClassDB::bind_method(D_METHOD("is_blocking_signals"), &Object::is_blocking_signals); @@ -1829,7 +1813,7 @@ Variant::Type Object::get_static_property_type_indexed(const Vector<StringName> return Variant::NIL; } - Variant::CallError ce; + Callable::CallError ce; Variant check = Variant::construct(t, NULL, 0, ce); for (int i = 1; i < p_path.size(); i++) { @@ -1956,15 +1940,15 @@ Object::~Object() { while ((S = signal_map.next(NULL))) { - Signal *s = &signal_map[*S]; + SignalData *s = &signal_map[*S]; //brute force disconnect for performance int slot_count = s->slot_map.size(); - const VMap<Signal::Target, Signal::Slot>::Pair *slot_list = s->slot_map.get_array(); + const VMap<Callable, SignalData::Slot>::Pair *slot_list = s->slot_map.get_array(); for (int i = 0; i < slot_count; i++) { - slot_list[i].value.conn.target->connections.erase(slot_list[i].value.cE); + slot_list[i].value.conn.callable.get_object()->connections.erase(slot_list[i].value.cE); } signal_map.erase(*S); @@ -1974,7 +1958,7 @@ Object::~Object() { while (connections.size()) { Connection c = connections.front()->get(); - c.source->_disconnect(c.signal, c.target, c.method, true); + c.signal.get_object()->_disconnect(c.signal.get_name(), c.callable, true); } ObjectDB::remove_instance(this); diff --git a/core/object.h b/core/object.h index afbdbda814..dc7d49f534 100644 --- a/core/object.h +++ b/core/object.h @@ -413,18 +413,15 @@ public: struct Connection { - Object *source; - StringName signal; - Object *target; - StringName method; + ::Signal signal; + Callable callable; + uint32_t flags; Vector<Variant> binds; bool operator<(const Connection &p_conn) const; operator Variant() const; Connection() { - source = NULL; - target = NULL; flags = 0; } Connection(const Variant &p_variant); @@ -441,21 +438,7 @@ private: friend bool predelete_handler(Object *); friend void postinitialize_handler(Object *); - struct Signal { - - struct Target { - - ObjectID _id; - StringName method; - - _FORCE_INLINE_ bool operator<(const Target &p_target) const { return (_id == p_target._id) ? (method < p_target.method) : (_id < p_target._id); } - - Target(const ObjectID &p_id, const StringName &p_method) : - _id(p_id), - method(p_method) { - } - Target() { _id = ObjectID(); } - }; + struct SignalData { struct Slot { @@ -466,11 +449,11 @@ private: }; MethodInfo user; - VMap<Target, Slot> slot_map; - Signal() {} + VMap<Callable, Slot> slot_map; + SignalData() {} }; - HashMap<StringName, Signal> signal_map; + HashMap<StringName, SignalData> signal_map; List<Connection> connections; #ifdef DEBUG_ENABLED SafeRefCount _lock_index; @@ -496,7 +479,7 @@ private: void _add_user_signal(const String &p_name, const Array &p_args = Array()); bool _has_user_signal(const StringName &p_name) const; - Variant _emit_signal(const Variant **p_args, int p_argcount, Variant::CallError &r_error); + Variant _emit_signal(const Variant **p_args, int p_argcount, Callable::CallError &r_error); Array _get_signal_list() const; Array _get_signal_connection_list(const String &p_signal) const; Array _get_incoming_connections() const; @@ -554,8 +537,8 @@ protected: //Variant _call_bind(const StringName& p_name, const Variant& p_arg1 = Variant(), const Variant& p_arg2 = Variant(), const Variant& p_arg3 = Variant(), const Variant& p_arg4 = Variant()); //void _call_deferred_bind(const StringName& p_name, const Variant& p_arg1 = Variant(), const Variant& p_arg2 = Variant(), const Variant& p_arg3 = Variant(), const Variant& p_arg4 = Variant()); - Variant _call_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error); - Variant _call_deferred_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error); + Variant _call_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error); + Variant _call_deferred_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error); virtual const StringName *_get_class_namev() const { if (!_class_name) @@ -572,7 +555,7 @@ protected: friend class ClassDB; virtual void _validate_property(PropertyInfo &property) const; - void _disconnect(const StringName &p_signal, Object *p_to_object, const StringName &p_to_method, bool p_force = false); + void _disconnect(const StringName &p_signal, const Callable &p_callable, bool p_force = false); public: //should be protected, but bug in clang++ static void initialize_class(); @@ -670,7 +653,7 @@ public: bool has_method(const StringName &p_method) const; void get_method_list(List<MethodInfo> *p_list) const; Variant callv(const StringName &p_method, const Array &p_args); - 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 call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount); virtual void call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount); Variant call(const StringName &p_name, VARIANT_ARG_LIST); // C++ helper @@ -716,9 +699,13 @@ public: int get_persistent_signal_connection_count() const; void get_signals_connected_to_this(List<Connection> *p_connections) const; - Error connect(const StringName &p_signal, Object *p_to_object, const StringName &p_to_method, const Vector<Variant> &p_binds = Vector<Variant>(), uint32_t p_flags = 0); - void disconnect(const StringName &p_signal, Object *p_to_object, const StringName &p_to_method); - bool is_connected(const StringName &p_signal, Object *p_to_object, const StringName &p_to_method) const; + Error connect_compat(const StringName &p_signal, Object *p_to_object, const StringName &p_to_method, const Vector<Variant> &p_binds = Vector<Variant>(), uint32_t p_flags = 0); + void disconnect_compat(const StringName &p_signal, Object *p_to_object, const StringName &p_to_method); + bool is_connected_compat(const StringName &p_signal, Object *p_to_object, const StringName &p_to_method) const; + + Error connect(const StringName &p_signal, const Callable &p_callable, const Vector<Variant> &p_binds = Vector<Variant>(), uint32_t p_flags = 0); + void disconnect(const StringName &p_signal, const Callable &p_callable); + bool is_connected(const StringName &p_signal, const Callable &p_callable) const; void call_deferred(const StringName &p_method, VARIANT_ARG_LIST); void set_deferred(const StringName &p_property, const Variant &p_value); diff --git a/core/object_id.h b/core/object_id.h index 6ab1a3031a..63b0c27af8 100644 --- a/core/object_id.h +++ b/core/object_id.h @@ -1,3 +1,33 @@ +/*************************************************************************/ +/* object_id.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + #ifndef OBJECT_ID_H #define OBJECT_ID_H diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index 45b600a23d..bb017f43e5 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -99,6 +99,9 @@ extern void unregister_variant_methods(); void register_core_types() { + //consistency check + ERR_FAIL_COND(sizeof(Callable) > 16); + ObjectDB::setup(); ResourceCache::setup(); diff --git a/core/script_language.cpp b/core/script_language.cpp index 1149feac38..0b00247502 100644 --- a/core/script_language.cpp +++ b/core/script_language.cpp @@ -307,17 +307,17 @@ Variant ScriptInstance::call(const StringName &p_method, VARIANT_ARG_DECLARE) { argc++; } - Variant::CallError error; + Callable::CallError error; return call(p_method, argptr, argc, error); } void ScriptInstance::call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount) { - Variant::CallError ce; + Callable::CallError ce; call(p_method, p_args, p_argcount, ce); // script may not support multilevel calls } void ScriptInstance::call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount) { - Variant::CallError ce; + Callable::CallError ce; call(p_method, p_args, p_argcount, ce); // script may not support multilevel calls } diff --git a/core/script_language.h b/core/script_language.h index 2209f78fe4..48570ae546 100644 --- a/core/script_language.h +++ b/core/script_language.h @@ -197,7 +197,7 @@ public: virtual void get_method_list(List<MethodInfo> *p_list) const = 0; virtual bool has_method(const StringName &p_method) const = 0; virtual Variant call(const StringName &p_method, VARIANT_ARG_LIST); - virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) = 0; + virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) = 0; virtual void call_multilevel(const StringName &p_method, VARIANT_ARG_LIST); virtual void call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount); virtual void call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount); @@ -424,12 +424,12 @@ public: virtual void get_method_list(List<MethodInfo> *p_list) const; virtual bool has_method(const StringName &p_method) const; virtual Variant call(const StringName &p_method, VARIANT_ARG_LIST) { return Variant(); } - virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; return Variant(); } //virtual void call_multilevel(const StringName& p_method,VARIANT_ARG_LIST) { return Variant(); } - //virtual void call_multilevel(const StringName& p_method,const Variant** p_args,int p_argcount,Variant::CallError &r_error) { return Variant(); } + //virtual void call_multilevel(const StringName& p_method,const Variant** p_args,int p_argcount,Callable::CallError &r_error) { return Variant(); } virtual void notification(int p_notification) {} virtual Ref<Script> get_script() const { return script; } diff --git a/core/type_info.h b/core/type_info.h index 379735fd67..8e86567f51 100644 --- a/core/type_info.h +++ b/core/type_info.h @@ -153,6 +153,8 @@ MAKE_TYPE_INFO(Transform, Variant::TRANSFORM) MAKE_TYPE_INFO(Color, Variant::COLOR) MAKE_TYPE_INFO(NodePath, Variant::NODE_PATH) MAKE_TYPE_INFO(RID, Variant::_RID) +MAKE_TYPE_INFO(Callable, Variant::CALLABLE) +MAKE_TYPE_INFO(Signal, Variant::SIGNAL) MAKE_TYPE_INFO(Dictionary, Variant::DICTIONARY) MAKE_TYPE_INFO(Array, Variant::ARRAY) MAKE_TYPE_INFO(PackedByteArray, Variant::PACKED_BYTE_ARRAY) diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp index 577879d448..0eef75d587 100644 --- a/core/undo_redo.cpp +++ b/core/undo_redo.cpp @@ -290,9 +290,9 @@ void UndoRedo::_process_operation_list(List<Operation>::Element *E) { } argptrs.resize(argc); - Variant::CallError ce; + Callable::CallError ce; obj->call(op.name, (const Variant **)argptrs.ptr(), argc, ce); - if (ce.error != Variant::CallError::CALL_OK) { + if (ce.error != Callable::CallError::CALL_OK) { ERR_PRINT("Error calling method from signal '" + String(op.name) + "': " + Variant::get_call_error_text(obj, op.name, (const Variant **)argptrs.ptr(), argc, ce)); } #ifdef TOOLS_ENABLED @@ -431,29 +431,29 @@ UndoRedo::~UndoRedo() { clear_history(); } -Variant UndoRedo::_add_do_method(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant UndoRedo::_add_do_method(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { if (p_argcount < 2) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; r_error.argument = 0; return Variant(); } if (p_args[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.expected = Variant::OBJECT; return Variant(); } if (p_args[1]->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 = 1; r_error.expected = Variant::STRING; return Variant(); } - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; Object *object = *p_args[0]; String method = *p_args[1]; @@ -469,29 +469,29 @@ Variant UndoRedo::_add_do_method(const Variant **p_args, int p_argcount, Variant return Variant(); } -Variant UndoRedo::_add_undo_method(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant UndoRedo::_add_undo_method(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { if (p_argcount < 2) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; r_error.argument = 0; return Variant(); } if (p_args[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.expected = Variant::OBJECT; return Variant(); } if (p_args[1]->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 = 1; r_error.expected = Variant::STRING; return Variant(); } - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; Object *object = *p_args[0]; String method = *p_args[1]; diff --git a/core/undo_redo.h b/core/undo_redo.h index bb9a4d1642..e707979291 100644 --- a/core/undo_redo.h +++ b/core/undo_redo.h @@ -47,8 +47,8 @@ public: }; typedef void (*CommitNotifyCallback)(void *p_ud, const String &p_name); - Variant _add_do_method(const Variant **p_args, int p_argcount, Variant::CallError &r_error); - Variant _add_undo_method(const Variant **p_args, int p_argcount, Variant::CallError &r_error); + Variant _add_do_method(const Variant **p_args, int p_argcount, Callable::CallError &r_error); + Variant _add_undo_method(const Variant **p_args, int p_argcount, Callable::CallError &r_error); typedef void (*MethodNotifyCallback)(void *p_ud, Object *p_base, const StringName &p_name, VARIANT_ARG_DECLARE); typedef void (*PropertyNotifyCallback)(void *p_ud, Object *p_base, const StringName &p_property, const Variant &p_value); diff --git a/core/variant.cpp b/core/variant.cpp index b849a83cb4..cdc9e47fc8 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -128,6 +128,14 @@ String Variant::get_type_name(Variant::Type p_type) { return "Object"; } break; + case CALLABLE: { + + return "Callable"; + } break; + case SIGNAL: { + + return "Signal"; + } break; case NODE_PATH: { return "NodePath"; @@ -792,6 +800,14 @@ bool Variant::is_zero() const { return _get_obj().obj == NULL; } break; + case CALLABLE: { + + return reinterpret_cast<const Callable *>(_data._mem)->is_null(); + } break; + case SIGNAL: { + + return reinterpret_cast<const Signal *>(_data._mem)->is_null(); + } break; case NODE_PATH: { return reinterpret_cast<const NodePath *>(_data._mem)->is_empty(); @@ -1022,6 +1038,14 @@ void Variant::reference(const Variant &p_variant) { _get_obj().id = p_variant._get_obj().id; } break; + case CALLABLE: { + + memnew_placement(_data._mem, Callable(*reinterpret_cast<const Callable *>(p_variant._data._mem))); + } break; + case SIGNAL: { + + memnew_placement(_data._mem, Signal(*reinterpret_cast<const Signal *>(p_variant._data._mem))); + } break; case NODE_PATH: { memnew_placement(_data._mem, NodePath(*reinterpret_cast<const NodePath *>(p_variant._data._mem))); @@ -1149,6 +1173,14 @@ void Variant::clear() { // not much need probably reinterpret_cast<RID *>(_data._mem)->~RID(); } break; + case CALLABLE: { + + reinterpret_cast<Callable *>(_data._mem)->~Callable(); + } break; + case SIGNAL: { + + reinterpret_cast<Signal *>(_data._mem)->~Signal(); + } break; case DICTIONARY: { reinterpret_cast<Dictionary *>(_data._mem)->~Dictionary(); @@ -1627,6 +1659,18 @@ String Variant::stringify(List<const void *> &stack) const { return "[Object:null]"; } break; + case CALLABLE: { + const Callable &c = *reinterpret_cast<const Callable *>(_data._mem); + return c; + } break; + case SIGNAL: { + const Signal &s = *reinterpret_cast<const Signal *>(_data._mem); + return s; + } break; + case _RID: { + const RID &s = *reinterpret_cast<const RID *>(_data._mem); + return "RID(" + itos(s.get_id()) + ")"; + } break; default: { return "[" + get_type_name(type) + "]"; } @@ -1776,9 +1820,9 @@ Variant::operator RID() const { ERR_FAIL_COND_V_MSG(ObjectDB::get_instance(_get_obj().id) == nullptr, RID(), "Invalid pointer (object was freed)."); }; #endif - Variant::CallError ce; + Callable::CallError ce; Variant ret = _get_obj().obj->call(CoreStringNames::get_singleton()->get_rid, NULL, 0, ce); - if (ce.error == Variant::CallError::CALL_OK && ret.get_type() == Variant::_RID) { + if (ce.error == Callable::CallError::CALL_OK && ret.get_type() == Variant::_RID) { return ret; } return RID(); @@ -1836,6 +1880,22 @@ Variant::operator Dictionary() const { return Dictionary(); } +Variant::operator Callable() const { + + if (type == CALLABLE) + return *reinterpret_cast<const Callable *>(_data._mem); + else + return Callable(); +} + +Variant::operator Signal() const { + + if (type == SIGNAL) + return *reinterpret_cast<const Signal *>(_data._mem); + else + return Signal(); +} + template <class DA, class SA> inline DA _convert_array(const SA &p_array) { @@ -2243,6 +2303,17 @@ Variant::Variant(const Object *p_object) { } } +Variant::Variant(const Callable &p_callable) { + + type = CALLABLE; + memnew_placement(_data._mem, Callable(p_callable)); +} +Variant::Variant(const Signal &p_callable) { + + type = SIGNAL; + memnew_placement(_data._mem, Signal(p_callable)); +} + Variant::Variant(const Dictionary &p_dictionary) { type = DICTIONARY; @@ -2469,6 +2540,15 @@ void Variant::operator=(const Variant &p_variant) { _get_obj().id = p_variant._get_obj().id; } break; + case CALLABLE: { + + *reinterpret_cast<Callable *>(_data._mem) = *reinterpret_cast<const Callable *>(p_variant._data._mem); + } break; + case SIGNAL: { + + *reinterpret_cast<Signal *>(_data._mem) = *reinterpret_cast<const Signal *>(p_variant._data._mem); + } break; + case NODE_PATH: { *reinterpret_cast<NodePath *>(_data._mem) = *reinterpret_cast<const NodePath *>(p_variant._data._mem); @@ -2676,6 +2756,17 @@ uint32_t Variant::hash() const { return reinterpret_cast<const Dictionary *>(_data._mem)->hash(); } break; + case CALLABLE: { + + return reinterpret_cast<const Callable *>(_data._mem)->hash(); + + } break; + case SIGNAL: { + + const Signal &s = *reinterpret_cast<const Signal *>(_data._mem); + uint32_t hash = s.get_name().hash(); + return hash_djb2_one_64(s.get_object_id(), hash); + } break; case ARRAY: { const Array &arr = *reinterpret_cast<const Array *>(_data._mem); @@ -3054,24 +3145,24 @@ Variant Variant::call(const StringName &p_method, VARIANT_ARG_DECLARE) { argc++; } - CallError error; + Callable::CallError error; Variant ret = call(p_method, argptr, argc, error); switch (error.error) { - case CallError::CALL_ERROR_INVALID_ARGUMENT: { + case Callable::CallError::CALL_ERROR_INVALID_ARGUMENT: { - String err = "Invalid type for argument #" + itos(error.argument) + ", expected '" + Variant::get_type_name(error.expected) + "'."; + String err = "Invalid type for argument #" + itos(error.argument) + ", expected '" + Variant::get_type_name(Variant::Type(error.expected)) + "'."; ERR_PRINT(err.utf8().get_data()); } break; - case CallError::CALL_ERROR_INVALID_METHOD: { + case Callable::CallError::CALL_ERROR_INVALID_METHOD: { String err = "Invalid method '" + p_method + "' for type '" + Variant::get_type_name(type) + "'."; ERR_PRINT(err.utf8().get_data()); } break; - case CallError::CALL_ERROR_TOO_MANY_ARGUMENTS: { + case Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS: { String err = "Too many arguments for method '" + p_method + "'"; ERR_PRINT(err.utf8().get_data()); @@ -3096,26 +3187,26 @@ String Variant::get_construct_string() const { return vars; } -String Variant::get_call_error_text(Object *p_base, const StringName &p_method, const Variant **p_argptrs, int p_argcount, const Variant::CallError &ce) { +String Variant::get_call_error_text(Object *p_base, const StringName &p_method, const Variant **p_argptrs, int p_argcount, const Callable::CallError &ce) { String err_text; - if (ce.error == Variant::CallError::CALL_ERROR_INVALID_ARGUMENT) { + if (ce.error == Callable::CallError::CALL_ERROR_INVALID_ARGUMENT) { int errorarg = ce.argument; if (p_argptrs) { - err_text = "Cannot convert argument " + itos(errorarg + 1) + " from " + Variant::get_type_name(p_argptrs[errorarg]->get_type()) + " to " + Variant::get_type_name(ce.expected) + "."; + err_text = "Cannot convert argument " + itos(errorarg + 1) + " from " + Variant::get_type_name(p_argptrs[errorarg]->get_type()) + " to " + Variant::get_type_name(Variant::Type(ce.expected)) + "."; } else { - err_text = "Cannot convert argument " + itos(errorarg + 1) + " from [missing argptr, type unknown] to " + Variant::get_type_name(ce.expected) + "."; + err_text = "Cannot convert argument " + itos(errorarg + 1) + " from [missing argptr, type unknown] to " + Variant::get_type_name(Variant::Type(ce.expected)) + "."; } - } else if (ce.error == Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS) { + } else if (ce.error == Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS) { err_text = "Method expected " + itos(ce.argument) + " arguments, but called with " + itos(p_argcount) + "."; - } else if (ce.error == Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS) { + } else if (ce.error == Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS) { err_text = "Method expected " + itos(ce.argument) + " arguments, but called with " + itos(p_argcount) + "."; - } else if (ce.error == Variant::CallError::CALL_ERROR_INVALID_METHOD) { + } else if (ce.error == Callable::CallError::CALL_ERROR_INVALID_METHOD) { err_text = "Method not found."; - } else if (ce.error == Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL) { + } else if (ce.error == Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL) { err_text = "Instance is null"; - } else if (ce.error == Variant::CallError::CALL_OK) { + } else if (ce.error == Callable::CallError::CALL_OK) { return "Call OK"; } @@ -3128,6 +3219,32 @@ String Variant::get_call_error_text(Object *p_base, const StringName &p_method, return "'" + class_name + "::" + String(p_method) + "': " + err_text; } +String Variant::get_callable_error_text(const Callable &p_callable, const Variant **p_argptrs, int p_argcount, const Callable::CallError &ce) { + + String err_text; + + if (ce.error == Callable::CallError::CALL_ERROR_INVALID_ARGUMENT) { + int errorarg = ce.argument; + if (p_argptrs) { + err_text = "Cannot convert argument " + itos(errorarg + 1) + " from " + Variant::get_type_name(p_argptrs[errorarg]->get_type()) + " to " + Variant::get_type_name(Variant::Type(ce.expected)) + "."; + } else { + err_text = "Cannot convert argument " + itos(errorarg + 1) + " from [missing argptr, type unknown] to " + Variant::get_type_name(Variant::Type(ce.expected)) + "."; + } + } else if (ce.error == Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS) { + err_text = "Method expected " + itos(ce.argument) + " arguments, but called with " + itos(p_argcount) + "."; + } else if (ce.error == Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS) { + err_text = "Method expected " + itos(ce.argument) + " arguments, but called with " + itos(p_argcount) + "."; + } else if (ce.error == Callable::CallError::CALL_ERROR_INVALID_METHOD) { + err_text = "Method not found."; + } else if (ce.error == Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL) { + err_text = "Instance is null"; + } else if (ce.error == Callable::CallError::CALL_OK) { + return "Call OK"; + } + + return String(p_callable) + " : " + err_text; +} + String vformat(const String &p_text, const Variant &p1, const Variant &p2, const Variant &p3, const Variant &p4, const Variant &p5) { Array args; diff --git a/core/variant.h b/core/variant.h index 51f23b4b49..d41144f4c5 100644 --- a/core/variant.h +++ b/core/variant.h @@ -32,6 +32,7 @@ #define VARIANT_H #include "core/array.h" +#include "core/callable.h" #include "core/color.h" #include "core/dictionary.h" #include "core/io/ip_address.h" @@ -101,9 +102,10 @@ public: NODE_PATH, // 15 _RID, OBJECT, + CALLABLE, + SIGNAL, DICTIONARY, ARRAY, - // arrays PACKED_BYTE_ARRAY, // 20 PACKED_INT_ARRAY, @@ -202,6 +204,9 @@ public: operator Node *() const; operator Control *() const; + operator Callable() const; + operator Signal() const; + operator Dictionary() const; operator Array() const; @@ -262,6 +267,8 @@ public: Variant(const NodePath &p_node_path); Variant(const RID &p_rid); Variant(const Object *p_object); + Variant(const Callable &p_callable); + Variant(const Signal &p_signal); Variant(const Dictionary &p_dictionary); Variant(const Array &p_array); @@ -333,27 +340,14 @@ public: static void blend(const Variant &a, const Variant &b, float c, Variant &r_dst); static void interpolate(const Variant &a, const Variant &b, float c, Variant &r_dst); - struct CallError { - enum Error { - CALL_OK, - CALL_ERROR_INVALID_METHOD, - CALL_ERROR_INVALID_ARGUMENT, - CALL_ERROR_TOO_MANY_ARGUMENTS, - CALL_ERROR_TOO_FEW_ARGUMENTS, - CALL_ERROR_INSTANCE_IS_NULL, - }; - Error error; - int argument; - Type expected; - }; - - void call_ptr(const StringName &p_method, const Variant **p_args, int p_argcount, Variant *r_ret, CallError &r_error); - Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, CallError &r_error); + void call_ptr(const StringName &p_method, const Variant **p_args, int p_argcount, Variant *r_ret, Callable::CallError &r_error); + Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error); Variant call(const StringName &p_method, const Variant &p_arg1 = Variant(), const Variant &p_arg2 = Variant(), const Variant &p_arg3 = Variant(), const Variant &p_arg4 = Variant(), const Variant &p_arg5 = Variant()); - static String get_call_error_text(Object *p_base, const StringName &p_method, const Variant **p_argptrs, int p_argcount, const Variant::CallError &ce); + static String get_call_error_text(Object *p_base, const StringName &p_method, const Variant **p_argptrs, int p_argcount, const Callable::CallError &ce); + static String get_callable_error_text(const Callable &p_callable, const Variant **p_argptrs, int p_argcount, const Callable::CallError &ce); - static Variant construct(const Variant::Type, const Variant **p_args, int p_argcount, CallError &r_error, bool p_strict = true); + static Variant construct(const Variant::Type, const Variant **p_args, int p_argcount, Callable::CallError &r_error, bool p_strict = true); void get_method_list(List<MethodInfo> *p_list) const; bool has_method(const StringName &p_method) const; diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 6506da58d4..37c35d7c64 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -61,7 +61,7 @@ struct _VariantCall { VariantFunc func; - _FORCE_INLINE_ bool verify_arguments(const Variant **p_args, Variant::CallError &r_error) { + _FORCE_INLINE_ bool verify_arguments(const Variant **p_args, Callable::CallError &r_error) { if (arg_count == 0) return true; @@ -73,7 +73,7 @@ struct _VariantCall { if (tptr[i] == Variant::NIL || tptr[i] == p_args[i]->type) continue; // all good if (!Variant::can_convert(p_args[i]->type, tptr[i])) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = i; r_error.expected = tptr[i]; return false; @@ -82,10 +82,10 @@ struct _VariantCall { return true; } - _FORCE_INLINE_ void call(Variant &r_ret, Variant &p_self, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { + _FORCE_INLINE_ void call(Variant &r_ret, Variant &p_self, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { #ifdef DEBUG_ENABLED if (p_argcount > arg_count) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; r_error.argument = arg_count; return; } else @@ -94,7 +94,7 @@ struct _VariantCall { int def_argcount = default_args.size(); #ifdef DEBUG_ENABLED if (p_argcount < (arg_count - def_argcount)) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; r_error.argument = arg_count - def_argcount; return; } @@ -519,6 +519,23 @@ struct _VariantCall { VCALL_LOCALMEM1R(Dictionary, duplicate); VCALL_LOCALMEM2R(Dictionary, get); + VCALL_LOCALMEM0R(Callable, is_null); + VCALL_LOCALMEM0R(Callable, is_custom); + VCALL_LOCALMEM0(Callable, is_standard); + VCALL_LOCALMEM0(Callable, get_object); + VCALL_LOCALMEM0(Callable, get_object_id); + VCALL_LOCALMEM0(Callable, get_method); + VCALL_LOCALMEM0(Callable, hash); + + VCALL_LOCALMEM0R(Signal, is_null); + VCALL_LOCALMEM0R(Signal, get_object); + VCALL_LOCALMEM0R(Signal, get_object_id); + VCALL_LOCALMEM0R(Signal, get_name); + VCALL_LOCALMEM3R(Signal, connect); + VCALL_LOCALMEM1(Signal, disconnect); + VCALL_LOCALMEM1R(Signal, is_connected); + VCALL_LOCALMEM0R(Signal, get_connections); + VCALL_LOCALMEM2(Array, set); VCALL_LOCALMEM1R(Array, get); VCALL_LOCALMEM0R(Array, size); @@ -1010,6 +1027,16 @@ struct _VariantCall { r_ret = Transform(p_args[0]->operator Basis(), p_args[1]->operator Vector3()); } + static void Callable_init2(Variant &r_ret, const Variant **p_args) { + + r_ret = Callable(p_args[0]->operator ObjectID(), p_args[1]->operator String()); + } + + static void Signal_init2(Variant &r_ret, const Variant **p_args) { + + r_ret = Signal(p_args[0]->operator ObjectID(), p_args[1]->operator String()); + } + static void add_constructor(VariantConstructFunc p_func, const Variant::Type p_type, const String &p_name1 = "", const Variant::Type p_type1 = Variant::NIL, const String &p_name2 = "", const Variant::Type p_type2 = Variant::NIL, @@ -1078,26 +1105,26 @@ _VariantCall::TypeFunc *_VariantCall::type_funcs = NULL; _VariantCall::ConstructFunc *_VariantCall::construct_funcs = NULL; _VariantCall::ConstantData *_VariantCall::constant_data = NULL; -Variant Variant::call(const StringName &p_method, const Variant **p_args, int p_argcount, CallError &r_error) { +Variant Variant::call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { Variant ret; call_ptr(p_method, p_args, p_argcount, &ret, r_error); return ret; } -void Variant::call_ptr(const StringName &p_method, const Variant **p_args, int p_argcount, Variant *r_ret, CallError &r_error) { +void Variant::call_ptr(const StringName &p_method, const Variant **p_args, int p_argcount, Variant *r_ret, Callable::CallError &r_error) { Variant ret; if (type == Variant::OBJECT) { //call object Object *obj = _get_obj().obj; if (!obj) { - r_error.error = CallError::CALL_ERROR_INSTANCE_IS_NULL; + r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL; return; } #ifdef DEBUG_ENABLED if (ScriptDebugger::get_singleton() && !_get_obj().id.is_reference() && ObjectDB::get_instance(_get_obj().id) == nullptr) { - r_error.error = CallError::CALL_ERROR_INSTANCE_IS_NULL; + r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL; return; } @@ -1108,31 +1135,57 @@ void Variant::call_ptr(const StringName &p_method, const Variant **p_args, int p } else { - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; Map<StringName, _VariantCall::FuncData>::Element *E = _VariantCall::type_funcs[type].functions.find(p_method); -#ifdef DEBUG_ENABLED - if (!E) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; - return; + + if (E) { + + _VariantCall::FuncData &funcdata = E->get(); + funcdata.call(ret, *this, p_args, p_argcount, r_error); + + } else { + //handle vararg functions manually + bool valid = false; + if (type == CALLABLE) { + if (p_method == CoreStringNames::get_singleton()->call) { + + reinterpret_cast<const Callable *>(_data._mem)->call(p_args, p_argcount, ret, r_error); + valid = true; + } + if (p_method == CoreStringNames::get_singleton()->call_deferred) { + reinterpret_cast<const Callable *>(_data._mem)->call_deferred(p_args, p_argcount); + valid = true; + } + } else if (type == SIGNAL) { + if (p_method == CoreStringNames::get_singleton()->emit) { + if (r_ret) { + *r_ret = Variant(); + } + reinterpret_cast<const Signal *>(_data._mem)->emit(p_args, p_argcount); + valid = true; + } + } + if (!valid) { + //ok fail because not found + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; + return; + } } -#endif - _VariantCall::FuncData &funcdata = E->get(); - funcdata.call(ret, *this, p_args, p_argcount, r_error); } - if (r_error.error == Variant::CallError::CALL_OK && r_ret) + if (r_error.error == Callable::CallError::CALL_OK && r_ret) *r_ret = ret; } #define VCALL(m_type, m_method) _VariantCall::_call_##m_type##_##m_method -Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, int p_argcount, CallError &r_error, bool p_strict) { +Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, int p_argcount, Callable::CallError &r_error, bool p_strict) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; ERR_FAIL_INDEX_V(p_type, VARIANT_MAX, Variant()); - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; if (p_argcount == 0) { //generic construct switch (p_type) { @@ -1166,6 +1219,8 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i return NodePath(); // 15 case _RID: return RID(); case OBJECT: return (Object *)NULL; + case CALLABLE: return Callable(); + case SIGNAL: return Signal(); case DICTIONARY: return Dictionary(); case ARRAY: return Array(); // 20 @@ -1249,7 +1304,7 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i //validate parameters for (int i = 0; i < cd.arg_count; i++) { if (!Variant::can_convert(p_args[i]->type, cd.arg_types[i])) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; //no such constructor + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; //no such constructor r_error.argument = i; r_error.expected = cd.arg_types[i]; return Variant(); @@ -1261,7 +1316,7 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i return v; } } - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; //no such constructor + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; //no such constructor return Variant(); } @@ -1373,6 +1428,30 @@ void Variant::get_method_list(List<MethodInfo> *p_list) const { p_list->push_back(mi); } + + if (type == CALLABLE) { + + MethodInfo mi; + mi.name = "call"; + mi.return_val.usage = PROPERTY_USAGE_NIL_IS_VARIANT; + mi.flags |= METHOD_FLAG_VARARG; + + p_list->push_back(mi); + + mi.name = "call_deferred"; + mi.return_val.usage = 0; + + p_list->push_back(mi); + } + + if (type == SIGNAL) { + + MethodInfo mi; + mi.name = "emit"; + mi.flags |= METHOD_FLAG_VARARG; + + p_list->push_back(mi); + } } void Variant::get_constructor_list(Variant::Type p_type, List<MethodInfo> *p_list) { @@ -1756,6 +1835,25 @@ void register_variant_methods() { ADDFUNC1R(DICTIONARY, DICTIONARY, Dictionary, duplicate, BOOL, "deep", varray(false)); ADDFUNC2R(DICTIONARY, NIL, Dictionary, get, NIL, "key", NIL, "default", varray(Variant())); + ADDFUNC0R(CALLABLE, BOOL, Callable, is_null, varray()); + ADDFUNC0R(CALLABLE, BOOL, Callable, is_custom, varray()); + ADDFUNC0R(CALLABLE, BOOL, Callable, is_standard, varray()); + ADDFUNC0R(CALLABLE, OBJECT, Callable, get_object, varray()); + ADDFUNC0R(CALLABLE, INT, Callable, get_object_id, varray()); + ADDFUNC0R(CALLABLE, STRING, Callable, get_method, varray()); + ADDFUNC0R(CALLABLE, INT, Callable, hash, varray()); + + ADDFUNC0R(SIGNAL, BOOL, Signal, is_null, varray()); + ADDFUNC0R(SIGNAL, OBJECT, Signal, get_object, varray()); + ADDFUNC0R(SIGNAL, INT, Signal, get_object_id, varray()); + ADDFUNC0R(SIGNAL, STRING, Signal, get_name, varray()); + + ADDFUNC3R(SIGNAL, INT, Signal, connect, CALLABLE, "callable", ARRAY, "binds", INT, "flags", varray(Array(), 0)); + + ADDFUNC1R(SIGNAL, NIL, Signal, disconnect, CALLABLE, "callable", varray()); + ADDFUNC1R(SIGNAL, BOOL, Signal, is_connected, CALLABLE, "callable", varray()); + ADDFUNC0R(SIGNAL, ARRAY, Signal, get_connections, varray()); + ADDFUNC0R(ARRAY, INT, Array, size, varray()); ADDFUNC0R(ARRAY, BOOL, Array, empty, varray()); ADDFUNC0NC(ARRAY, NIL, Array, clear, varray()); @@ -1972,6 +2070,9 @@ void register_variant_methods() { _VariantCall::add_constructor(_VariantCall::Transform_init1, Variant::TRANSFORM, "x_axis", Variant::VECTOR3, "y_axis", Variant::VECTOR3, "z_axis", Variant::VECTOR3, "origin", Variant::VECTOR3); _VariantCall::add_constructor(_VariantCall::Transform_init2, Variant::TRANSFORM, "basis", Variant::BASIS, "origin", Variant::VECTOR3); + _VariantCall::add_constructor(_VariantCall::Callable_init2, Variant::CALLABLE, "object", Variant::OBJECT, "method_name", Variant::STRING); + _VariantCall::add_constructor(_VariantCall::Signal_init2, Variant::SIGNAL, "object", Variant::OBJECT, "signal_name", Variant::STRING); + /* REGISTER CONSTANTS */ _populate_named_colors(); diff --git a/core/variant_op.cpp b/core/variant_op.cpp index 566c87dac1..6c98cf4de1 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -56,6 +56,8 @@ CASE_TYPE(PREFIX, OP, NODE_PATH) \ CASE_TYPE(PREFIX, OP, _RID) \ CASE_TYPE(PREFIX, OP, OBJECT) \ + CASE_TYPE(PREFIX, OP, CALLABLE) \ + CASE_TYPE(PREFIX, OP, SIGNAL) \ CASE_TYPE(PREFIX, OP, DICTIONARY) \ CASE_TYPE(PREFIX, OP, ARRAY) \ CASE_TYPE(PREFIX, OP, PACKED_BYTE_ARRAY) \ @@ -89,6 +91,8 @@ TYPE(PREFIX, OP, NODE_PATH), \ TYPE(PREFIX, OP, _RID), \ TYPE(PREFIX, OP, OBJECT), \ + TYPE(PREFIX, OP, CALLABLE), \ + TYPE(PREFIX, OP, SIGNAL), \ TYPE(PREFIX, OP, DICTIONARY), \ TYPE(PREFIX, OP, ARRAY), \ TYPE(PREFIX, OP, PACKED_BYTE_ARRAY), \ @@ -101,32 +105,32 @@ } /* clang-format on */ -#define CASES(PREFIX) static const void *switch_table_##PREFIX[25][27] = { \ - TYPES(PREFIX, OP_EQUAL), \ - TYPES(PREFIX, OP_NOT_EQUAL), \ - TYPES(PREFIX, OP_LESS), \ - TYPES(PREFIX, OP_LESS_EQUAL), \ - TYPES(PREFIX, OP_GREATER), \ - TYPES(PREFIX, OP_GREATER_EQUAL), \ - TYPES(PREFIX, OP_ADD), \ - TYPES(PREFIX, OP_SUBTRACT), \ - TYPES(PREFIX, OP_MULTIPLY), \ - TYPES(PREFIX, OP_DIVIDE), \ - TYPES(PREFIX, OP_NEGATE), \ - TYPES(PREFIX, OP_POSITIVE), \ - TYPES(PREFIX, OP_MODULE), \ - TYPES(PREFIX, OP_STRING_CONCAT), \ - TYPES(PREFIX, OP_SHIFT_LEFT), \ - TYPES(PREFIX, OP_SHIFT_RIGHT), \ - TYPES(PREFIX, OP_BIT_AND), \ - TYPES(PREFIX, OP_BIT_OR), \ - TYPES(PREFIX, OP_BIT_XOR), \ - TYPES(PREFIX, OP_BIT_NEGATE), \ - TYPES(PREFIX, OP_AND), \ - TYPES(PREFIX, OP_OR), \ - TYPES(PREFIX, OP_XOR), \ - TYPES(PREFIX, OP_NOT), \ - TYPES(PREFIX, OP_IN), \ +#define CASES(PREFIX) static const void *switch_table_##PREFIX[25][Variant::VARIANT_MAX] = { \ + TYPES(PREFIX, OP_EQUAL), \ + TYPES(PREFIX, OP_NOT_EQUAL), \ + TYPES(PREFIX, OP_LESS), \ + TYPES(PREFIX, OP_LESS_EQUAL), \ + TYPES(PREFIX, OP_GREATER), \ + TYPES(PREFIX, OP_GREATER_EQUAL), \ + TYPES(PREFIX, OP_ADD), \ + TYPES(PREFIX, OP_SUBTRACT), \ + TYPES(PREFIX, OP_MULTIPLY), \ + TYPES(PREFIX, OP_DIVIDE), \ + TYPES(PREFIX, OP_NEGATE), \ + TYPES(PREFIX, OP_POSITIVE), \ + TYPES(PREFIX, OP_MODULE), \ + TYPES(PREFIX, OP_STRING_CONCAT), \ + TYPES(PREFIX, OP_SHIFT_LEFT), \ + TYPES(PREFIX, OP_SHIFT_RIGHT), \ + TYPES(PREFIX, OP_BIT_AND), \ + TYPES(PREFIX, OP_BIT_OR), \ + TYPES(PREFIX, OP_BIT_XOR), \ + TYPES(PREFIX, OP_BIT_NEGATE), \ + TYPES(PREFIX, OP_AND), \ + TYPES(PREFIX, OP_OR), \ + TYPES(PREFIX, OP_XOR), \ + TYPES(PREFIX, OP_NOT), \ + TYPES(PREFIX, OP_IN), \ } #define SWITCH(PREFIX, op, val) goto *switch_table_##PREFIX[op][val]; @@ -423,6 +427,9 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, _RETURN_FAIL; } + DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, CALLABLE, ==, Callable); + DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, SIGNAL, ==, Signal); + CASE_TYPE(math, OP_EQUAL, DICTIONARY) { if (p_b.type != DICTIONARY) { if (p_b.type == NIL) @@ -511,6 +518,9 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, _RETURN_FAIL; } + DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, CALLABLE, !=, Callable); + DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, SIGNAL, !=, Signal); + CASE_TYPE(math, OP_NOT_EQUAL, DICTIONARY) { if (p_b.type != DICTIONARY) { if (p_b.type == NIL) @@ -592,6 +602,9 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, _RETURN((p_a._get_obj().obj < p_b._get_obj().obj)); } + DEFAULT_OP_LOCALMEM_NULL(math, OP_LESS, CALLABLE, <, Callable); + DEFAULT_OP_LOCALMEM_NULL(math, OP_LESS, SIGNAL, <, Signal); + CASE_TYPE(math, OP_LESS, ARRAY) { if (p_b.type != ARRAY) _RETURN_FAIL; @@ -664,6 +677,9 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_LESS_EQUAL, TRANSFORM) CASE_TYPE(math, OP_LESS_EQUAL, COLOR) CASE_TYPE(math, OP_LESS_EQUAL, NODE_PATH) + CASE_TYPE(math, OP_LESS_EQUAL, CALLABLE) + CASE_TYPE(math, OP_LESS_EQUAL, SIGNAL) + CASE_TYPE(math, OP_LESS_EQUAL, DICTIONARY) CASE_TYPE(math, OP_LESS_EQUAL, ARRAY) CASE_TYPE(math, OP_LESS_EQUAL, PACKED_BYTE_ARRAY); @@ -740,6 +756,9 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_GREATER, COLOR) CASE_TYPE(math, OP_GREATER, NODE_PATH) CASE_TYPE(math, OP_GREATER, DICTIONARY) + CASE_TYPE(math, OP_GREATER, CALLABLE) + CASE_TYPE(math, OP_GREATER, SIGNAL) + _RETURN_FAIL; } @@ -768,6 +787,9 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_GREATER_EQUAL, TRANSFORM) CASE_TYPE(math, OP_GREATER_EQUAL, COLOR) CASE_TYPE(math, OP_GREATER_EQUAL, NODE_PATH) + CASE_TYPE(math, OP_GREATER_EQUAL, CALLABLE) + CASE_TYPE(math, OP_GREATER_EQUAL, SIGNAL) + CASE_TYPE(math, OP_GREATER_EQUAL, DICTIONARY) CASE_TYPE(math, OP_GREATER_EQUAL, ARRAY) CASE_TYPE(math, OP_GREATER_EQUAL, PACKED_BYTE_ARRAY); @@ -825,6 +847,9 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_ADD, NODE_PATH) CASE_TYPE(math, OP_ADD, _RID) CASE_TYPE(math, OP_ADD, OBJECT) + CASE_TYPE(math, OP_ADD, CALLABLE) + CASE_TYPE(math, OP_ADD, SIGNAL) + CASE_TYPE(math, OP_ADD, DICTIONARY) _RETURN_FAIL; } @@ -849,6 +874,9 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_SUBTRACT, NODE_PATH) CASE_TYPE(math, OP_SUBTRACT, _RID) CASE_TYPE(math, OP_SUBTRACT, OBJECT) + CASE_TYPE(math, OP_SUBTRACT, CALLABLE) + CASE_TYPE(math, OP_SUBTRACT, SIGNAL) + CASE_TYPE(math, OP_SUBTRACT, DICTIONARY) CASE_TYPE(math, OP_SUBTRACT, ARRAY) CASE_TYPE(math, OP_SUBTRACT, PACKED_BYTE_ARRAY); @@ -928,6 +956,9 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_MULTIPLY, NODE_PATH) CASE_TYPE(math, OP_MULTIPLY, _RID) CASE_TYPE(math, OP_MULTIPLY, OBJECT) + CASE_TYPE(math, OP_MULTIPLY, CALLABLE) + CASE_TYPE(math, OP_MULTIPLY, SIGNAL) + CASE_TYPE(math, OP_MULTIPLY, DICTIONARY) CASE_TYPE(math, OP_MULTIPLY, ARRAY) CASE_TYPE(math, OP_MULTIPLY, PACKED_BYTE_ARRAY); @@ -971,6 +1002,9 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_DIVIDE, NODE_PATH) CASE_TYPE(math, OP_DIVIDE, _RID) CASE_TYPE(math, OP_DIVIDE, OBJECT) + CASE_TYPE(math, OP_DIVIDE, CALLABLE) + CASE_TYPE(math, OP_DIVIDE, SIGNAL) + CASE_TYPE(math, OP_DIVIDE, DICTIONARY) CASE_TYPE(math, OP_DIVIDE, ARRAY) CASE_TYPE(math, OP_DIVIDE, PACKED_BYTE_ARRAY); @@ -1003,6 +1037,9 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_POSITIVE, NODE_PATH) CASE_TYPE(math, OP_POSITIVE, _RID) CASE_TYPE(math, OP_POSITIVE, OBJECT) + CASE_TYPE(math, OP_POSITIVE, CALLABLE) + CASE_TYPE(math, OP_POSITIVE, SIGNAL) + CASE_TYPE(math, OP_POSITIVE, DICTIONARY) CASE_TYPE(math, OP_POSITIVE, ARRAY) CASE_TYPE(math, OP_POSITIVE, PACKED_BYTE_ARRAY) @@ -1036,6 +1073,9 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_NEGATE, NODE_PATH) CASE_TYPE(math, OP_NEGATE, _RID) CASE_TYPE(math, OP_NEGATE, OBJECT) + CASE_TYPE(math, OP_NEGATE, CALLABLE) + CASE_TYPE(math, OP_NEGATE, SIGNAL) + CASE_TYPE(math, OP_NEGATE, DICTIONARY) CASE_TYPE(math, OP_NEGATE, ARRAY) CASE_TYPE(math, OP_NEGATE, PACKED_BYTE_ARRAY) @@ -1096,6 +1136,9 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_MODULE, NODE_PATH) CASE_TYPE(math, OP_MODULE, _RID) CASE_TYPE(math, OP_MODULE, OBJECT) + CASE_TYPE(math, OP_MODULE, CALLABLE) + CASE_TYPE(math, OP_MODULE, SIGNAL) + CASE_TYPE(math, OP_MODULE, DICTIONARY) CASE_TYPE(math, OP_MODULE, ARRAY) CASE_TYPE(math, OP_MODULE, PACKED_BYTE_ARRAY) @@ -2968,15 +3011,15 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const { } #endif - Variant::CallError ce; - ce.error = Variant::CallError::CALL_OK; + Callable::CallError ce; + ce.error = Callable::CallError::CALL_OK; Array ref; ref.push_back(r_iter); Variant vref = ref; const Variant *refp[] = { &vref }; Variant ret = _get_obj().obj->call(CoreStringNames::get_singleton()->_iter_init, refp, 1, ce); - if (ref.size() != 1 || ce.error != Variant::CallError::CALL_OK) { + if (ref.size() != 1 || ce.error != Callable::CallError::CALL_OK) { valid = false; return false; } @@ -3138,15 +3181,15 @@ bool Variant::iter_next(Variant &r_iter, bool &valid) const { } #endif - Variant::CallError ce; - ce.error = Variant::CallError::CALL_OK; + Callable::CallError ce; + ce.error = Callable::CallError::CALL_OK; Array ref; ref.push_back(r_iter); Variant vref = ref; const Variant *refp[] = { &vref }; Variant ret = _get_obj().obj->call(CoreStringNames::get_singleton()->_iter_next, refp, 1, ce); - if (ref.size() != 1 || ce.error != Variant::CallError::CALL_OK) { + if (ref.size() != 1 || ce.error != Callable::CallError::CALL_OK) { valid = false; return false; } @@ -3297,12 +3340,12 @@ Variant Variant::iter_get(const Variant &r_iter, bool &r_valid) const { } #endif - Variant::CallError ce; - ce.error = Variant::CallError::CALL_OK; + Callable::CallError ce; + ce.error = Callable::CallError::CALL_OK; const Variant *refp[] = { &r_iter }; Variant ret = _get_obj().obj->call(CoreStringNames::get_singleton()->_iter_get, refp, 1, ce); - if (ce.error != Variant::CallError::CALL_OK) { + if (ce.error != Callable::CallError::CALL_OK) { r_valid = false; return Variant(); } diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index 719e4af6b5..3bacb8205b 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -502,12 +502,12 @@ void AnimationBezierTrackEdit::set_animation_and_track(const Ref<Animation> &p_a animation = p_animation; track = p_track; - if (is_connected("select_key", editor, "_key_selected")) - disconnect("select_key", editor, "_key_selected"); - if (is_connected("deselect_key", editor, "_key_deselected")) - disconnect("deselect_key", editor, "_key_deselected"); - connect("select_key", editor, "_key_selected", varray(p_track), CONNECT_DEFERRED); - connect("deselect_key", editor, "_key_deselected", varray(p_track), CONNECT_DEFERRED); + if (is_connected_compat("select_key", editor, "_key_selected")) + disconnect_compat("select_key", editor, "_key_selected"); + if (is_connected_compat("deselect_key", editor, "_key_deselected")) + disconnect_compat("deselect_key", editor, "_key_deselected"); + connect_compat("select_key", editor, "_key_selected", varray(p_track), CONNECT_DEFERRED); + connect_compat("deselect_key", editor, "_key_deselected", varray(p_track), CONNECT_DEFERRED); update(); } @@ -522,11 +522,11 @@ void AnimationBezierTrackEdit::set_undo_redo(UndoRedo *p_undo_redo) { void AnimationBezierTrackEdit::set_timeline(AnimationTimelineEdit *p_timeline) { timeline = p_timeline; - timeline->connect("zoom_changed", this, "_zoom_changed"); + timeline->connect_compat("zoom_changed", this, "_zoom_changed"); } void AnimationBezierTrackEdit::set_editor(AnimationTrackEditor *p_editor) { editor = p_editor; - connect("clear_selection", editor, "_clear_selection", varray(false)); + connect_compat("clear_selection", editor, "_clear_selection", varray(false)); } void AnimationBezierTrackEdit::_play_position_draw() { @@ -1184,7 +1184,7 @@ AnimationBezierTrackEdit::AnimationBezierTrackEdit() { play_position->set_mouse_filter(MOUSE_FILTER_PASS); add_child(play_position); play_position->set_anchors_and_margins_preset(PRESET_WIDE); - play_position->connect("draw", this, "_play_position_draw"); + play_position->connect_compat("draw", this, "_play_position_draw"); set_focus_mode(FOCUS_CLICK); v_scroll = 0; @@ -1198,7 +1198,7 @@ AnimationBezierTrackEdit::AnimationBezierTrackEdit() { menu = memnew(PopupMenu); add_child(menu); - menu->connect("id_pressed", this, "_menu_selected"); + menu->connect_compat("id_pressed", this, "_menu_selected"); //set_mouse_filter(MOUSE_FILTER_PASS); //scroll has to work too for selection } diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index cc64db22cc..b538161443 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -235,7 +235,7 @@ public: Variant::Type t = Variant::Type(int(p_value)); if (t != args[idx].get_type()) { - Variant::CallError err; + Callable::CallError err; if (Variant::can_convert(args[idx].get_type(), t)) { Variant old = args[idx]; Variant *ptrs[1] = { &old }; @@ -898,7 +898,7 @@ public: Variant::Type t = Variant::Type(int(p_value)); if (t != args[idx].get_type()) { - Variant::CallError err; + Callable::CallError err; if (Variant::can_convert(args[idx].get_type(), t)) { Variant old = args[idx]; Variant *ptrs[1] = { &old }; @@ -1697,7 +1697,7 @@ void AnimationTimelineEdit::set_undo_redo(UndoRedo *p_undo_redo) { void AnimationTimelineEdit::set_zoom(Range *p_zoom) { zoom = p_zoom; - zoom->connect("value_changed", this, "_zoom_changed"); + zoom->connect_compat("value_changed", this, "_zoom_changed"); } void AnimationTimelineEdit::set_play_position(float p_pos) { @@ -1871,7 +1871,7 @@ AnimationTimelineEdit::AnimationTimelineEdit() { play_position->set_mouse_filter(MOUSE_FILTER_PASS); add_child(play_position); play_position->set_anchors_and_margins_preset(PRESET_WIDE); - play_position->connect("draw", this, "_play_position_draw"); + play_position->connect_compat("draw", this, "_play_position_draw"); add_track = memnew(MenuButton); add_track->set_position(Vector2(0, 0)); @@ -1895,17 +1895,17 @@ AnimationTimelineEdit::AnimationTimelineEdit() { length->set_custom_minimum_size(Vector2(70 * EDSCALE, 0)); length->set_hide_slider(true); length->set_tooltip(TTR("Animation length (seconds)")); - length->connect("value_changed", this, "_anim_length_changed"); + length->connect_compat("value_changed", this, "_anim_length_changed"); len_hb->add_child(length); loop = memnew(ToolButton); loop->set_tooltip(TTR("Animation Looping")); - loop->connect("pressed", this, "_anim_loop_pressed"); + loop->connect_compat("pressed", this, "_anim_loop_pressed"); loop->set_toggle_mode(true); len_hb->add_child(loop); add_child(len_hb); add_track->hide(); - add_track->get_popup()->connect("index_pressed", this, "_track_added"); + add_track->get_popup()->connect_compat("index_pressed", this, "_track_added"); len_hb->hide(); panning_timeline = false; @@ -2429,8 +2429,8 @@ void AnimationTrackEdit::set_undo_redo(UndoRedo *p_undo_redo) { void AnimationTrackEdit::set_timeline(AnimationTimelineEdit *p_timeline) { timeline = p_timeline; - timeline->connect("zoom_changed", this, "_zoom_changed"); - timeline->connect("name_limit_changed", this, "_zoom_changed"); + timeline->connect_compat("zoom_changed", this, "_zoom_changed"); + timeline->connect_compat("name_limit_changed", this, "_zoom_changed"); } void AnimationTrackEdit::set_editor(AnimationTrackEditor *p_editor) { editor = p_editor; @@ -2688,7 +2688,7 @@ void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { if (!menu) { menu = memnew(PopupMenu); add_child(menu); - menu->connect("id_pressed", this, "_menu_selected"); + menu->connect_compat("id_pressed", this, "_menu_selected"); } menu->clear(); menu->add_icon_item(get_icon("TrackContinuous", "EditorIcons"), TTR("Continuous"), MENU_CALL_MODE_CONTINUOUS); @@ -2707,7 +2707,7 @@ void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { if (!menu) { menu = memnew(PopupMenu); add_child(menu); - menu->connect("id_pressed", this, "_menu_selected"); + menu->connect_compat("id_pressed", this, "_menu_selected"); } menu->clear(); menu->add_icon_item(get_icon("InterpRaw", "EditorIcons"), TTR("Nearest"), MENU_INTERPOLATION_NEAREST); @@ -2725,7 +2725,7 @@ void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { if (!menu) { menu = memnew(PopupMenu); add_child(menu); - menu->connect("id_pressed", this, "_menu_selected"); + menu->connect_compat("id_pressed", this, "_menu_selected"); } menu->clear(); menu->add_icon_item(get_icon("InterpWrapClamp", "EditorIcons"), TTR("Clamp Loop Interp"), MENU_LOOP_CLAMP); @@ -2820,7 +2820,7 @@ void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { if (!menu) { menu = memnew(PopupMenu); add_child(menu); - menu->connect("id_pressed", this, "_menu_selected"); + menu->connect_compat("id_pressed", this, "_menu_selected"); } menu->clear(); @@ -2848,7 +2848,7 @@ void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { path = memnew(LineEdit); add_child(path); path->set_as_toplevel(true); - path->connect("text_entered", this, "_path_entered"); + path->connect_compat("text_entered", this, "_path_entered"); } path->set_text(animation->track_get_path(track)); @@ -3111,7 +3111,7 @@ AnimationTrackEdit::AnimationTrackEdit() { play_position->set_mouse_filter(MOUSE_FILTER_PASS); add_child(play_position); play_position->set_anchors_and_margins_preset(PRESET_WIDE); - play_position->connect("draw", this, "_play_position_draw"); + play_position->connect_compat("draw", this, "_play_position_draw"); set_focus_mode(FOCUS_CLICK); set_mouse_filter(MOUSE_FILTER_PASS); //scroll has to work too for selection } @@ -3138,7 +3138,7 @@ AnimationTrackEdit *AnimationTrackEditPlugin::create_value_track_edit(Object *p_ &args[5] }; - Variant::CallError ce; + Callable::CallError ce; return Object::cast_to<AnimationTrackEdit>(get_script_instance()->call("create_value_track_edit", (const Variant **)&argptrs, 6, ce).operator Object *()); } return NULL; @@ -3217,8 +3217,8 @@ Size2 AnimationTrackEditGroup::get_minimum_size() const { void AnimationTrackEditGroup::set_timeline(AnimationTimelineEdit *p_timeline) { timeline = p_timeline; - timeline->connect("zoom_changed", this, "_zoom_changed"); - timeline->connect("name_limit_changed", this, "_zoom_changed"); + timeline->connect_compat("zoom_changed", this, "_zoom_changed"); + timeline->connect_compat("name_limit_changed", this, "_zoom_changed"); } void AnimationTrackEditGroup::set_root(Node *p_root) { @@ -3258,7 +3258,7 @@ void AnimationTrackEditor::set_animation(const Ref<Animation> &p_anim) { track_edits[_get_track_selected()]->release_focus(); } if (animation.is_valid()) { - animation->disconnect("changed", this, "_animation_changed"); + animation->disconnect_compat("changed", this, "_animation_changed"); _clear_selection(); } animation = p_anim; @@ -3268,7 +3268,7 @@ void AnimationTrackEditor::set_animation(const Ref<Animation> &p_anim) { _update_tracks(); if (animation.is_valid()) { - animation->connect("changed", this, "_animation_changed"); + animation->connect_compat("changed", this, "_animation_changed"); hscroll->show(); edit->set_disabled(false); @@ -3311,13 +3311,13 @@ void AnimationTrackEditor::_root_removed(Node *p_root) { void AnimationTrackEditor::set_root(Node *p_root) { if (root) { - root->disconnect("tree_exiting", this, "_root_removed"); + root->disconnect_compat("tree_exiting", this, "_root_removed"); } root = p_root; if (root) { - root->connect("tree_exiting", this, "_root_removed", make_binds(), CONNECT_ONESHOT); + root->connect_compat("tree_exiting", this, "_root_removed", make_binds(), CONNECT_ONESHOT); } _update_tracks(); @@ -4257,21 +4257,21 @@ void AnimationTrackEditor::_update_tracks() { track_edit->grab_focus(); } - track_edit->connect("timeline_changed", this, "_timeline_changed"); - track_edit->connect("remove_request", this, "_track_remove_request", varray(), CONNECT_DEFERRED); - track_edit->connect("dropped", this, "_dropped_track", varray(), CONNECT_DEFERRED); - track_edit->connect("insert_key", this, "_insert_key_from_track", varray(i), CONNECT_DEFERRED); - track_edit->connect("select_key", this, "_key_selected", varray(i), CONNECT_DEFERRED); - track_edit->connect("deselect_key", this, "_key_deselected", varray(i), CONNECT_DEFERRED); - track_edit->connect("bezier_edit", this, "_bezier_edit", varray(i), CONNECT_DEFERRED); - track_edit->connect("move_selection_begin", this, "_move_selection_begin"); - track_edit->connect("move_selection", this, "_move_selection"); - track_edit->connect("move_selection_commit", this, "_move_selection_commit"); - track_edit->connect("move_selection_cancel", this, "_move_selection_cancel"); + track_edit->connect_compat("timeline_changed", this, "_timeline_changed"); + track_edit->connect_compat("remove_request", this, "_track_remove_request", varray(), CONNECT_DEFERRED); + track_edit->connect_compat("dropped", this, "_dropped_track", varray(), CONNECT_DEFERRED); + track_edit->connect_compat("insert_key", this, "_insert_key_from_track", varray(i), CONNECT_DEFERRED); + track_edit->connect_compat("select_key", this, "_key_selected", varray(i), CONNECT_DEFERRED); + track_edit->connect_compat("deselect_key", this, "_key_deselected", varray(i), CONNECT_DEFERRED); + track_edit->connect_compat("bezier_edit", this, "_bezier_edit", varray(i), CONNECT_DEFERRED); + track_edit->connect_compat("move_selection_begin", this, "_move_selection_begin"); + track_edit->connect_compat("move_selection", this, "_move_selection"); + track_edit->connect_compat("move_selection_commit", this, "_move_selection_commit"); + track_edit->connect_compat("move_selection_cancel", this, "_move_selection_cancel"); - track_edit->connect("duplicate_request", this, "_edit_menu_pressed", varray(EDIT_DUPLICATE_SELECTION), CONNECT_DEFERRED); - track_edit->connect("duplicate_transpose_request", this, "_edit_menu_pressed", varray(EDIT_DUPLICATE_TRANSPOSED), CONNECT_DEFERRED); - track_edit->connect("delete_request", this, "_edit_menu_pressed", varray(EDIT_DELETE_SELECTION), CONNECT_DEFERRED); + track_edit->connect_compat("duplicate_request", this, "_edit_menu_pressed", varray(EDIT_DUPLICATE_SELECTION), CONNECT_DEFERRED); + track_edit->connect_compat("duplicate_transpose_request", this, "_edit_menu_pressed", varray(EDIT_DUPLICATE_TRANSPOSED), CONNECT_DEFERRED); + track_edit->connect_compat("delete_request", this, "_edit_menu_pressed", varray(EDIT_DELETE_SELECTION), CONNECT_DEFERRED); } } @@ -4384,7 +4384,7 @@ void AnimationTrackEditor::_notification(int p_what) { } if (p_what == NOTIFICATION_READY) { - EditorNode::get_singleton()->get_editor_selection()->connect("selection_changed", this, "_selection_changed"); + EditorNode::get_singleton()->get_editor_selection()->connect_compat("selection_changed", this, "_selection_changed"); } if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { @@ -4753,7 +4753,7 @@ void AnimationTrackEditor::_add_method_key(const String &p_method) { Variant arg = E->get().default_arguments[i - first_defarg]; params.push_back(arg); } else { - Variant::CallError ce; + Callable::CallError ce; Variant arg = Variant::construct(E->get().arguments[i].type, NULL, 0, ce); params.push_back(arg); } @@ -5813,11 +5813,11 @@ AnimationTrackEditor::AnimationTrackEditor() { timeline = memnew(AnimationTimelineEdit); timeline->set_undo_redo(undo_redo); timeline_vbox->add_child(timeline); - timeline->connect("timeline_changed", this, "_timeline_changed"); - timeline->connect("name_limit_changed", this, "_name_limit_changed"); - timeline->connect("track_added", this, "_add_track"); - timeline->connect("value_changed", this, "_timeline_value_changed"); - timeline->connect("length_changed", this, "_update_length"); + timeline->connect_compat("timeline_changed", this, "_timeline_changed"); + timeline->connect_compat("name_limit_changed", this, "_name_limit_changed"); + timeline->connect_compat("track_added", this, "_add_track"); + timeline->connect_compat("value_changed", this, "_timeline_value_changed"); + timeline->connect_compat("length_changed", this, "_update_length"); scroll = memnew(ScrollContainer); timeline_vbox->add_child(scroll); @@ -5825,7 +5825,7 @@ AnimationTrackEditor::AnimationTrackEditor() { VScrollBar *sb = scroll->get_v_scrollbar(); scroll->remove_child(sb); timeline_scroll->add_child(sb); //move here so timeline and tracks are always aligned - scroll->connect("gui_input", this, "_scroll_input"); + scroll->connect_compat("gui_input", this, "_scroll_input"); bezier_edit = memnew(AnimationBezierTrackEdit); timeline_vbox->add_child(bezier_edit); @@ -5834,14 +5834,14 @@ AnimationTrackEditor::AnimationTrackEditor() { bezier_edit->set_timeline(timeline); bezier_edit->hide(); bezier_edit->set_v_size_flags(SIZE_EXPAND_FILL); - bezier_edit->connect("close_request", this, "_cancel_bezier_edit"); + bezier_edit->connect_compat("close_request", this, "_cancel_bezier_edit"); timeline_vbox->set_custom_minimum_size(Size2(0, 150) * EDSCALE); hscroll = memnew(HScrollBar); hscroll->share(timeline); hscroll->hide(); - hscroll->connect("value_changed", this, "_update_scroll"); + hscroll->connect_compat("value_changed", this, "_update_scroll"); timeline_vbox->add_child(hscroll); timeline->set_hscroll(hscroll); @@ -5858,20 +5858,20 @@ AnimationTrackEditor::AnimationTrackEditor() { imported_anim_warning = memnew(Button); imported_anim_warning->hide(); imported_anim_warning->set_tooltip(TTR("Warning: Editing imported animation")); - imported_anim_warning->connect("pressed", this, "_show_imported_anim_warning"); + imported_anim_warning->connect_compat("pressed", this, "_show_imported_anim_warning"); bottom_hb->add_child(imported_anim_warning); bottom_hb->add_spacer(); selected_filter = memnew(ToolButton); - selected_filter->connect("pressed", this, "_view_group_toggle"); //same function works the same + selected_filter->connect_compat("pressed", this, "_view_group_toggle"); //same function works the same selected_filter->set_toggle_mode(true); selected_filter->set_tooltip(TTR("Only show tracks from nodes selected in tree.")); bottom_hb->add_child(selected_filter); view_group = memnew(ToolButton); - view_group->connect("pressed", this, "_view_group_toggle"); + view_group->connect_compat("pressed", this, "_view_group_toggle"); view_group->set_toggle_mode(true); view_group->set_tooltip(TTR("Group tracks by node or display them as plain list.")); @@ -5893,14 +5893,14 @@ AnimationTrackEditor::AnimationTrackEditor() { step->set_custom_minimum_size(Size2(100, 0) * EDSCALE); step->set_tooltip(TTR("Animation step value.")); bottom_hb->add_child(step); - step->connect("value_changed", this, "_update_step"); + step->connect_compat("value_changed", this, "_update_step"); step->set_read_only(true); snap_mode = memnew(OptionButton); snap_mode->add_item(TTR("Seconds")); snap_mode->add_item(TTR("FPS")); bottom_hb->add_child(snap_mode); - snap_mode->connect("item_selected", this, "_snap_mode_changed"); + snap_mode->connect_compat("item_selected", this, "_snap_mode_changed"); snap_mode->set_disabled(true); bottom_hb->add_child(memnew(VSeparator)); @@ -5945,19 +5945,19 @@ AnimationTrackEditor::AnimationTrackEditor() { edit->get_popup()->add_item(TTR("Optimize Animation"), EDIT_OPTIMIZE_ANIMATION); edit->get_popup()->add_item(TTR("Clean-Up Animation"), EDIT_CLEAN_UP_ANIMATION); - edit->get_popup()->connect("id_pressed", this, "_edit_menu_pressed"); + edit->get_popup()->connect_compat("id_pressed", this, "_edit_menu_pressed"); pick_track = memnew(SceneTreeDialog); add_child(pick_track); pick_track->set_title(TTR("Pick the node that will be animated:")); - pick_track->connect("selected", this, "_new_track_node_selected"); + pick_track->connect_compat("selected", this, "_new_track_node_selected"); prop_selector = memnew(PropertySelector); add_child(prop_selector); - prop_selector->connect("selected", this, "_new_track_property_selected"); + prop_selector->connect_compat("selected", this, "_new_track_property_selected"); method_selector = memnew(PropertySelector); add_child(method_selector); - method_selector->connect("selected", this, "_add_method_key"); + method_selector->connect_compat("selected", this, "_add_method_key"); inserting = false; insert_query = false; @@ -5966,7 +5966,7 @@ AnimationTrackEditor::AnimationTrackEditor() { insert_confirm = memnew(ConfirmationDialog); add_child(insert_confirm); - insert_confirm->connect("confirmed", this, "_confirm_insert_list"); + insert_confirm->connect_compat("confirmed", this, "_confirm_insert_list"); VBoxContainer *icvb = memnew(VBoxContainer); insert_confirm->add_child(icvb); insert_confirm_text = memnew(Label); @@ -5984,7 +5984,7 @@ AnimationTrackEditor::AnimationTrackEditor() { box_selection->set_as_toplevel(true); box_selection->set_mouse_filter(MOUSE_FILTER_IGNORE); box_selection->hide(); - box_selection->connect("draw", this, "_box_selection_draw"); + box_selection->connect_compat("draw", this, "_box_selection_draw"); box_selecting = false; //default plugins @@ -6022,7 +6022,7 @@ AnimationTrackEditor::AnimationTrackEditor() { optimize_max_angle->set_value(22); optimize_dialog->get_ok()->set_text(TTR("Optimize")); - optimize_dialog->connect("confirmed", this, "_edit_menu_pressed", varray(EDIT_CLEAN_UP_ANIMATION_CONFIRM)); + optimize_dialog->connect_compat("confirmed", this, "_edit_menu_pressed", varray(EDIT_CLEAN_UP_ANIMATION_CONFIRM)); // @@ -6048,7 +6048,7 @@ AnimationTrackEditor::AnimationTrackEditor() { cleanup_dialog->set_title(TTR("Clean-Up Animation(s) (NO UNDO!)")); cleanup_dialog->get_ok()->set_text(TTR("Clean-Up")); - cleanup_dialog->connect("confirmed", this, "_edit_menu_pressed", varray(EDIT_CLEAN_UP_ANIMATION_CONFIRM)); + cleanup_dialog->connect_compat("confirmed", this, "_edit_menu_pressed", varray(EDIT_CLEAN_UP_ANIMATION_CONFIRM)); // scale_dialog = memnew(ConfirmationDialog); @@ -6060,7 +6060,7 @@ AnimationTrackEditor::AnimationTrackEditor() { scale->set_max(99999); scale->set_step(0.001); vbc->add_margin_child(TTR("Scale Ratio:"), scale); - scale_dialog->connect("confirmed", this, "_edit_menu_pressed", varray(EDIT_SCALE_CONFIRM)); + scale_dialog->connect_compat("confirmed", this, "_edit_menu_pressed", varray(EDIT_SCALE_CONFIRM)); add_child(scale_dialog); track_copy_dialog = memnew(ConfirmationDialog); @@ -6073,7 +6073,7 @@ AnimationTrackEditor::AnimationTrackEditor() { Button *select_all_button = memnew(Button); select_all_button->set_text(TTR("Select All/None")); - select_all_button->connect("pressed", this, "_select_all_tracks_for_copy"); + select_all_button->connect_compat("pressed", this, "_select_all_tracks_for_copy"); track_vbox->add_child(select_all_button); track_copy_select = memnew(Tree); @@ -6081,7 +6081,7 @@ AnimationTrackEditor::AnimationTrackEditor() { track_copy_select->set_v_size_flags(SIZE_EXPAND_FILL); track_copy_select->set_hide_root(true); track_vbox->add_child(track_copy_select); - track_copy_dialog->connect("confirmed", this, "_edit_menu_pressed", varray(EDIT_COPY_TRACKS_CONFIRM)); + track_copy_dialog->connect_compat("confirmed", this, "_edit_menu_pressed", varray(EDIT_COPY_TRACKS_CONFIRM)); animation_changing_awaiting_update = false; } diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp index bcdd09987f..b94d1645db 100644 --- a/editor/animation_track_editor_plugins.cpp +++ b/editor/animation_track_editor_plugins.cpp @@ -334,7 +334,7 @@ void AnimationTrackEditAudio::_bind_methods() { } AnimationTrackEditAudio::AnimationTrackEditAudio() { - AudioStreamPreviewGenerator::get_singleton()->connect("preview_updated", this, "_preview_changed"); + AudioStreamPreviewGenerator::get_singleton()->connect_compat("preview_updated", this, "_preview_changed"); } /// SPRITE FRAME / FRAME_COORDS /// @@ -949,7 +949,7 @@ void AnimationTrackEditTypeAudio::_bind_methods() { } AnimationTrackEditTypeAudio::AnimationTrackEditTypeAudio() { - AudioStreamPreviewGenerator::get_singleton()->connect("preview_updated", this, "_preview_changed"); + AudioStreamPreviewGenerator::get_singleton()->connect_compat("preview_updated", this, "_preview_changed"); len_resizing = false; } diff --git a/editor/array_property_edit.cpp b/editor/array_property_edit.cpp index 8cbc6a8dff..f14b12b132 100644 --- a/editor/array_property_edit.cpp +++ b/editor/array_property_edit.cpp @@ -42,7 +42,7 @@ Variant ArrayPropertyEdit::get_array() const { return Array(); Variant arr = o->get(property); if (!arr.is_array()) { - Variant::CallError ce; + Callable::CallError ce; arr = Variant::construct(default_type, NULL, 0, ce); } return arr; @@ -104,7 +104,7 @@ bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) { } else if (newsize > size) { Variant init; - Variant::CallError ce; + Callable::CallError ce; Variant::Type new_type = subtype; if (new_type == Variant::NIL && size) { new_type = arr.get(size - 1).get_type(); @@ -139,7 +139,7 @@ bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) { Variant value = arr.get(idx); if (value.get_type() != type && type >= 0 && type < Variant::VARIANT_MAX) { - Variant::CallError ce; + Callable::CallError ce; Variant new_value = Variant::construct(Variant::Type(type), NULL, 0, ce); UndoRedo *ur = EditorNode::get_undo_redo(); diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index ca0ac70ff7..86631def9d 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -200,7 +200,7 @@ void FindReplaceBar::_replace() { void FindReplaceBar::_replace_all() { - text_edit->disconnect("text_changed", this, "_editor_text_changed"); + text_edit->disconnect_compat("text_changed", this, "_editor_text_changed"); // Line as x so it gets priority in comparison, column as y. Point2i orig_cursor(text_edit->cursor_get_line(), text_edit->cursor_get_column()); Point2i prev_match = Point2(-1, -1); @@ -280,7 +280,7 @@ void FindReplaceBar::_replace_all() { matches_label->add_color_override("font_color", rc > 0 ? get_color("font_color", "Label") : get_color("error_color", "Editor")); matches_label->set_text(vformat(TTR("%d replaced."), rc)); - text_edit->call_deferred("connect", "text_changed", this, "_editor_text_changed"); + text_edit->call_deferred("connect", "text_changed", Callable(this, "_editor_text_changed")); results_count = -1; } @@ -559,7 +559,7 @@ void FindReplaceBar::set_text_edit(TextEdit *p_text_edit) { results_count = -1; text_edit = p_text_edit; - text_edit->connect("text_changed", this, "_editor_text_changed"); + text_edit->connect_compat("text_changed", this, "_editor_text_changed"); } void FindReplaceBar::_bind_methods() { @@ -613,8 +613,8 @@ FindReplaceBar::FindReplaceBar() { search_text = memnew(LineEdit); vbc_lineedit->add_child(search_text); search_text->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); - search_text->connect("text_changed", this, "_search_text_changed"); - search_text->connect("text_entered", this, "_search_text_entered"); + search_text->connect_compat("text_changed", this, "_search_text_changed"); + search_text->connect_compat("text_entered", this, "_search_text_entered"); matches_label = memnew(Label); hbc_button_search->add_child(matches_label); @@ -623,51 +623,51 @@ FindReplaceBar::FindReplaceBar() { find_prev = memnew(ToolButton); hbc_button_search->add_child(find_prev); find_prev->set_focus_mode(FOCUS_NONE); - find_prev->connect("pressed", this, "_search_prev"); + find_prev->connect_compat("pressed", this, "_search_prev"); find_next = memnew(ToolButton); hbc_button_search->add_child(find_next); find_next->set_focus_mode(FOCUS_NONE); - find_next->connect("pressed", this, "_search_next"); + find_next->connect_compat("pressed", this, "_search_next"); case_sensitive = memnew(CheckBox); hbc_option_search->add_child(case_sensitive); case_sensitive->set_text(TTR("Match Case")); case_sensitive->set_focus_mode(FOCUS_NONE); - case_sensitive->connect("toggled", this, "_search_options_changed"); + case_sensitive->connect_compat("toggled", this, "_search_options_changed"); whole_words = memnew(CheckBox); hbc_option_search->add_child(whole_words); whole_words->set_text(TTR("Whole Words")); whole_words->set_focus_mode(FOCUS_NONE); - whole_words->connect("toggled", this, "_search_options_changed"); + whole_words->connect_compat("toggled", this, "_search_options_changed"); // replace toolbar replace_text = memnew(LineEdit); vbc_lineedit->add_child(replace_text); replace_text->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); - replace_text->connect("text_entered", this, "_replace_text_entered"); + replace_text->connect_compat("text_entered", this, "_replace_text_entered"); replace = memnew(Button); hbc_button_replace->add_child(replace); replace->set_text(TTR("Replace")); - replace->connect("pressed", this, "_replace_pressed"); + replace->connect_compat("pressed", this, "_replace_pressed"); replace_all = memnew(Button); hbc_button_replace->add_child(replace_all); replace_all->set_text(TTR("Replace All")); - replace_all->connect("pressed", this, "_replace_all_pressed"); + replace_all->connect_compat("pressed", this, "_replace_all_pressed"); selection_only = memnew(CheckBox); hbc_option_replace->add_child(selection_only); selection_only->set_text(TTR("Selection Only")); selection_only->set_focus_mode(FOCUS_NONE); - selection_only->connect("toggled", this, "_search_options_changed"); + selection_only->connect_compat("toggled", this, "_search_options_changed"); hide_button = memnew(TextureButton); add_child(hide_button); hide_button->set_focus_mode(FOCUS_NONE); - hide_button->connect("pressed", this, "_hide_pressed"); + hide_button->connect_compat("pressed", this, "_hide_pressed"); hide_button->set_v_size_flags(SIZE_SHRINK_CENTER); } @@ -1717,7 +1717,7 @@ CodeTextEditor::CodeTextEditor() { error_column = 0; toggle_scripts_button = memnew(ToolButton); - toggle_scripts_button->connect("pressed", this, "_toggle_scripts_pressed"); + toggle_scripts_button->connect_compat("pressed", this, "_toggle_scripts_pressed"); status_bar->add_child(toggle_scripts_button); toggle_scripts_button->hide(); @@ -1732,15 +1732,15 @@ CodeTextEditor::CodeTextEditor() { scroll->add_child(error); error->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER); error->set_mouse_filter(MOUSE_FILTER_STOP); - error->connect("gui_input", this, "_error_pressed"); - find_replace_bar->connect("error", error, "set_text"); + error->connect_compat("gui_input", this, "_error_pressed"); + find_replace_bar->connect_compat("error", error, "set_text"); // Warnings warning_button = memnew(ToolButton); status_bar->add_child(warning_button); warning_button->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER); warning_button->set_default_cursor_shape(CURSOR_POINTING_HAND); - warning_button->connect("pressed", this, "_warning_button_pressed"); + warning_button->connect_compat("pressed", this, "_warning_button_pressed"); warning_button->set_tooltip(TTR("Warnings")); warning_count_label = memnew(Label); @@ -1752,7 +1752,7 @@ CodeTextEditor::CodeTextEditor() { warning_count_label->set_tooltip(TTR("Warnings")); warning_count_label->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("warning_color", "Editor")); warning_count_label->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); - warning_count_label->connect("gui_input", this, "_warning_label_gui_input"); + warning_count_label->connect_compat("gui_input", this, "_warning_label_gui_input"); is_warnings_panel_opened = false; set_warning_nb(0); @@ -1765,10 +1765,10 @@ CodeTextEditor::CodeTextEditor() { line_and_col_txt->set_tooltip(TTR("Line and column numbers.")); line_and_col_txt->set_mouse_filter(MOUSE_FILTER_STOP); - text_editor->connect("gui_input", this, "_text_editor_gui_input"); - text_editor->connect("cursor_changed", this, "_line_col_changed"); - text_editor->connect("text_changed", this, "_text_changed"); - text_editor->connect("request_completion", this, "_complete_request"); + text_editor->connect_compat("gui_input", this, "_text_editor_gui_input"); + text_editor->connect_compat("cursor_changed", this, "_line_col_changed"); + text_editor->connect_compat("text_changed", this, "_text_changed"); + text_editor->connect_compat("request_completion", this, "_complete_request"); Vector<String> cs; cs.push_back("."); cs.push_back(","); @@ -1776,9 +1776,9 @@ CodeTextEditor::CodeTextEditor() { cs.push_back("="); cs.push_back("$"); text_editor->set_completion(true, cs); - idle->connect("timeout", this, "_text_changed_idle_timeout"); + idle->connect_compat("timeout", this, "_text_changed_idle_timeout"); - code_complete_timer->connect("timeout", this, "_code_complete_timer_timeout"); + code_complete_timer->connect_compat("timeout", this, "_code_complete_timer_timeout"); font_resize_val = 0; font_size = EditorSettings::get_singleton()->get("interface/editor/code_font_size"); @@ -1786,7 +1786,7 @@ CodeTextEditor::CodeTextEditor() { add_child(font_resize_timer); font_resize_timer->set_one_shot(true); font_resize_timer->set_wait_time(0.07); - font_resize_timer->connect("timeout", this, "_font_resize_timeout"); + font_resize_timer->connect_compat("timeout", this, "_font_resize_timeout"); - EditorSettings::get_singleton()->connect("settings_changed", this, "_on_settings_change"); + EditorSettings::get_singleton()->connect_compat("settings_changed", this, "_on_settings_change"); } diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index c2c9a88bf0..69a19b3e83 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -304,7 +304,7 @@ bool ConnectDialog::is_editing() const { * If creating a connection from scratch, sensible defaults are used. * If editing an existing connection, previous data is retained. */ -void ConnectDialog::init(Connection c, bool bEdit) { +void ConnectDialog::init(ConnectionData c, bool bEdit) { set_hide_on_ok(false); @@ -389,8 +389,8 @@ ConnectDialog::ConnectDialog() { tree = memnew(SceneTreeEditor(false)); tree->set_connecting_signal(true); - tree->get_scene_tree()->connect("item_activated", this, "_ok"); - tree->connect("node_selected", this, "_tree_node_selected"); + tree->get_scene_tree()->connect_compat("item_activated", this, "_ok"); + tree->connect_compat("node_selected", this, "_tree_node_selected"); tree->set_connect_to_script_mode(true); Node *mc = vbc_left->add_margin_child(TTR("Connect to Script:"), tree, true); @@ -429,12 +429,12 @@ ConnectDialog::ConnectDialog() { Button *add_bind = memnew(Button); add_bind->set_text(TTR("Add")); add_bind_hb->add_child(add_bind); - add_bind->connect("pressed", this, "_add_bind"); + add_bind->connect_compat("pressed", this, "_add_bind"); Button *del_bind = memnew(Button); del_bind->set_text(TTR("Remove")); add_bind_hb->add_child(del_bind); - del_bind->connect("pressed", this, "_remove_bind"); + del_bind->connect_compat("pressed", this, "_remove_bind"); vbc_right->add_margin_child(TTR("Add Extra Call Argument:"), add_bind_hb); @@ -447,13 +447,13 @@ ConnectDialog::ConnectDialog() { dst_method = memnew(LineEdit); dst_method->set_h_size_flags(SIZE_EXPAND_FILL); - dst_method->connect("text_entered", this, "_builtin_text_entered"); + dst_method->connect_compat("text_entered", this, "_builtin_text_entered"); dstm_hb->add_child(dst_method); advanced = memnew(CheckButton); dstm_hb->add_child(advanced); advanced->set_text(TTR("Advanced")); - advanced->connect("pressed", this, "_advanced_pressed"); + advanced->connect_compat("pressed", this, "_advanced_pressed"); // Add spacing so the tree and inspector are the same size. Control *spacing = memnew(Control); @@ -525,7 +525,7 @@ void ConnectionsDock::_make_or_edit_connection() { Node *target = selectedNode->get_node(dst_path); ERR_FAIL_COND(!target); - Connection cToMake; + ConnectDialog::ConnectionData cToMake; cToMake.source = connect_dialog->get_source(); cToMake.target = target; cToMake.signal = connect_dialog->get_signal_name(); @@ -585,7 +585,7 @@ void ConnectionsDock::_make_or_edit_connection() { /* * Creates single connection w/ undo-redo functionality. */ -void ConnectionsDock::_connect(Connection cToMake) { +void ConnectionsDock::_connect(ConnectDialog::ConnectionData cToMake) { Node *source = static_cast<Node *>(cToMake.source); Node *target = static_cast<Node *>(cToMake.target); @@ -595,8 +595,10 @@ void ConnectionsDock::_connect(Connection cToMake) { undo_redo->create_action(vformat(TTR("Connect '%s' to '%s'"), String(cToMake.signal), String(cToMake.method))); - undo_redo->add_do_method(source, "connect", cToMake.signal, target, cToMake.method, cToMake.binds, cToMake.flags); - undo_redo->add_undo_method(source, "disconnect", cToMake.signal, target, cToMake.method); + Callable c(target, cToMake.method); + + undo_redo->add_do_method(source, "connect", cToMake.signal, c, cToMake.binds, cToMake.flags); + undo_redo->add_undo_method(source, "disconnect", cToMake.signal, c); undo_redo->add_do_method(this, "update_tree"); undo_redo->add_undo_method(this, "update_tree"); undo_redo->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(), "update_tree"); //to force redraw of scene tree @@ -610,13 +612,15 @@ void ConnectionsDock::_connect(Connection cToMake) { */ void ConnectionsDock::_disconnect(TreeItem &item) { - Connection c = item.get_metadata(0); + Connection cd = item.get_metadata(0); + ConnectDialog::ConnectionData c = cd; + ERR_FAIL_COND(c.source != selectedNode); // Shouldn't happen but... Bugcheck. undo_redo->create_action(vformat(TTR("Disconnect '%s' from '%s'"), c.signal, c.method)); - undo_redo->add_do_method(selectedNode, "disconnect", c.signal, c.target, c.method); - undo_redo->add_undo_method(selectedNode, "connect", c.signal, c.target, c.method, c.binds, c.flags); + undo_redo->add_do_method(selectedNode, "disconnect", c.signal, Callable(c.target, c.method)); + undo_redo->add_undo_method(selectedNode, "connect", c.signal, Callable(c.target, c.method), c.binds, c.flags); undo_redo->add_do_method(this, "update_tree"); undo_redo->add_undo_method(this, "update_tree"); undo_redo->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(), "update_tree"); // To force redraw of scene tree. @@ -641,9 +645,10 @@ void ConnectionsDock::_disconnect_all() { undo_redo->create_action(vformat(TTR("Disconnect all from signal: '%s'"), signalName)); while (child) { - Connection c = child->get_metadata(0); - undo_redo->add_do_method(selectedNode, "disconnect", c.signal, c.target, c.method); - undo_redo->add_undo_method(selectedNode, "connect", c.signal, c.target, c.method, c.binds, c.flags); + Connection cd = child->get_metadata(0); + ConnectDialog::ConnectionData c = cd; + undo_redo->add_do_method(selectedNode, "disconnect", c.signal, Callable(c.target, c.method)); + undo_redo->add_undo_method(selectedNode, "connect", c.signal, Callable(c.target, c.method), c.binds, c.flags); child = child->get_next(); } @@ -720,7 +725,7 @@ void ConnectionsDock::_open_connection_dialog(TreeItem &item) { StringName dst_method = "_on_" + midname + "_" + signal; - Connection c; + ConnectDialog::ConnectionData c; c.source = selectedNode; c.signal = StringName(signalname); c.target = dst_node; @@ -733,7 +738,7 @@ void ConnectionsDock::_open_connection_dialog(TreeItem &item) { /* * Open connection dialog with Connection data to EDIT an existing connection. */ -void ConnectionsDock::_open_connection_dialog(Connection cToEdit) { +void ConnectionsDock::_open_connection_dialog(ConnectDialog::ConnectionData cToEdit) { Node *src = static_cast<Node *>(cToEdit.source); Node *dst = static_cast<Node *>(cToEdit.target); @@ -753,7 +758,8 @@ void ConnectionsDock::_go_to_script(TreeItem &item) { if (_is_item_signal(item)) return; - Connection c = item.get_metadata(0); + Connection cd = item.get_metadata(0); + ConnectDialog::ConnectionData c = cd; ERR_FAIL_COND(c.source != selectedNode); //shouldn't happen but...bugcheck if (!c.target) @@ -1014,7 +1020,7 @@ void ConnectionsDock::update_tree() { for (List<Object::Connection>::Element *F = connections.front(); F; F = F->next()) { - Object::Connection &c = F->get(); + ConnectDialog::ConnectionData c = F->get(); if (!(c.flags & CONNECT_PERSIST)) continue; @@ -1041,7 +1047,8 @@ void ConnectionsDock::update_tree() { TreeItem *item2 = tree->create_item(item); item2->set_text(0, path); - item2->set_metadata(0, c); + Connection cd = c; + item2->set_metadata(0, cd); item2->set_icon(0, get_icon("Slot", "EditorIcons")); } } @@ -1077,7 +1084,7 @@ ConnectionsDock::ConnectionsDock(EditorNode *p_editor) { vbc->add_child(hb); hb->add_spacer(); hb->add_child(connect_button); - connect_button->connect("pressed", this, "_connect_pressed"); + connect_button->connect_compat("pressed", this, "_connect_pressed"); connect_dialog = memnew(ConnectDialog); connect_dialog->set_as_toplevel(true); @@ -1086,26 +1093,26 @@ ConnectionsDock::ConnectionsDock(EditorNode *p_editor) { disconnect_all_dialog = memnew(ConfirmationDialog); disconnect_all_dialog->set_as_toplevel(true); add_child(disconnect_all_dialog); - disconnect_all_dialog->connect("confirmed", this, "_disconnect_all"); + disconnect_all_dialog->connect_compat("confirmed", this, "_disconnect_all"); disconnect_all_dialog->set_text(TTR("Are you sure you want to remove all connections from this signal?")); signal_menu = memnew(PopupMenu); add_child(signal_menu); - signal_menu->connect("id_pressed", this, "_handle_signal_menu_option"); + signal_menu->connect_compat("id_pressed", this, "_handle_signal_menu_option"); signal_menu->add_item(TTR("Connect..."), CONNECT); signal_menu->add_item(TTR("Disconnect All"), DISCONNECT_ALL); slot_menu = memnew(PopupMenu); add_child(slot_menu); - slot_menu->connect("id_pressed", this, "_handle_slot_menu_option"); + slot_menu->connect_compat("id_pressed", this, "_handle_slot_menu_option"); slot_menu->add_item(TTR("Edit..."), EDIT); slot_menu->add_item(TTR("Go To Method"), GO_TO_SCRIPT); slot_menu->add_item(TTR("Disconnect"), DISCONNECT); - connect_dialog->connect("connected", this, "_make_or_edit_connection"); - tree->connect("item_selected", this, "_tree_item_selected"); - tree->connect("item_activated", this, "_tree_item_activated"); - tree->connect("item_rmb_selected", this, "_rmb_pressed"); + connect_dialog->connect_compat("connected", this, "_make_or_edit_connection"); + tree->connect_compat("item_selected", this, "_tree_item_selected"); + tree->connect_compat("item_activated", this, "_tree_item_activated"); + tree->connect_compat("item_rmb_selected", this, "_rmb_pressed"); add_constant_override("separation", 3 * EDSCALE); } diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h index 7e39d7d904..a4ed68b44e 100644 --- a/editor/connections_dialog.h +++ b/editor/connections_dialog.h @@ -53,6 +53,36 @@ class ConnectDialog : public ConfirmationDialog { GDCLASS(ConnectDialog, ConfirmationDialog); +public: + struct ConnectionData { + Node *source = nullptr; + Node *target = nullptr; + StringName signal; + StringName method; + uint32_t flags = 0; + Vector<Variant> binds; + + ConnectionData() { + } + ConnectionData(const Connection &p_connection) { + source = Object::cast_to<Node>(p_connection.signal.get_object()); + signal = p_connection.signal.get_name(); + target = Object::cast_to<Node>(p_connection.callable.get_object()); + method = p_connection.callable.get_method(); + flags = p_connection.flags; + binds = p_connection.binds; + } + operator Connection() { + Connection c; + c.signal = ::Signal(source, signal); + c.callable = Callable(target, method); + c.flags = flags; + c.binds = binds; + return c; + } + }; + +private: Label *connect_to_label; LineEdit *from_signal; Node *source; @@ -98,7 +128,7 @@ public: bool get_oneshot() const; bool is_editing() const; - void init(Connection c, bool bEdit = false); + void init(ConnectionData c, bool bEdit = false); void popup_dialog(const String &p_for_signal); ConnectDialog(); @@ -144,7 +174,7 @@ class ConnectionsDock : public VBoxContainer { Map<StringName, Map<StringName, String> > descr_cache; void _make_or_edit_connection(); - void _connect(Connection cToMake); + void _connect(ConnectDialog::ConnectionData cToMake); void _disconnect(TreeItem &item); void _disconnect_all(); @@ -153,7 +183,7 @@ class ConnectionsDock : public VBoxContainer { bool _is_item_signal(TreeItem &item); void _open_connection_dialog(TreeItem &item); - void _open_connection_dialog(Connection cToEdit); + void _open_connection_dialog(ConnectDialog::ConnectionData cToEdit); void _go_to_script(TreeItem &item); void _handle_signal_menu_option(int option); diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 4adb3844bc..9584443c75 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -459,13 +459,13 @@ void CreateDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - connect("confirmed", this, "_confirmed"); + connect_compat("confirmed", this, "_confirmed"); search_box->set_right_icon(get_icon("Search", "EditorIcons")); search_box->set_clear_button_enabled(true); favorite->set_icon(get_icon("Favorites", "EditorIcons")); } break; case NOTIFICATION_EXIT_TREE: { - disconnect("confirmed", this, "_confirmed"); + disconnect_compat("confirmed", this, "_confirmed"); } break; case NOTIFICATION_VISIBILITY_CHANGED: { if (is_visible_in_tree()) { @@ -766,8 +766,8 @@ CreateDialog::CreateDialog() { favorites->set_hide_root(true); favorites->set_hide_folding(true); favorites->set_allow_reselect(true); - favorites->connect("cell_selected", this, "_favorite_selected"); - favorites->connect("item_activated", this, "_favorite_activated"); + favorites->connect_compat("cell_selected", this, "_favorite_selected"); + favorites->connect_compat("item_activated", this, "_favorite_activated"); favorites->set_drag_forwarding(this); favorites->add_constant_override("draw_guides", 1); @@ -781,8 +781,8 @@ CreateDialog::CreateDialog() { recent->set_hide_root(true); recent->set_hide_folding(true); recent->set_allow_reselect(true); - recent->connect("cell_selected", this, "_history_selected"); - recent->connect("item_activated", this, "_history_activated"); + recent->connect_compat("cell_selected", this, "_history_selected"); + recent->connect_compat("item_activated", this, "_history_activated"); recent->add_constant_override("draw_guides", 1); VBoxContainer *vbc = memnew(VBoxContainer); @@ -797,23 +797,23 @@ CreateDialog::CreateDialog() { favorite->set_flat(true); favorite->set_toggle_mode(true); search_hb->add_child(favorite); - favorite->connect("pressed", this, "_favorite_toggled"); + favorite->connect_compat("pressed", this, "_favorite_toggled"); vbc->add_margin_child(TTR("Search:"), search_hb); - search_box->connect("text_changed", this, "_text_changed"); - search_box->connect("gui_input", this, "_sbox_input"); + search_box->connect_compat("text_changed", this, "_text_changed"); + search_box->connect_compat("gui_input", this, "_sbox_input"); search_options = memnew(Tree); vbc->add_margin_child(TTR("Matches:"), search_options, true); get_ok()->set_disabled(true); register_text_enter(search_box); set_hide_on_ok(false); - search_options->connect("item_activated", this, "_confirmed"); - search_options->connect("cell_selected", this, "_item_selected"); + search_options->connect_compat("item_activated", this, "_confirmed"); + search_options->connect_compat("cell_selected", this, "_item_selected"); base_type = "Object"; preferred_search_result_type = ""; help_bit = memnew(EditorHelpBit); vbc->add_margin_child(TTR("Description:"), help_bit); - help_bit->connect("request_hide", this, "_closed"); + help_bit->connect_compat("request_hide", this, "_closed"); type_blacklist.insert("PluginScript"); // PluginScript must be initialized before use, which is not possible here type_blacklist.insert("ScriptCreateDialog"); // This is an exposed editor Node that doesn't have an Editor prefix. diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index 46f6815f77..e2a447cfcf 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -247,7 +247,7 @@ DependencyEditor::DependencyEditor() { tree->set_column_title(0, TTR("Resource")); tree->set_column_title(1, TTR("Path")); tree->set_hide_root(true); - tree->connect("button_pressed", this, "_load_pressed"); + tree->connect_compat("button_pressed", this, "_load_pressed"); HBoxContainer *hbc = memnew(HBoxContainer); Label *label = memnew(Label(TTR("Dependencies:"))); @@ -255,7 +255,7 @@ DependencyEditor::DependencyEditor() { hbc->add_spacer(); fixdeps = memnew(Button(TTR("Fix Broken"))); hbc->add_child(fixdeps); - fixdeps->connect("pressed", this, "_fix_all"); + fixdeps->connect_compat("pressed", this, "_fix_all"); vb->add_child(hbc); @@ -267,7 +267,7 @@ DependencyEditor::DependencyEditor() { set_title(TTR("Dependency Editor")); search = memnew(EditorFileDialog); - search->connect("file_selected", this, "_searched"); + search->connect_compat("file_selected", this, "_searched"); search->set_mode(EditorFileDialog::MODE_OPEN_FILE); search->set_title(TTR("Search Replacement Resource:")); add_child(search); @@ -360,12 +360,12 @@ DependencyEditorOwners::DependencyEditorOwners(EditorNode *p_editor) { file_options = memnew(PopupMenu); add_child(file_options); - file_options->connect("id_pressed", this, "_file_option"); + file_options->connect_compat("id_pressed", this, "_file_option"); owners = memnew(ItemList); owners->set_select_mode(ItemList::SELECT_SINGLE); - owners->connect("item_rmb_selected", this, "_list_rmb_select"); - owners->connect("item_activated", this, "_select_file"); + owners->connect_compat("item_rmb_selected", this, "_list_rmb_select"); + owners->connect_compat("item_activated", this, "_select_file"); owners->set_allow_rmb_select(true); add_child(owners); } @@ -800,7 +800,7 @@ OrphanResourcesDialog::OrphanResourcesDialog() { add_child(delete_confirm); dep_edit = memnew(DependencyEditor); add_child(dep_edit); - delete_confirm->connect("confirmed", this, "_delete_confirm"); + delete_confirm->connect_compat("confirmed", this, "_delete_confirm"); set_hide_on_ok(false); VBoxContainer *vbc = memnew(VBoxContainer); @@ -816,5 +816,5 @@ OrphanResourcesDialog::OrphanResourcesDialog() { files->set_column_title(1, TTR("Owns")); files->set_hide_root(true); vbc->add_margin_child(TTR("Resources Without Explicit Ownership:"), files, true); - files->connect("button_pressed", this, "_button_pressed"); + files->connect_compat("button_pressed", this, "_button_pressed"); } diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp index de3d13cdac..3fd9e3182d 100644 --- a/editor/doc/doc_data.cpp +++ b/editor/doc/doc_data.cpp @@ -533,7 +533,7 @@ void DocData::generate(bool p_basic_types) { ClassDoc &c = class_list[cname]; c.name = cname; - Variant::CallError cerror; + Callable::CallError cerror; Variant v = Variant::construct(Variant::Type(i), NULL, 0, cerror); List<MethodInfo> method_list; @@ -562,11 +562,12 @@ void DocData::generate(bool p_basic_types) { method.arguments.push_back(ad); } - if (mi.return_val.type == Variant::NIL) { - if (mi.return_val.name != "") - method.return_type = "Variant"; - } else { - method.return_type = Variant::get_type_name(mi.return_val.type); + return_doc_from_retinfo(method, mi.return_val); + + if (mi.flags & METHOD_FLAG_VARARG) { + if (method.qualifiers != "") + method.qualifiers += " "; + method.qualifiers += "vararg"; } c.methods.push_back(method); diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp index ba653017ef..37d653ed43 100644 --- a/editor/editor_about.cpp +++ b/editor/editor_about.cpp @@ -255,7 +255,7 @@ EditorAbout::EditorAbout() { _tpl_text->set_v_size_flags(Control::SIZE_EXPAND_FILL); tpl_hbc->add_child(_tpl_text); - _tpl_tree->connect("item_selected", this, "_license_tree_selected"); + _tpl_tree->connect_compat("item_selected", this, "_license_tree_selected"); tpl_ti_all->select(0); _tpl_text->set_text(tpl_ti_all->get_metadata(0)); } diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp index 783b996c4d..8a6fc4cd12 100644 --- a/editor/editor_asset_installer.cpp +++ b/editor/editor_asset_installer.cpp @@ -318,7 +318,7 @@ EditorAssetInstaller::EditorAssetInstaller() { tree = memnew(Tree); vb->add_margin_child(TTR("Package Contents:"), tree, true); - tree->connect("item_edited", this, "_item_edited"); + tree->connect_compat("item_edited", this, "_item_edited"); error = memnew(AcceptDialog); add_child(error); diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 594322f00d..1a72b6e1ca 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -799,8 +799,8 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { set_v_size_flags(SIZE_EXPAND_FILL); track_name = memnew(LineEdit); - track_name->connect("text_entered", this, "_name_changed"); - track_name->connect("focus_exited", this, "_name_focus_exit"); + track_name->connect_compat("text_entered", this, "_name_changed"); + track_name->connect_compat("focus_exited", this, "_name_focus_exit"); vb->add_child(track_name); HBoxContainer *hbc = memnew(HBoxContainer); @@ -809,19 +809,19 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { solo->set_toggle_mode(true); solo->set_tooltip(TTR("Solo")); solo->set_focus_mode(FOCUS_NONE); - solo->connect("pressed", this, "_solo_toggled"); + solo->connect_compat("pressed", this, "_solo_toggled"); hbc->add_child(solo); mute = memnew(ToolButton); mute->set_toggle_mode(true); mute->set_tooltip(TTR("Mute")); mute->set_focus_mode(FOCUS_NONE); - mute->connect("pressed", this, "_mute_toggled"); + mute->connect_compat("pressed", this, "_mute_toggled"); hbc->add_child(mute); bypass = memnew(ToolButton); bypass->set_toggle_mode(true); bypass->set_tooltip(TTR("Bypass")); bypass->set_focus_mode(FOCUS_NONE); - bypass->connect("pressed", this, "_bypass_toggled"); + bypass->connect_compat("pressed", this, "_bypass_toggled"); hbc->add_child(bypass); hbc->add_spacer(); @@ -878,9 +878,9 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { preview_timer->set_one_shot(true); add_child(preview_timer); - slider->connect("value_changed", this, "_volume_changed"); - slider->connect("value_changed", this, "_show_value"); - preview_timer->connect("timeout", this, "_hide_value_preview"); + slider->connect_compat("value_changed", this, "_volume_changed"); + slider->connect_compat("value_changed", this, "_show_value"); + preview_timer->connect_compat("timeout", this, "_hide_value_preview"); hb->add_child(slider); cc = 0; @@ -918,24 +918,24 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { effects->set_hide_folding(true); effects->set_v_size_flags(SIZE_EXPAND_FILL); vb->add_child(effects); - effects->connect("item_edited", this, "_effect_edited"); - effects->connect("cell_selected", this, "_effect_selected"); + effects->connect_compat("item_edited", this, "_effect_edited"); + effects->connect_compat("cell_selected", this, "_effect_selected"); effects->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true); effects->set_drag_forwarding(this); - effects->connect("item_rmb_selected", this, "_effect_rmb"); + effects->connect_compat("item_rmb_selected", this, "_effect_rmb"); effects->set_allow_rmb_select(true); effects->set_focus_mode(FOCUS_CLICK); effects->set_allow_reselect(true); send = memnew(OptionButton); send->set_clip_text(true); - send->connect("item_selected", this, "_send_selected"); + send->connect_compat("item_selected", this, "_send_selected"); vb->add_child(send); set_focus_mode(FOCUS_CLICK); effect_options = memnew(PopupMenu); - effect_options->connect("index_pressed", this, "_effect_add"); + effect_options->connect_compat("index_pressed", this, "_effect_add"); add_child(effect_options); List<StringName> effects; ClassDB::get_inheriters_from_class("AudioEffect", &effects); @@ -956,12 +956,12 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { bus_popup->add_item(TTR("Delete")); bus_popup->set_item_disabled(1, is_master); bus_popup->add_item(TTR("Reset Volume")); - bus_popup->connect("index_pressed", this, "_bus_popup_pressed"); + bus_popup->connect_compat("index_pressed", this, "_bus_popup_pressed"); delete_effect_popup = memnew(PopupMenu); delete_effect_popup->add_item(TTR("Delete Effect")); add_child(delete_effect_popup); - delete_effect_popup->connect("index_pressed", this, "_delete_effect_pressed"); + delete_effect_popup->connect_compat("index_pressed", this, "_delete_effect_pressed"); } void EditorAudioBusDrop::_notification(int p_what) { @@ -1029,11 +1029,11 @@ void EditorAudioBuses::_update_buses() { bool is_master = (i == 0); EditorAudioBus *audio_bus = memnew(EditorAudioBus(this, is_master)); bus_hb->add_child(audio_bus); - audio_bus->connect("delete_request", this, "_delete_bus", varray(audio_bus), CONNECT_DEFERRED); - audio_bus->connect("duplicate_request", this, "_duplicate_bus", varray(), CONNECT_DEFERRED); - audio_bus->connect("vol_reset_request", this, "_reset_bus_volume", varray(audio_bus), CONNECT_DEFERRED); - audio_bus->connect("drop_end_request", this, "_request_drop_end"); - audio_bus->connect("dropped", this, "_drop_at_index", varray(), CONNECT_DEFERRED); + audio_bus->connect_compat("delete_request", this, "_delete_bus", varray(audio_bus), CONNECT_DEFERRED); + audio_bus->connect_compat("duplicate_request", this, "_duplicate_bus", varray(), CONNECT_DEFERRED); + audio_bus->connect_compat("vol_reset_request", this, "_reset_bus_volume", varray(audio_bus), CONNECT_DEFERRED); + audio_bus->connect_compat("drop_end_request", this, "_request_drop_end"); + audio_bus->connect_compat("dropped", this, "_drop_at_index", varray(), CONNECT_DEFERRED); } } @@ -1187,7 +1187,7 @@ void EditorAudioBuses::_request_drop_end() { bus_hb->add_child(drop_end); drop_end->set_custom_minimum_size(Object::cast_to<Control>(bus_hb->get_child(0))->get_size()); - drop_end->connect("dropped", this, "_drop_at_index", varray(), CONNECT_DEFERRED); + drop_end->connect_compat("dropped", this, "_drop_at_index", varray(), CONNECT_DEFERRED); } } @@ -1339,7 +1339,7 @@ EditorAudioBuses::EditorAudioBuses() { top_hb->add_child(add); add->set_text(TTR("Add Bus")); add->set_tooltip(TTR("Add a new Audio Bus to this layout.")); - add->connect("pressed", this, "_add_bus"); + add->connect_compat("pressed", this, "_add_bus"); VSeparator *separator = memnew(VSeparator); top_hb->add_child(separator); @@ -1348,25 +1348,25 @@ EditorAudioBuses::EditorAudioBuses() { load->set_text(TTR("Load")); load->set_tooltip(TTR("Load an existing Bus Layout.")); top_hb->add_child(load); - load->connect("pressed", this, "_load_layout"); + load->connect_compat("pressed", this, "_load_layout"); save_as = memnew(Button); save_as->set_text(TTR("Save As")); save_as->set_tooltip(TTR("Save this Bus Layout to a file.")); top_hb->add_child(save_as); - save_as->connect("pressed", this, "_save_as_layout"); + save_as->connect_compat("pressed", this, "_save_as_layout"); _default = memnew(Button); _default->set_text(TTR("Load Default")); _default->set_tooltip(TTR("Load the default Bus Layout.")); top_hb->add_child(_default); - _default->connect("pressed", this, "_load_default_layout"); + _default->connect_compat("pressed", this, "_load_default_layout"); _new = memnew(Button); _new->set_text(TTR("Create")); _new->set_tooltip(TTR("Create a new Bus Layout.")); top_hb->add_child(_new); - _new->connect("pressed", this, "_new_layout"); + _new->connect_compat("pressed", this, "_new_layout"); bus_scroll = memnew(ScrollContainer); bus_scroll->set_v_size_flags(SIZE_EXPAND_FILL); @@ -1381,7 +1381,7 @@ EditorAudioBuses::EditorAudioBuses() { save_timer->set_wait_time(0.8); save_timer->set_one_shot(true); add_child(save_timer); - save_timer->connect("timeout", this, "_server_save"); + save_timer->connect_compat("timeout", this, "_server_save"); set_v_size_flags(SIZE_EXPAND_FILL); @@ -1394,7 +1394,7 @@ EditorAudioBuses::EditorAudioBuses() { file_dialog->add_filter("*." + E->get() + "; Audio Bus Layout"); } add_child(file_dialog); - file_dialog->connect("file_selected", this, "_file_dialog_callback"); + file_dialog->connect_compat("file_selected", this, "_file_dialog_callback"); set_process(true); } diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index 77a23fb336..feb6dbd302 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -835,8 +835,8 @@ EditorAutoloadSettings::EditorAutoloadSettings() { autoload_add_path = memnew(EditorLineEditFileChooser); autoload_add_path->set_h_size_flags(SIZE_EXPAND_FILL); autoload_add_path->get_file_dialog()->set_mode(EditorFileDialog::MODE_OPEN_FILE); - autoload_add_path->get_file_dialog()->connect("file_selected", this, "_autoload_file_callback"); - autoload_add_path->get_line_edit()->connect("text_changed", this, "_autoload_path_text_changed"); + autoload_add_path->get_file_dialog()->connect_compat("file_selected", this, "_autoload_file_callback"); + autoload_add_path->get_line_edit()->connect_compat("text_changed", this, "_autoload_path_text_changed"); hbc->add_child(autoload_add_path); @@ -846,13 +846,13 @@ EditorAutoloadSettings::EditorAutoloadSettings() { autoload_add_name = memnew(LineEdit); autoload_add_name->set_h_size_flags(SIZE_EXPAND_FILL); - autoload_add_name->connect("text_entered", this, "_autoload_text_entered"); - autoload_add_name->connect("text_changed", this, "_autoload_text_changed"); + autoload_add_name->connect_compat("text_entered", this, "_autoload_text_entered"); + autoload_add_name->connect_compat("text_changed", this, "_autoload_text_changed"); hbc->add_child(autoload_add_name); add_autoload = memnew(Button); add_autoload->set_text(TTR("Add")); - add_autoload->connect("pressed", this, "_autoload_add"); + add_autoload->connect_compat("pressed", this, "_autoload_add"); // The button will be enabled once a valid name is entered (either automatically or manually). add_autoload->set_disabled(true); hbc->add_child(add_autoload); @@ -882,10 +882,10 @@ EditorAutoloadSettings::EditorAutoloadSettings() { tree->set_column_expand(3, false); tree->set_column_min_width(3, 120 * EDSCALE); - tree->connect("cell_selected", this, "_autoload_selected"); - tree->connect("item_edited", this, "_autoload_edited"); - tree->connect("button_pressed", this, "_autoload_button_pressed"); - tree->connect("item_activated", this, "_autoload_activated"); + tree->connect_compat("cell_selected", this, "_autoload_selected"); + tree->connect_compat("item_edited", this, "_autoload_edited"); + tree->connect_compat("button_pressed", this, "_autoload_button_pressed"); + tree->connect_compat("item_activated", this, "_autoload_activated"); tree->set_v_size_flags(SIZE_EXPAND_FILL); add_child(tree, true); diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 1468b8fc35..c3592d3f06 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -1024,7 +1024,7 @@ void EditorSelection::add_node(Node *p_node) { } selection[p_node] = meta; - p_node->connect("tree_exiting", this, "_node_removed", varray(p_node), CONNECT_ONESHOT); + p_node->connect_compat("tree_exiting", this, "_node_removed", varray(p_node), CONNECT_ONESHOT); //emit_signal("selection_changed"); } @@ -1042,7 +1042,7 @@ void EditorSelection::remove_node(Node *p_node) { if (meta) memdelete(meta); selection.erase(p_node); - p_node->disconnect("tree_exiting", this, "_node_removed"); + p_node->disconnect_compat("tree_exiting", this, "_node_removed"); //emit_signal("selection_changed"); } bool EditorSelection::is_selected(Node *p_node) const { diff --git a/editor/editor_dir_dialog.cpp b/editor/editor_dir_dialog.cpp index 09e63f70b4..841ad250a4 100644 --- a/editor/editor_dir_dialog.cpp +++ b/editor/editor_dir_dialog.cpp @@ -82,21 +82,21 @@ void EditorDirDialog::reload(const String &p_path) { void EditorDirDialog::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - EditorFileSystem::get_singleton()->connect("filesystem_changed", this, "reload"); + EditorFileSystem::get_singleton()->connect_compat("filesystem_changed", this, "reload"); reload(); - if (!tree->is_connected("item_collapsed", this, "_item_collapsed")) { - tree->connect("item_collapsed", this, "_item_collapsed", varray(), CONNECT_DEFERRED); + if (!tree->is_connected_compat("item_collapsed", this, "_item_collapsed")) { + tree->connect_compat("item_collapsed", this, "_item_collapsed", varray(), CONNECT_DEFERRED); } - if (!EditorFileSystem::get_singleton()->is_connected("filesystem_changed", this, "reload")) { - EditorFileSystem::get_singleton()->connect("filesystem_changed", this, "reload"); + if (!EditorFileSystem::get_singleton()->is_connected_compat("filesystem_changed", this, "reload")) { + EditorFileSystem::get_singleton()->connect_compat("filesystem_changed", this, "reload"); } } if (p_what == NOTIFICATION_EXIT_TREE) { - if (EditorFileSystem::get_singleton()->is_connected("filesystem_changed", this, "reload")) { - EditorFileSystem::get_singleton()->disconnect("filesystem_changed", this, "reload"); + if (EditorFileSystem::get_singleton()->is_connected_compat("filesystem_changed", this, "reload")) { + EditorFileSystem::get_singleton()->disconnect_compat("filesystem_changed", this, "reload"); } } @@ -186,10 +186,10 @@ EditorDirDialog::EditorDirDialog() { tree = memnew(Tree); add_child(tree); - tree->connect("item_activated", this, "_ok"); + tree->connect_compat("item_activated", this, "_ok"); makedir = add_button(TTR("Create Folder"), OS::get_singleton()->get_swap_ok_cancel(), "makedir"); - makedir->connect("pressed", this, "_make_dir"); + makedir->connect_compat("pressed", this, "_make_dir"); makedialog = memnew(ConfirmationDialog); makedialog->set_title(TTR("Create Folder")); @@ -202,7 +202,7 @@ EditorDirDialog::EditorDirDialog() { makedirname = memnew(LineEdit); makevb->add_margin_child(TTR("Name:"), makedirname); makedialog->register_text_enter(makedirname); - makedialog->connect("confirmed", this, "_make_dir_confirm"); + makedialog->connect_compat("confirmed", this, "_make_dir_confirm"); mkdirerr = memnew(AcceptDialog); mkdirerr->set_text(TTR("Could not create folder.")); diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 47ed6a15bb..827b9111f3 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -1416,7 +1416,7 @@ EditorExport::EditorExport() { add_child(save_timer); save_timer->set_wait_time(0.8); save_timer->set_one_shot(true); - save_timer->connect("timeout", this, "_save"); + save_timer->connect_compat("timeout", this, "_save"); block_save = false; singleton = this; diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index 559a0ef0ea..0d53cb5189 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -819,7 +819,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { profile_actions[PROFILE_CLEAR] = memnew(Button(TTR("Unset"))); name_hbc->add_child(profile_actions[PROFILE_CLEAR]); profile_actions[PROFILE_CLEAR]->set_disabled(true); - profile_actions[PROFILE_CLEAR]->connect("pressed", this, "_profile_action", varray(PROFILE_CLEAR)); + profile_actions[PROFILE_CLEAR]->connect_compat("pressed", this, "_profile_action", varray(PROFILE_CLEAR)); main_vbc->add_margin_child(TTR("Current Profile:"), name_hbc); @@ -827,34 +827,34 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { profile_list = memnew(OptionButton); profile_list->set_h_size_flags(SIZE_EXPAND_FILL); profiles_hbc->add_child(profile_list); - profile_list->connect("item_selected", this, "_profile_selected"); + profile_list->connect_compat("item_selected", this, "_profile_selected"); profile_actions[PROFILE_SET] = memnew(Button(TTR("Make Current"))); profiles_hbc->add_child(profile_actions[PROFILE_SET]); profile_actions[PROFILE_SET]->set_disabled(true); - profile_actions[PROFILE_SET]->connect("pressed", this, "_profile_action", varray(PROFILE_SET)); + profile_actions[PROFILE_SET]->connect_compat("pressed", this, "_profile_action", varray(PROFILE_SET)); profile_actions[PROFILE_ERASE] = memnew(Button(TTR("Remove"))); profiles_hbc->add_child(profile_actions[PROFILE_ERASE]); profile_actions[PROFILE_ERASE]->set_disabled(true); - profile_actions[PROFILE_ERASE]->connect("pressed", this, "_profile_action", varray(PROFILE_ERASE)); + profile_actions[PROFILE_ERASE]->connect_compat("pressed", this, "_profile_action", varray(PROFILE_ERASE)); profiles_hbc->add_child(memnew(VSeparator)); profile_actions[PROFILE_NEW] = memnew(Button(TTR("New"))); profiles_hbc->add_child(profile_actions[PROFILE_NEW]); - profile_actions[PROFILE_NEW]->connect("pressed", this, "_profile_action", varray(PROFILE_NEW)); + profile_actions[PROFILE_NEW]->connect_compat("pressed", this, "_profile_action", varray(PROFILE_NEW)); profiles_hbc->add_child(memnew(VSeparator)); profile_actions[PROFILE_IMPORT] = memnew(Button(TTR("Import"))); profiles_hbc->add_child(profile_actions[PROFILE_IMPORT]); - profile_actions[PROFILE_IMPORT]->connect("pressed", this, "_profile_action", varray(PROFILE_IMPORT)); + profile_actions[PROFILE_IMPORT]->connect_compat("pressed", this, "_profile_action", varray(PROFILE_IMPORT)); profile_actions[PROFILE_EXPORT] = memnew(Button(TTR("Export"))); profiles_hbc->add_child(profile_actions[PROFILE_EXPORT]); profile_actions[PROFILE_EXPORT]->set_disabled(true); - profile_actions[PROFILE_EXPORT]->connect("pressed", this, "_profile_action", varray(PROFILE_EXPORT)); + profile_actions[PROFILE_EXPORT]->connect_compat("pressed", this, "_profile_action", varray(PROFILE_EXPORT)); main_vbc->add_margin_child(TTR("Available Profiles:"), profiles_hbc); @@ -870,8 +870,8 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { class_list_vbc->add_margin_child(TTR("Enabled Classes:"), class_list, true); class_list->set_hide_root(true); class_list->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true); - class_list->connect("cell_selected", this, "_class_list_item_selected"); - class_list->connect("item_edited", this, "_class_list_item_edited", varray(), CONNECT_DEFERRED); + class_list->connect_compat("cell_selected", this, "_class_list_item_selected"); + class_list->connect_compat("item_edited", this, "_class_list_item_edited", varray(), CONNECT_DEFERRED); VBoxContainer *property_list_vbc = memnew(VBoxContainer); h_split->add_child(property_list_vbc); @@ -882,7 +882,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { property_list->set_hide_root(true); property_list->set_hide_folding(true); property_list->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true); - property_list->connect("item_edited", this, "_property_item_edited", varray(), CONNECT_DEFERRED); + property_list->connect_compat("item_edited", this, "_property_item_edited", varray(), CONNECT_DEFERRED); new_profile_dialog = memnew(ConfirmationDialog); new_profile_dialog->set_title(TTR("New profile name:")); @@ -890,20 +890,20 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { new_profile_dialog->add_child(new_profile_name); new_profile_name->set_custom_minimum_size(Size2(300 * EDSCALE, 1)); add_child(new_profile_dialog); - new_profile_dialog->connect("confirmed", this, "_create_new_profile"); + new_profile_dialog->connect_compat("confirmed", this, "_create_new_profile"); new_profile_dialog->register_text_enter(new_profile_name); new_profile_dialog->get_ok()->set_text(TTR("Create")); erase_profile_dialog = memnew(ConfirmationDialog); add_child(erase_profile_dialog); erase_profile_dialog->set_title(TTR("Erase Profile")); - erase_profile_dialog->connect("confirmed", this, "_erase_selected_profile"); + erase_profile_dialog->connect_compat("confirmed", this, "_erase_selected_profile"); import_profiles = memnew(EditorFileDialog); add_child(import_profiles); import_profiles->set_mode(EditorFileDialog::MODE_OPEN_FILES); import_profiles->add_filter("*.profile; " + TTR("Godot Feature Profile")); - import_profiles->connect("files_selected", this, "_import_profiles"); + import_profiles->connect_compat("files_selected", this, "_import_profiles"); import_profiles->set_title(TTR("Import Profile(s)")); import_profiles->set_access(EditorFileDialog::ACCESS_FILESYSTEM); @@ -911,7 +911,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { add_child(export_profile); export_profile->set_mode(EditorFileDialog::MODE_SAVE_FILE); export_profile->add_filter("*.profile; " + TTR("Godot Feature Profile")); - export_profile->connect("file_selected", this, "_export_profile"); + export_profile->connect_compat("file_selected", this, "_export_profile"); export_profile->set_title(TTR("Export Profile")); export_profile->set_access(EditorFileDialog::ACCESS_FILESYSTEM); @@ -921,7 +921,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { update_timer = memnew(Timer); update_timer->set_wait_time(1); //wait a second before updating editor add_child(update_timer); - update_timer->connect("timeout", this, "_emit_current_profile_changed"); + update_timer->connect_compat("timeout", this, "_emit_current_profile_changed"); update_timer->set_one_shot(true); updating_features = false; diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index 8858db48df..dd6523e12c 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -1537,9 +1537,9 @@ EditorFileDialog::EditorFileDialog() { pathhb->add_child(dir_next); pathhb->add_child(dir_up); - dir_prev->connect("pressed", this, "_go_back"); - dir_next->connect("pressed", this, "_go_forward"); - dir_up->connect("pressed", this, "_go_up"); + dir_prev->connect_compat("pressed", this, "_go_back"); + dir_next->connect_compat("pressed", this, "_go_forward"); + dir_up->connect_compat("pressed", this, "_go_up"); pathhb->add_child(memnew(Label(TTR("Path:")))); @@ -1549,20 +1549,20 @@ EditorFileDialog::EditorFileDialog() { refresh = memnew(ToolButton); refresh->set_tooltip(TTR("Refresh files.")); - refresh->connect("pressed", this, "_update_file_list"); + refresh->connect_compat("pressed", this, "_update_file_list"); pathhb->add_child(refresh); favorite = memnew(ToolButton); favorite->set_toggle_mode(true); favorite->set_tooltip(TTR("(Un)favorite current folder.")); - favorite->connect("pressed", this, "_favorite_pressed"); + favorite->connect_compat("pressed", this, "_favorite_pressed"); pathhb->add_child(favorite); show_hidden = memnew(ToolButton); show_hidden->set_toggle_mode(true); show_hidden->set_pressed(is_showing_hidden_files()); show_hidden->set_tooltip(TTR("Toggle the visibility of hidden files.")); - show_hidden->connect("toggled", this, "set_show_hidden_files"); + show_hidden->connect_compat("toggled", this, "set_show_hidden_files"); pathhb->add_child(show_hidden); pathhb->add_child(memnew(VSeparator)); @@ -1571,7 +1571,7 @@ EditorFileDialog::EditorFileDialog() { view_mode_group.instance(); mode_thumbnails = memnew(ToolButton); - mode_thumbnails->connect("pressed", this, "set_display_mode", varray(DISPLAY_THUMBNAILS)); + mode_thumbnails->connect_compat("pressed", this, "set_display_mode", varray(DISPLAY_THUMBNAILS)); mode_thumbnails->set_toggle_mode(true); mode_thumbnails->set_pressed(display_mode == DISPLAY_THUMBNAILS); mode_thumbnails->set_button_group(view_mode_group); @@ -1579,7 +1579,7 @@ EditorFileDialog::EditorFileDialog() { pathhb->add_child(mode_thumbnails); mode_list = memnew(ToolButton); - mode_list->connect("pressed", this, "set_display_mode", varray(DISPLAY_LIST)); + mode_list->connect_compat("pressed", this, "set_display_mode", varray(DISPLAY_LIST)); mode_list->set_toggle_mode(true); mode_list->set_pressed(display_mode == DISPLAY_LIST); mode_list->set_button_group(view_mode_group); @@ -1588,11 +1588,11 @@ EditorFileDialog::EditorFileDialog() { drives = memnew(OptionButton); pathhb->add_child(drives); - drives->connect("item_selected", this, "_select_drive"); + drives->connect_compat("item_selected", this, "_select_drive"); makedir = memnew(Button); makedir->set_text(TTR("Create Folder")); - makedir->connect("pressed", this, "_make_dir"); + makedir->connect_compat("pressed", this, "_make_dir"); pathhb->add_child(makedir); list_hb = memnew(HSplitContainer); @@ -1614,15 +1614,15 @@ EditorFileDialog::EditorFileDialog() { fav_hb->add_spacer(); fav_up = memnew(ToolButton); fav_hb->add_child(fav_up); - fav_up->connect("pressed", this, "_favorite_move_up"); + fav_up->connect_compat("pressed", this, "_favorite_move_up"); fav_down = memnew(ToolButton); fav_hb->add_child(fav_down); - fav_down->connect("pressed", this, "_favorite_move_down"); + fav_down->connect_compat("pressed", this, "_favorite_move_down"); favorites = memnew(ItemList); fav_vb->add_child(favorites); favorites->set_v_size_flags(SIZE_EXPAND_FILL); - favorites->connect("item_selected", this, "_favorite_selected"); + favorites->connect_compat("item_selected", this, "_favorite_selected"); VBoxContainer *rec_vb = memnew(VBoxContainer); vsc->add_child(rec_vb); @@ -1631,7 +1631,7 @@ EditorFileDialog::EditorFileDialog() { recent = memnew(ItemList); recent->set_allow_reselect(true); rec_vb->add_margin_child(TTR("Recent:"), recent, true); - recent->connect("item_selected", this, "_recent_selected"); + recent->connect_compat("item_selected", this, "_recent_selected"); VBoxContainer *item_vb = memnew(VBoxContainer); list_hb->add_child(item_vb); @@ -1650,13 +1650,13 @@ EditorFileDialog::EditorFileDialog() { item_list = memnew(ItemList); item_list->set_v_size_flags(SIZE_EXPAND_FILL); - item_list->connect("item_rmb_selected", this, "_item_list_item_rmb_selected"); - item_list->connect("rmb_clicked", this, "_item_list_rmb_clicked"); + item_list->connect_compat("item_rmb_selected", this, "_item_list_item_rmb_selected"); + item_list->connect_compat("rmb_clicked", this, "_item_list_rmb_clicked"); item_list->set_allow_rmb_select(true); list_vb->add_child(item_list); item_menu = memnew(PopupMenu); - item_menu->connect("id_pressed", this, "_item_menu_id_pressed"); + item_menu->connect_compat("id_pressed", this, "_item_menu_id_pressed"); add_child(item_menu); // Other stuff. @@ -1687,19 +1687,19 @@ EditorFileDialog::EditorFileDialog() { access = ACCESS_RESOURCES; _update_drives(); - connect("confirmed", this, "_action_pressed"); - item_list->connect("item_selected", this, "_item_selected", varray(), CONNECT_DEFERRED); - item_list->connect("multi_selected", this, "_multi_selected", varray(), CONNECT_DEFERRED); - item_list->connect("item_activated", this, "_item_db_selected", varray()); - item_list->connect("nothing_selected", this, "_items_clear_selection"); - dir->connect("text_entered", this, "_dir_entered"); - file->connect("text_entered", this, "_file_entered"); - filter->connect("item_selected", this, "_filter_selected"); + connect_compat("confirmed", this, "_action_pressed"); + item_list->connect_compat("item_selected", this, "_item_selected", varray(), CONNECT_DEFERRED); + item_list->connect_compat("multi_selected", this, "_multi_selected", varray(), CONNECT_DEFERRED); + item_list->connect_compat("item_activated", this, "_item_db_selected", varray()); + item_list->connect_compat("nothing_selected", this, "_items_clear_selection"); + dir->connect_compat("text_entered", this, "_dir_entered"); + file->connect_compat("text_entered", this, "_file_entered"); + filter->connect_compat("item_selected", this, "_filter_selected"); confirm_save = memnew(ConfirmationDialog); confirm_save->set_as_toplevel(true); add_child(confirm_save); - confirm_save->connect("confirmed", this, "_save_confirm_pressed"); + confirm_save->connect_compat("confirmed", this, "_save_confirm_pressed"); remove_dialog = memnew(DependencyRemoveDialog); add_child(remove_dialog); @@ -1713,7 +1713,7 @@ EditorFileDialog::EditorFileDialog() { makevb->add_margin_child(TTR("Name:"), makedirname); add_child(makedialog); makedialog->register_text_enter(makedirname); - makedialog->connect("confirmed", this, "_make_dir_confirm"); + makedialog->connect_compat("confirmed", this, "_make_dir_confirm"); mkdirerr = memnew(AcceptDialog); mkdirerr->set_text(TTR("Could not create folder.")); add_child(mkdirerr); @@ -1777,10 +1777,10 @@ EditorLineEditFileChooser::EditorLineEditFileChooser() { line_edit->set_h_size_flags(SIZE_EXPAND_FILL); button = memnew(Button); add_child(button); - button->connect("pressed", this, "_browse"); + button->connect_compat("pressed", this, "_browse"); dialog = memnew(EditorFileDialog); add_child(dialog); - dialog->connect("file_selected", this, "_chosen"); - dialog->connect("dir_selected", this, "_chosen"); - dialog->connect("files_selected", this, "_chosen"); + dialog->connect_compat("file_selected", this, "_chosen"); + dialog->connect_compat("dir_selected", this, "_chosen"); + dialog->connect_compat("files_selected", this, "_chosen"); } diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 0ade4c5c80..9c64540a9e 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1551,9 +1551,9 @@ EditorHelp::EditorHelp() { class_desc->set_v_size_flags(SIZE_EXPAND_FILL); class_desc->add_color_override("selection_color", get_color("accent_color", "Editor") * Color(1, 1, 1, 0.4)); - class_desc->connect("meta_clicked", this, "_class_desc_select"); - class_desc->connect("gui_input", this, "_class_desc_input"); - class_desc->connect("resized", this, "_class_desc_resized"); + class_desc->connect_compat("meta_clicked", this, "_class_desc_select"); + class_desc->connect_compat("gui_input", this, "_class_desc_input"); + class_desc->connect_compat("resized", this, "_class_desc_resized"); _class_desc_resized(); // Added second so it opens at the bottom so it won't offset the entire widget. @@ -1633,7 +1633,7 @@ EditorHelpBit::EditorHelpBit() { rich_text = memnew(RichTextLabel); add_child(rich_text); - rich_text->connect("meta_clicked", this, "_meta_clicked"); + rich_text->connect_compat("meta_clicked", this, "_meta_clicked"); rich_text->add_color_override("selection_color", get_color("accent_color", "Editor") * Color(1, 1, 1, 0.4)); rich_text->set_override_selected_font_color(false); set_custom_minimum_size(Size2(0, 70 * EDSCALE)); @@ -1645,8 +1645,8 @@ FindBar::FindBar() { add_child(search_text); search_text->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); search_text->set_h_size_flags(SIZE_EXPAND_FILL); - search_text->connect("text_changed", this, "_search_text_changed"); - search_text->connect("text_entered", this, "_search_text_entered"); + search_text->connect_compat("text_changed", this, "_search_text_changed"); + search_text->connect_compat("text_entered", this, "_search_text_entered"); matches_label = memnew(Label); add_child(matches_label); @@ -1655,12 +1655,12 @@ FindBar::FindBar() { find_prev = memnew(ToolButton); add_child(find_prev); find_prev->set_focus_mode(FOCUS_NONE); - find_prev->connect("pressed", this, "_search_prev"); + find_prev->connect_compat("pressed", this, "_search_prev"); find_next = memnew(ToolButton); add_child(find_next); find_next->set_focus_mode(FOCUS_NONE); - find_next->connect("pressed", this, "_search_next"); + find_next->connect_compat("pressed", this, "_search_next"); Control *space = memnew(Control); add_child(space); @@ -1671,7 +1671,7 @@ FindBar::FindBar() { hide_button->set_focus_mode(FOCUS_NONE); hide_button->set_expand(true); hide_button->set_stretch_mode(TextureButton::STRETCH_KEEP_CENTERED); - hide_button->connect("pressed", this, "_hide_pressed"); + hide_button->connect_compat("pressed", this, "_hide_pressed"); } void FindBar::popup_search() { diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index d45b66afce..8bad46e4d0 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -111,7 +111,7 @@ void EditorHelpSearch::_notification(int p_what) { } break; case NOTIFICATION_ENTER_TREE: { - connect("confirmed", this, "_confirmed"); + connect_compat("confirmed", this, "_confirmed"); _update_icons(); } break; case NOTIFICATION_POPUP_HIDE: { @@ -206,21 +206,21 @@ EditorHelpSearch::EditorHelpSearch() { search_box = memnew(LineEdit); search_box->set_custom_minimum_size(Size2(200, 0) * EDSCALE); search_box->set_h_size_flags(SIZE_EXPAND_FILL); - search_box->connect("gui_input", this, "_search_box_gui_input"); - search_box->connect("text_changed", this, "_search_box_text_changed"); + search_box->connect_compat("gui_input", this, "_search_box_gui_input"); + search_box->connect_compat("text_changed", this, "_search_box_text_changed"); register_text_enter(search_box); hbox->add_child(search_box); case_sensitive_button = memnew(ToolButton); case_sensitive_button->set_tooltip(TTR("Case Sensitive")); - case_sensitive_button->connect("pressed", this, "_update_results"); + case_sensitive_button->connect_compat("pressed", this, "_update_results"); case_sensitive_button->set_toggle_mode(true); case_sensitive_button->set_focus_mode(FOCUS_NONE); hbox->add_child(case_sensitive_button); hierarchy_button = memnew(ToolButton); hierarchy_button->set_tooltip(TTR("Show Hierarchy")); - hierarchy_button->connect("pressed", this, "_update_results"); + hierarchy_button->connect_compat("pressed", this, "_update_results"); hierarchy_button->set_toggle_mode(true); hierarchy_button->set_pressed(true); hierarchy_button->set_focus_mode(FOCUS_NONE); @@ -237,7 +237,7 @@ EditorHelpSearch::EditorHelpSearch() { filter_combo->add_item(TTR("Constants Only"), SEARCH_CONSTANTS); filter_combo->add_item(TTR("Properties Only"), SEARCH_PROPERTIES); filter_combo->add_item(TTR("Theme Properties Only"), SEARCH_THEME_ITEMS); - filter_combo->connect("item_selected", this, "_filter_combo_item_selected"); + filter_combo->connect_compat("item_selected", this, "_filter_combo_item_selected"); hbox->add_child(filter_combo); // Create the results tree. @@ -251,8 +251,8 @@ EditorHelpSearch::EditorHelpSearch() { results_tree->set_custom_minimum_size(Size2(0, 100) * EDSCALE); results_tree->set_hide_root(true); results_tree->set_select_mode(Tree::SELECT_ROW); - results_tree->connect("item_activated", this, "_confirmed"); - results_tree->connect("item_selected", get_ok(), "set_disabled", varray(false)); + results_tree->connect_compat("item_activated", this, "_confirmed"); + results_tree->connect_compat("item_selected", get_ok(), "set_disabled", varray(false)); vbox->add_child(results_tree, true); } diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index b16ec26fd1..2ed5686a21 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -570,7 +570,7 @@ void EditorProperty::_focusable_focused(int p_index) { void EditorProperty::add_focusable(Control *p_control) { - p_control->connect("focus_entered", this, "_focusable_focused", varray(focusables.size())); + p_control->connect_compat("focus_entered", this, "_focusable_focused", varray(focusables.size())); focusables.push_back(p_control); } @@ -925,7 +925,7 @@ bool EditorInspectorPlugin::parse_property(Object *p_object, Variant::Type p_typ &arg[0], &arg[1], &arg[2], &arg[3], &arg[4], &arg[5] }; - Variant::CallError err; + Callable::CallError err; return get_script_instance()->call("parse_property", (const Variant **)&argptr, 6, err); } return false; @@ -1339,14 +1339,14 @@ void EditorInspector::_parse_added_editors(VBoxContainer *current_vbox, Ref<Edit if (ep) { ep->object = object; - ep->connect("property_changed", this, "_property_changed"); - ep->connect("property_keyed", this, "_property_keyed"); - ep->connect("property_keyed_with_value", this, "_property_keyed_with_value"); - ep->connect("property_checked", this, "_property_checked"); - ep->connect("selected", this, "_property_selected"); - ep->connect("multiple_properties_changed", this, "_multiple_properties_changed"); - ep->connect("resource_selected", this, "_resource_selected", varray(), CONNECT_DEFERRED); - ep->connect("object_id_selected", this, "_object_id_selected", varray(), CONNECT_DEFERRED); + ep->connect_compat("property_changed", this, "_property_changed"); + ep->connect_compat("property_keyed", this, "_property_keyed"); + ep->connect_compat("property_keyed_with_value", this, "_property_keyed_with_value"); + ep->connect_compat("property_checked", this, "_property_checked"); + ep->connect_compat("selected", this, "_property_selected"); + ep->connect_compat("multiple_properties_changed", this, "_multiple_properties_changed"); + ep->connect_compat("resource_selected", this, "_resource_selected", varray(), CONNECT_DEFERRED); + ep->connect_compat("object_id_selected", this, "_object_id_selected", varray(), CONNECT_DEFERRED); if (F->get().properties.size()) { @@ -1751,17 +1751,17 @@ void EditorInspector::update_tree() { if (ep) { - ep->connect("property_changed", this, "_property_changed"); + ep->connect_compat("property_changed", this, "_property_changed"); if (p.usage & PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED) { - ep->connect("property_changed", this, "_property_changed_update_all", varray(), CONNECT_DEFERRED); + ep->connect_compat("property_changed", this, "_property_changed_update_all", varray(), CONNECT_DEFERRED); } - ep->connect("property_keyed", this, "_property_keyed"); - ep->connect("property_keyed_with_value", this, "_property_keyed_with_value"); - ep->connect("property_checked", this, "_property_checked"); - ep->connect("selected", this, "_property_selected"); - ep->connect("multiple_properties_changed", this, "_multiple_properties_changed"); - ep->connect("resource_selected", this, "_resource_selected", varray(), CONNECT_DEFERRED); - ep->connect("object_id_selected", this, "_object_id_selected", varray(), CONNECT_DEFERRED); + ep->connect_compat("property_keyed", this, "_property_keyed"); + ep->connect_compat("property_keyed_with_value", this, "_property_keyed_with_value"); + ep->connect_compat("property_checked", this, "_property_checked"); + ep->connect_compat("selected", this, "_property_selected"); + ep->connect_compat("multiple_properties_changed", this, "_multiple_properties_changed"); + ep->connect_compat("resource_selected", this, "_resource_selected", varray(), CONNECT_DEFERRED); + ep->connect_compat("object_id_selected", this, "_object_id_selected", varray(), CONNECT_DEFERRED); if (doc_hint != String()) { ep->set_tooltip(property_prefix + p.name + "::" + doc_hint); } else { @@ -1889,7 +1889,7 @@ void EditorInspector::set_use_filter(bool p_use) { void EditorInspector::register_text_enter(Node *p_line_edit) { search_box = Object::cast_to<LineEdit>(p_line_edit); if (search_box) - search_box->connect("text_changed", this, "_filter_changed"); + search_box->connect_compat("text_changed", this, "_filter_changed"); } void EditorInspector::_filter_changed(const String &p_text) { @@ -2109,7 +2109,7 @@ void EditorInspector::_property_checked(const String &p_path, bool p_checked) { object->get_property_list(&pinfo); for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) { if (E->get().name == p_path) { - Variant::CallError ce; + Callable::CallError ce; to_create = Variant::construct(E->get().type, NULL, 0, ce); break; } @@ -2165,7 +2165,7 @@ void EditorInspector::_node_removed(Node *p_node) { void EditorInspector::_notification(int p_what) { if (p_what == NOTIFICATION_READY) { - EditorFeatureProfileManager::get_singleton()->connect("current_feature_profile_changed", this, "_feature_profile_changed"); + EditorFeatureProfileManager::get_singleton()->connect_compat("current_feature_profile_changed", this, "_feature_profile_changed"); } if (p_what == NOTIFICATION_ENTER_TREE) { @@ -2174,7 +2174,7 @@ void EditorInspector::_notification(int p_what) { add_style_override("bg", get_stylebox("sub_inspector_bg", "Editor")); } else { add_style_override("bg", get_stylebox("bg", "Tree")); - get_tree()->connect("node_removed", this, "_node_removed"); + get_tree()->connect_compat("node_removed", this, "_node_removed"); } } if (p_what == NOTIFICATION_PREDELETE) { @@ -2183,7 +2183,7 @@ void EditorInspector::_notification(int p_what) { if (p_what == NOTIFICATION_EXIT_TREE) { if (!sub_inspector) { - get_tree()->disconnect("node_removed", this, "_node_removed"); + get_tree()->disconnect_compat("node_removed", this, "_node_removed"); } edit(NULL); } @@ -2337,6 +2337,6 @@ EditorInspector::EditorInspector() { property_focusable = -1; sub_inspector = false; - get_v_scrollbar()->connect("value_changed", this, "_vscroll_changed"); + get_v_scrollbar()->connect_compat("value_changed", this, "_vscroll_changed"); update_scroll_request = -1; } diff --git a/editor/editor_layouts_dialog.cpp b/editor/editor_layouts_dialog.cpp index 727e758341..05a5df45a9 100644 --- a/editor/editor_layouts_dialog.cpp +++ b/editor/editor_layouts_dialog.cpp @@ -128,8 +128,8 @@ EditorLayoutsDialog::EditorLayoutsDialog() { name->set_margin(MARGIN_TOP, 5); name->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5); name->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5); - name->connect("gui_input", this, "_line_gui_input"); - name->connect("focus_entered", layout_names, "unselect_all"); + name->connect_compat("gui_input", this, "_line_gui_input"); + name->connect_compat("focus_entered", layout_names, "unselect_all"); } void EditorLayoutsDialog::set_name_line_enabled(bool p_enabled) { diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index 5b77db7707..ca755a6cb7 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -159,13 +159,13 @@ EditorLog::EditorLog() { hb->add_child(copybutton); copybutton->set_text(TTR("Copy")); copybutton->set_shortcut(ED_SHORTCUT("editor/copy_output", TTR("Copy Selection"), KEY_MASK_CMD | KEY_C)); - copybutton->connect("pressed", this, "_copy_request"); + copybutton->connect_compat("pressed", this, "_copy_request"); clearbutton = memnew(Button); hb->add_child(clearbutton); clearbutton->set_text(TTR("Clear")); clearbutton->set_shortcut(ED_SHORTCUT("editor/clear_output", TTR("Clear Output"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_K)); - clearbutton->connect("pressed", this, "_clear_request"); + clearbutton->connect_compat("pressed", this, "_clear_request"); log = memnew(RichTextLabel); log->set_scroll_follow(true); diff --git a/editor/editor_network_profiler.cpp b/editor/editor_network_profiler.cpp index 1b80743237..1dffafa359 100644 --- a/editor/editor_network_profiler.cpp +++ b/editor/editor_network_profiler.cpp @@ -142,12 +142,12 @@ EditorNetworkProfiler::EditorNetworkProfiler() { activate = memnew(Button); activate->set_toggle_mode(true); activate->set_text(TTR("Start")); - activate->connect("pressed", this, "_activate_pressed"); + activate->connect_compat("pressed", this, "_activate_pressed"); hb->add_child(activate); clear_button = memnew(Button); clear_button->set_text(TTR("Clear")); - clear_button->connect("pressed", this, "_clear_pressed"); + clear_button->connect_compat("pressed", this, "_clear_pressed"); hb->add_child(clear_button); hb->add_spacer(); @@ -207,5 +207,5 @@ EditorNetworkProfiler::EditorNetworkProfiler() { frame_delay->set_wait_time(0.1); frame_delay->set_one_shot(true); add_child(frame_delay); - frame_delay->connect("timeout", this, "_update_frame"); + frame_delay->connect_compat("timeout", this, "_update_frame"); } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 6a6485575f..59fa40846f 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -374,8 +374,8 @@ void EditorNode::_notification(int p_what) { get_tree()->get_root()->set_as_audio_listener(false); get_tree()->get_root()->set_as_audio_listener_2d(false); get_tree()->set_auto_accept_quit(false); - get_tree()->connect("files_dropped", this, "_dropped_files"); - get_tree()->connect("global_menu_action", this, "_global_menu_action"); + get_tree()->connect_compat("files_dropped", this, "_dropped_files"); + get_tree()->connect_compat("global_menu_action", this, "_global_menu_action"); /* DO NOT LOAD SCENES HERE, WAIT FOR FILE SCANNING AND REIMPORT TO COMPLETE */ } break; @@ -2746,10 +2746,10 @@ void EditorNode::_tool_menu_option(int p_idx) { Object *handler = ObjectDB::get_instance(params[0]); String callback = params[1]; Variant *ud = ¶ms[2]; - Variant::CallError ce; + Callable::CallError ce; handler->call(callback, (const Variant **)&ud, 1, ce); - if (ce.error != Variant::CallError::CALL_OK) { + if (ce.error != Callable::CallError::CALL_OK) { String err = Variant::get_call_error_text(handler, callback, (const Variant **)&ud, 1, ce); ERR_PRINT("Error calling function from tool menu: " + err); } @@ -2958,7 +2958,7 @@ void EditorNode::add_editor_plugin(EditorPlugin *p_editor, bool p_config_changed ToolButton *tb = memnew(ToolButton); tb->set_toggle_mode(true); - tb->connect("pressed", singleton, "_editor_select", varray(singleton->main_editor_buttons.size())); + tb->connect_compat("pressed", singleton, "_editor_select", varray(singleton->main_editor_buttons.size())); tb->set_text(p_editor->get_name()); Ref<Texture2D> icon = p_editor->get_icon(); @@ -4785,7 +4785,7 @@ void EditorNode::_scene_tab_changed(int p_tab) { ToolButton *EditorNode::add_bottom_panel_item(String p_text, Control *p_item) { ToolButton *tb = memnew(ToolButton); - tb->connect("toggled", this, "_bottom_panel_switch", varray(bottom_panel_items.size())); + tb->connect_compat("toggled", this, "_bottom_panel_switch", varray(bottom_panel_items.size())); tb->set_text(p_text); tb->set_toggle_mode(true); tb->set_focus_mode(Control::FOCUS_NONE); @@ -4847,8 +4847,8 @@ void EditorNode::raise_bottom_panel_item(Control *p_item) { } for (int i = 0; i < bottom_panel_items.size(); i++) { - bottom_panel_items[i].button->disconnect("toggled", this, "_bottom_panel_switch"); - bottom_panel_items[i].button->connect("toggled", this, "_bottom_panel_switch", varray(i)); + bottom_panel_items[i].button->disconnect_compat("toggled", this, "_bottom_panel_switch"); + bottom_panel_items[i].button->connect_compat("toggled", this, "_bottom_panel_switch", varray(i)); } } @@ -4869,8 +4869,8 @@ void EditorNode::remove_bottom_panel_item(Control *p_item) { } for (int i = 0; i < bottom_panel_items.size(); i++) { - bottom_panel_items[i].button->disconnect("toggled", this, "_bottom_panel_switch"); - bottom_panel_items[i].button->connect("toggled", this, "_bottom_panel_switch", varray(i)); + bottom_panel_items[i].button->disconnect_compat("toggled", this, "_bottom_panel_switch"); + bottom_panel_items[i].button->connect_compat("toggled", this, "_bottom_panel_switch", varray(i)); } } @@ -5925,8 +5925,8 @@ EditorNode::EditorNode() { hsplits.push_back(right_hsplit); for (int i = 0; i < vsplits.size(); i++) { - vsplits[i]->connect("dragged", this, "_dock_split_dragged"); - hsplits[i]->connect("dragged", this, "_dock_split_dragged"); + vsplits[i]->connect_compat("dragged", this, "_dock_split_dragged"); + hsplits[i]->connect_compat("dragged", this, "_dock_split_dragged"); } dock_select_popup = memnew(PopupPanel); @@ -5938,7 +5938,7 @@ EditorNode::EditorNode() { dock_tab_move_left = memnew(ToolButton); dock_tab_move_left->set_icon(theme->get_icon("Back", "EditorIcons")); dock_tab_move_left->set_focus_mode(Control::FOCUS_NONE); - dock_tab_move_left->connect("pressed", this, "_dock_move_left"); + dock_tab_move_left->connect_compat("pressed", this, "_dock_move_left"); dock_hb->add_child(dock_tab_move_left); Label *dock_label = memnew(Label); @@ -5950,16 +5950,16 @@ EditorNode::EditorNode() { dock_tab_move_right = memnew(ToolButton); dock_tab_move_right->set_icon(theme->get_icon("Forward", "EditorIcons")); dock_tab_move_right->set_focus_mode(Control::FOCUS_NONE); - dock_tab_move_right->connect("pressed", this, "_dock_move_right"); + dock_tab_move_right->connect_compat("pressed", this, "_dock_move_right"); dock_hb->add_child(dock_tab_move_right); dock_vb->add_child(dock_hb); dock_select = memnew(Control); dock_select->set_custom_minimum_size(Size2(128, 64) * EDSCALE); - dock_select->connect("gui_input", this, "_dock_select_input"); - dock_select->connect("draw", this, "_dock_select_draw"); - dock_select->connect("mouse_exited", this, "_dock_popup_exit"); + dock_select->connect_compat("gui_input", this, "_dock_select_input"); + dock_select->connect_compat("draw", this, "_dock_select_draw"); + dock_select->connect_compat("mouse_exited", this, "_dock_popup_exit"); dock_select->set_v_size_flags(Control::SIZE_EXPAND_FILL); dock_vb->add_child(dock_select); @@ -5970,11 +5970,11 @@ EditorNode::EditorNode() { dock_slot[i]->set_custom_minimum_size(Size2(170, 0) * EDSCALE); dock_slot[i]->set_v_size_flags(Control::SIZE_EXPAND_FILL); dock_slot[i]->set_popup(dock_select_popup); - dock_slot[i]->connect("pre_popup_pressed", this, "_dock_pre_popup", varray(i)); + dock_slot[i]->connect_compat("pre_popup_pressed", this, "_dock_pre_popup", varray(i)); dock_slot[i]->set_tab_align(TabContainer::ALIGN_LEFT); dock_slot[i]->set_drag_to_rearrange_enabled(true); dock_slot[i]->set_tabs_rearrange_group(1); - dock_slot[i]->connect("tab_changed", this, "_dock_tab_changed"); + dock_slot[i]->connect_compat("tab_changed", this, "_dock_tab_changed"); dock_slot[i]->set_use_hidden_tabs_for_min_size(true); } @@ -5982,7 +5982,7 @@ EditorNode::EditorNode() { add_child(dock_drag_timer); dock_drag_timer->set_wait_time(0.5); dock_drag_timer->set_one_shot(true); - dock_drag_timer->connect("timeout", this, "_save_docks"); + dock_drag_timer->connect_compat("timeout", this, "_save_docks"); top_split = memnew(VSplitContainer); center_split->add_child(top_split); @@ -6015,21 +6015,21 @@ EditorNode::EditorNode() { scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/scene_tabs/always_show_close_button", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY)); scene_tabs->set_min_width(int(EDITOR_DEF("interface/scene_tabs/minimum_width", 50)) * EDSCALE); scene_tabs->set_drag_to_rearrange_enabled(true); - scene_tabs->connect("tab_changed", this, "_scene_tab_changed"); - scene_tabs->connect("right_button_pressed", this, "_scene_tab_script_edited"); - scene_tabs->connect("tab_close", this, "_scene_tab_closed", varray(SCENE_TAB_CLOSE)); - scene_tabs->connect("tab_hover", this, "_scene_tab_hover"); - scene_tabs->connect("mouse_exited", this, "_scene_tab_exit"); - scene_tabs->connect("gui_input", this, "_scene_tab_input"); - scene_tabs->connect("reposition_active_tab_request", this, "_reposition_active_tab"); - scene_tabs->connect("resized", this, "_update_scene_tabs"); + scene_tabs->connect_compat("tab_changed", this, "_scene_tab_changed"); + scene_tabs->connect_compat("right_button_pressed", this, "_scene_tab_script_edited"); + scene_tabs->connect_compat("tab_close", this, "_scene_tab_closed", varray(SCENE_TAB_CLOSE)); + scene_tabs->connect_compat("tab_hover", this, "_scene_tab_hover"); + scene_tabs->connect_compat("mouse_exited", this, "_scene_tab_exit"); + scene_tabs->connect_compat("gui_input", this, "_scene_tab_input"); + scene_tabs->connect_compat("reposition_active_tab_request", this, "_reposition_active_tab"); + scene_tabs->connect_compat("resized", this, "_update_scene_tabs"); tabbar_container = memnew(HBoxContainer); scene_tabs->set_h_size_flags(Control::SIZE_EXPAND_FILL); scene_tabs_context_menu = memnew(PopupMenu); tabbar_container->add_child(scene_tabs_context_menu); - scene_tabs_context_menu->connect("id_pressed", this, "_menu_option"); + scene_tabs_context_menu->connect_compat("id_pressed", this, "_menu_option"); scene_tabs_context_menu->set_hide_on_window_lose_focus(true); srt->add_child(tabbar_container); @@ -6041,7 +6041,7 @@ EditorNode::EditorNode() { distraction_free->set_shortcut(ED_SHORTCUT("editor/distraction_free_mode", TTR("Distraction Free Mode"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F11)); #endif distraction_free->set_tooltip(TTR("Toggle distraction-free mode.")); - distraction_free->connect("pressed", this, "_toggle_distraction_free_mode"); + distraction_free->connect_compat("pressed", this, "_toggle_distraction_free_mode"); distraction_free->set_icon(gui_base->get_icon("DistractionFree", "EditorIcons")); distraction_free->set_toggle_mode(true); @@ -6051,7 +6051,7 @@ EditorNode::EditorNode() { scene_tab_add->set_tooltip(TTR("Add a new scene.")); scene_tab_add->set_icon(gui_base->get_icon("Add", "EditorIcons")); scene_tab_add->add_color_override("icon_color_normal", Color(0.6f, 0.6f, 0.6f, 0.8f)); - scene_tab_add->connect("pressed", this, "_menu_option", make_binds(FILE_NEW_SCENE)); + scene_tab_add->connect_compat("pressed", this, "_menu_option", make_binds(FILE_NEW_SCENE)); scene_root_parent = memnew(PanelContainer); scene_root_parent->set_custom_minimum_size(Size2(0, 80) * EDSCALE); @@ -6086,14 +6086,14 @@ EditorNode::EditorNode() { prev_scene->set_icon(gui_base->get_icon("PrevScene", "EditorIcons")); prev_scene->set_tooltip(TTR("Go to previously opened scene.")); prev_scene->set_disabled(true); - prev_scene->connect("pressed", this, "_menu_option", make_binds(FILE_OPEN_PREV)); + prev_scene->connect_compat("pressed", this, "_menu_option", make_binds(FILE_OPEN_PREV)); gui_base->add_child(prev_scene); prev_scene->set_position(Point2(3, 24)); prev_scene->hide(); accept = memnew(AcceptDialog); gui_base->add_child(accept); - accept->connect("confirmed", this, "_menu_confirm_current"); + accept->connect_compat("confirmed", this, "_menu_confirm_current"); project_export = memnew(ProjectExportDialog); gui_base->add_child(project_export); @@ -6120,12 +6120,12 @@ EditorNode::EditorNode() { gui_base->add_child(feature_profile_manager); about = memnew(EditorAbout); gui_base->add_child(about); - feature_profile_manager->connect("current_feature_profile_changed", this, "_feature_profile_changed"); + feature_profile_manager->connect_compat("current_feature_profile_changed", this, "_feature_profile_changed"); warning = memnew(AcceptDialog); warning->add_button(TTR("Copy Text"), true, "copy"); gui_base->add_child(warning); - warning->connect("custom_action", this, "_copy_warning"); + warning->connect_compat("custom_action", this, "_copy_warning"); ED_SHORTCUT("editor/next_tab", TTR("Next tab"), KEY_MASK_CMD + KEY_TAB); ED_SHORTCUT("editor/prev_tab", TTR("Previous tab"), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_TAB); @@ -6159,7 +6159,7 @@ EditorNode::EditorNode() { p->add_submenu_item(TTR("Convert To..."), "Export"); pm_export->add_shortcut(ED_SHORTCUT("editor/convert_to_MeshLibrary", TTR("MeshLibrary...")), FILE_EXPORT_MESH_LIBRARY); pm_export->add_shortcut(ED_SHORTCUT("editor/convert_to_TileSet", TTR("TileSet...")), FILE_EXPORT_TILESET); - pm_export->connect("id_pressed", this, "_menu_option"); + pm_export->connect_compat("id_pressed", this, "_menu_option"); p->add_separator(); p->add_shortcut(ED_SHORTCUT("editor/undo", TTR("Undo"), KEY_MASK_CMD + KEY_Z), EDIT_UNDO, true); @@ -6172,7 +6172,7 @@ EditorNode::EditorNode() { recent_scenes = memnew(PopupMenu); recent_scenes->set_name("RecentScenes"); p->add_child(recent_scenes); - recent_scenes->connect("id_pressed", this, "_open_recent_scene"); + recent_scenes->connect_compat("id_pressed", this, "_open_recent_scene"); p->add_separator(); p->add_shortcut(ED_SHORTCUT("editor/file_quit", TTR("Quit"), KEY_MASK_CMD + KEY_Q), FILE_QUIT, true); @@ -6188,11 +6188,11 @@ EditorNode::EditorNode() { p = project_menu->get_popup(); p->set_hide_on_window_lose_focus(true); p->add_shortcut(ED_SHORTCUT("editor/project_settings", TTR("Project Settings...")), RUN_SETTINGS); - p->connect("id_pressed", this, "_menu_option"); + p->connect_compat("id_pressed", this, "_menu_option"); vcs_actions_menu = VersionControlEditorPlugin::get_singleton()->get_version_control_actions_panel(); vcs_actions_menu->set_name("Version Control"); - vcs_actions_menu->connect("index_pressed", this, "_version_control_menu_option"); + vcs_actions_menu->connect_compat("index_pressed", this, "_version_control_menu_option"); p->add_separator(); p->add_child(vcs_actions_menu); p->add_submenu_item(TTR("Version Control"), "Version Control"); @@ -6205,12 +6205,12 @@ EditorNode::EditorNode() { p->add_item(TTR("Open Project Data Folder"), RUN_PROJECT_DATA_FOLDER); plugin_config_dialog = memnew(PluginConfigDialog); - plugin_config_dialog->connect("plugin_ready", this, "_on_plugin_ready"); + plugin_config_dialog->connect_compat("plugin_ready", this, "_on_plugin_ready"); gui_base->add_child(plugin_config_dialog); tool_menu = memnew(PopupMenu); tool_menu->set_name("Tools"); - tool_menu->connect("index_pressed", this, "_tool_menu_option"); + tool_menu->connect_compat("index_pressed", this, "_tool_menu_option"); p->add_child(tool_menu); p->add_submenu_item(TTR("Tools"), "Tools"); tool_menu->add_item(TTR("Orphan Resource Explorer..."), TOOLS_ORPHAN_RESOURCES); @@ -6254,7 +6254,7 @@ EditorNode::EditorNode() { p->add_check_shortcut(ED_SHORTCUT("editor/sync_script_changes", TTR("Sync Script Changes")), RUN_RELOAD_SCRIPTS); p->set_item_tooltip(p->get_item_count() - 1, TTR("When this option is turned on, any script that is saved will be reloaded on the running game.\nWhen used remotely on a device, this is more efficient with network filesystem.")); p->set_item_checked(p->get_item_count() - 1, true); - p->connect("id_pressed", this, "_menu_option"); + p->connect_compat("id_pressed", this, "_menu_option"); menu_hb->add_spacer(); @@ -6273,7 +6273,7 @@ EditorNode::EditorNode() { editor_layouts = memnew(PopupMenu); editor_layouts->set_name("Layouts"); p->add_child(editor_layouts); - editor_layouts->connect("id_pressed", this, "_layout_menu_option"); + editor_layouts->connect_compat("id_pressed", this, "_layout_menu_option"); p->add_submenu_item(TTR("Editor Layout"), "Layouts"); p->add_separator(); #ifdef OSX_ENABLED @@ -6315,7 +6315,7 @@ EditorNode::EditorNode() { p = help_menu->get_popup(); p->set_hide_on_window_lose_focus(true); - p->connect("id_pressed", this, "_menu_option"); + p->connect_compat("id_pressed", this, "_menu_option"); p->add_icon_shortcut(gui_base->get_icon("HelpSearch", "EditorIcons"), ED_SHORTCUT("editor/editor_help", TTR("Search"), KEY_MASK_SHIFT | KEY_F1), HELP_SEARCH); p->add_separator(); p->add_icon_shortcut(gui_base->get_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/online_docs", TTR("Online Docs")), HELP_DOCS); @@ -6333,7 +6333,7 @@ EditorNode::EditorNode() { play_button->set_toggle_mode(true); play_button->set_icon(gui_base->get_icon("MainPlay", "EditorIcons")); play_button->set_focus_mode(Control::FOCUS_NONE); - play_button->connect("pressed", this, "_menu_option", make_binds(RUN_PLAY)); + play_button->connect_compat("pressed", this, "_menu_option", make_binds(RUN_PLAY)); play_button->set_tooltip(TTR("Play the project.")); #ifdef OSX_ENABLED play_button->set_shortcut(ED_SHORTCUT("editor/play", TTR("Play"), KEY_MASK_CMD | KEY_B)); @@ -6358,7 +6358,7 @@ EditorNode::EditorNode() { play_hb->add_child(stop_button); stop_button->set_focus_mode(Control::FOCUS_NONE); stop_button->set_icon(gui_base->get_icon("Stop", "EditorIcons")); - stop_button->connect("pressed", this, "_menu_option", make_binds(RUN_STOP)); + stop_button->connect_compat("pressed", this, "_menu_option", make_binds(RUN_STOP)); stop_button->set_tooltip(TTR("Stop the scene.")); stop_button->set_disabled(true); #ifdef OSX_ENABLED @@ -6369,14 +6369,14 @@ EditorNode::EditorNode() { run_native = memnew(EditorRunNative); play_hb->add_child(run_native); - run_native->connect("native_run", this, "_menu_option", varray(RUN_PLAY_NATIVE)); + run_native->connect_compat("native_run", this, "_menu_option", varray(RUN_PLAY_NATIVE)); play_scene_button = memnew(ToolButton); play_hb->add_child(play_scene_button); play_scene_button->set_toggle_mode(true); play_scene_button->set_focus_mode(Control::FOCUS_NONE); play_scene_button->set_icon(gui_base->get_icon("PlayScene", "EditorIcons")); - play_scene_button->connect("pressed", this, "_menu_option", make_binds(RUN_PLAY_SCENE)); + play_scene_button->connect_compat("pressed", this, "_menu_option", make_binds(RUN_PLAY_SCENE)); play_scene_button->set_tooltip(TTR("Play the edited scene.")); #ifdef OSX_ENABLED play_scene_button->set_shortcut(ED_SHORTCUT("editor/play_scene", TTR("Play Scene"), KEY_MASK_CMD | KEY_R)); @@ -6389,7 +6389,7 @@ EditorNode::EditorNode() { play_custom_scene_button->set_toggle_mode(true); play_custom_scene_button->set_focus_mode(Control::FOCUS_NONE); play_custom_scene_button->set_icon(gui_base->get_icon("PlayCustom", "EditorIcons")); - play_custom_scene_button->connect("pressed", this, "_menu_option", make_binds(RUN_PLAY_CUSTOM_SCENE)); + play_custom_scene_button->connect_compat("pressed", this, "_menu_option", make_binds(RUN_PLAY_CUSTOM_SCENE)); play_custom_scene_button->set_tooltip(TTR("Play custom scene")); #ifdef OSX_ENABLED play_custom_scene_button->set_shortcut(ED_SHORTCUT("editor/play_custom_scene", TTR("Play Custom Scene"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_R)); @@ -6404,7 +6404,7 @@ EditorNode::EditorNode() { video_driver = memnew(OptionButton); video_driver->set_flat(true); video_driver->set_focus_mode(Control::FOCUS_NONE); - video_driver->connect("item_selected", this, "_video_driver_selected"); + video_driver->connect_compat("item_selected", this, "_video_driver_selected"); video_driver->add_font_override("font", gui_base->get_font("bold", "EditorFonts")); // TODO re-enable when GLES2 is ported video_driver->set_disabled(true); @@ -6429,7 +6429,7 @@ EditorNode::EditorNode() { video_restart_dialog = memnew(ConfirmationDialog); video_restart_dialog->set_text(TTR("Changing the video driver requires restarting the editor.")); video_restart_dialog->get_ok()->set_text(TTR("Save & Restart")); - video_restart_dialog->connect("confirmed", this, "_menu_option", varray(SET_VIDEO_DRIVER_SAVE_AND_RESTART)); + video_restart_dialog->connect_compat("confirmed", this, "_menu_option", varray(SET_VIDEO_DRIVER_SAVE_AND_RESTART)); gui_base->add_child(video_restart_dialog); progress_hb = memnew(BackgroundProgress); @@ -6438,13 +6438,13 @@ EditorNode::EditorNode() { gui_base->add_child(layout_dialog); layout_dialog->set_hide_on_ok(false); layout_dialog->set_size(Size2(225, 270) * EDSCALE); - layout_dialog->connect("name_confirmed", this, "_dialog_action"); + layout_dialog->connect_compat("name_confirmed", this, "_dialog_action"); update_spinner = memnew(MenuButton); update_spinner->set_tooltip(TTR("Spins when the editor window redraws.")); right_menu_hb->add_child(update_spinner); update_spinner->set_icon(gui_base->get_icon("Progress1", "EditorIcons")); - update_spinner->get_popup()->connect("id_pressed", this, "_menu_option"); + update_spinner->get_popup()->connect_compat("id_pressed", this, "_menu_option"); p = update_spinner->get_popup(); p->add_radio_check_item(TTR("Update Continuously"), SETTINGS_UPDATE_CONTINUOUSLY); p->add_radio_check_item(TTR("Update When Changed"), SETTINGS_UPDATE_WHEN_CHANGED); @@ -6460,9 +6460,9 @@ EditorNode::EditorNode() { node_dock = memnew(NodeDock); filesystem_dock = memnew(FileSystemDock(this)); - filesystem_dock->connect("inherit", this, "_inherit_request"); - filesystem_dock->connect("instance", this, "_instance_request"); - filesystem_dock->connect("display_mode_changed", this, "_save_docks"); + filesystem_dock->connect_compat("inherit", this, "_inherit_request"); + filesystem_dock->connect_compat("instance", this, "_instance_request"); + filesystem_dock->connect_compat("display_mode_changed", this, "_save_docks"); // Scene: Top left dock_slot[DOCK_SLOT_LEFT_UR]->add_child(scene_tree_dock); @@ -6548,7 +6548,7 @@ EditorNode::EditorNode() { bottom_panel_hb->add_child(bottom_panel_raise); bottom_panel_raise->hide(); bottom_panel_raise->set_toggle_mode(true); - bottom_panel_raise->connect("toggled", this, "_bottom_panel_raise_toggled"); + bottom_panel_raise->connect_compat("toggled", this, "_bottom_panel_raise_toggled"); log = memnew(EditorLog); ToolButton *output_button = add_bottom_panel_item(TTR("Output"), log); @@ -6556,37 +6556,37 @@ EditorNode::EditorNode() { old_split_ofs = 0; - center_split->connect("resized", this, "_vp_resized"); + center_split->connect_compat("resized", this, "_vp_resized"); orphan_resources = memnew(OrphanResourcesDialog); gui_base->add_child(orphan_resources); confirmation = memnew(ConfirmationDialog); gui_base->add_child(confirmation); - confirmation->connect("confirmed", this, "_menu_confirm_current"); + confirmation->connect_compat("confirmed", this, "_menu_confirm_current"); save_confirmation = memnew(ConfirmationDialog); save_confirmation->add_button(TTR("Don't Save"), OS::get_singleton()->get_swap_ok_cancel(), "discard"); gui_base->add_child(save_confirmation); - save_confirmation->connect("confirmed", this, "_menu_confirm_current"); - save_confirmation->connect("custom_action", this, "_discard_changes"); + save_confirmation->connect_compat("confirmed", this, "_menu_confirm_current"); + save_confirmation->connect_compat("custom_action", this, "_discard_changes"); custom_build_manage_templates = memnew(ConfirmationDialog); custom_build_manage_templates->set_text(TTR("Android build template is missing, please install relevant templates.")); custom_build_manage_templates->get_ok()->set_text(TTR("Manage Templates")); - custom_build_manage_templates->connect("confirmed", this, "_menu_option", varray(SETTINGS_MANAGE_EXPORT_TEMPLATES)); + custom_build_manage_templates->connect_compat("confirmed", this, "_menu_option", varray(SETTINGS_MANAGE_EXPORT_TEMPLATES)); gui_base->add_child(custom_build_manage_templates); install_android_build_template = memnew(ConfirmationDialog); install_android_build_template->set_text(TTR("This will set up your project for custom Android builds by installing the source template to \"res://android/build\".\nYou can then apply modifications and build your own custom APK on export (adding modules, changing the AndroidManifest.xml, etc.).\nNote that in order to make custom builds instead of using pre-built APKs, the \"Use Custom Build\" option should be enabled in the Android export preset.")); install_android_build_template->get_ok()->set_text(TTR("Install")); - install_android_build_template->connect("confirmed", this, "_menu_confirm_current"); + install_android_build_template->connect_compat("confirmed", this, "_menu_confirm_current"); gui_base->add_child(install_android_build_template); remove_android_build_template = memnew(ConfirmationDialog); remove_android_build_template->set_text(TTR("The Android build template is already installed in this project and it won't be overwritten.\nRemove the \"res://android/build\" directory manually before attempting this operation again.")); remove_android_build_template->get_ok()->set_text(TTR("Show in File Manager")); - remove_android_build_template->connect("confirmed", this, "_menu_option", varray(FILE_EXPLORE_ANDROID_BUILD_TEMPLATES)); + remove_android_build_template->connect_compat("confirmed", this, "_menu_option", varray(FILE_EXPLORE_ANDROID_BUILD_TEMPLATES)); gui_base->add_child(remove_android_build_template); file_templates = memnew(EditorFileDialog); @@ -6605,7 +6605,7 @@ EditorNode::EditorNode() { file_export_lib = memnew(EditorFileDialog); file_export_lib->set_title(TTR("Export Library")); file_export_lib->set_mode(EditorFileDialog::MODE_SAVE_FILE); - file_export_lib->connect("file_selected", this, "_dialog_action"); + file_export_lib->connect_compat("file_selected", this, "_dialog_action"); file_export_lib_merge = memnew(CheckBox); file_export_lib_merge->set_text(TTR("Merge With Existing")); file_export_lib_merge->set_pressed(true); @@ -6622,16 +6622,16 @@ EditorNode::EditorNode() { file_script->add_filter("*." + E->get()); } gui_base->add_child(file_script); - file_script->connect("file_selected", this, "_dialog_action"); + file_script->connect_compat("file_selected", this, "_dialog_action"); - file_menu->get_popup()->connect("id_pressed", this, "_menu_option"); - file_menu->connect("about_to_show", this, "_update_file_menu_opened"); - file_menu->get_popup()->connect("popup_hide", this, "_update_file_menu_closed"); + file_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option"); + file_menu->connect_compat("about_to_show", this, "_update_file_menu_opened"); + file_menu->get_popup()->connect_compat("popup_hide", this, "_update_file_menu_closed"); - settings_menu->get_popup()->connect("id_pressed", this, "_menu_option"); + settings_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option"); - file->connect("file_selected", this, "_dialog_action"); - file_templates->connect("file_selected", this, "_dialog_action"); + file->connect_compat("file_selected", this, "_dialog_action"); + file_templates->connect_compat("file_selected", this, "_dialog_action"); preview_gen = memnew(AudioStreamPreviewGenerator); add_child(preview_gen); @@ -6767,8 +6767,8 @@ EditorNode::EditorNode() { open_imported = memnew(ConfirmationDialog); open_imported->get_ok()->set_text(TTR("Open Anyway")); new_inherited_button = open_imported->add_button(TTR("New Inherited"), !OS::get_singleton()->get_swap_ok_cancel(), "inherit"); - open_imported->connect("confirmed", this, "_open_imported"); - open_imported->connect("custom_action", this, "_inherit_imported"); + open_imported->connect_compat("confirmed", this, "_open_imported"); + open_imported->connect_compat("custom_action", this, "_inherit_imported"); gui_base->add_child(open_imported); saved_version = 1; @@ -6777,11 +6777,11 @@ EditorNode::EditorNode() { quick_open = memnew(EditorQuickOpen); gui_base->add_child(quick_open); - quick_open->connect("quick_open", this, "_quick_opened"); + quick_open->connect_compat("quick_open", this, "_quick_opened"); quick_run = memnew(EditorQuickOpen); gui_base->add_child(quick_run); - quick_run->connect("quick_open", this, "_quick_run"); + quick_run->connect_compat("quick_open", this, "_quick_run"); _update_recent_scenes(); @@ -6803,10 +6803,10 @@ EditorNode::EditorNode() { execute_output_dialog->set_title(""); gui_base->add_child(execute_output_dialog); - EditorFileSystem::get_singleton()->connect("sources_changed", this, "_sources_changed"); - EditorFileSystem::get_singleton()->connect("filesystem_changed", this, "_fs_changed"); - EditorFileSystem::get_singleton()->connect("resources_reimported", this, "_resources_reimported"); - EditorFileSystem::get_singleton()->connect("resources_reload", this, "_resources_changed"); + EditorFileSystem::get_singleton()->connect_compat("sources_changed", this, "_sources_changed"); + EditorFileSystem::get_singleton()->connect_compat("filesystem_changed", this, "_fs_changed"); + EditorFileSystem::get_singleton()->connect_compat("resources_reimported", this, "_resources_reimported"); + EditorFileSystem::get_singleton()->connect_compat("resources_reload", this, "_resources_changed"); _build_icon_type_cache(); @@ -6815,7 +6815,7 @@ EditorNode::EditorNode() { pick_main_scene = memnew(ConfirmationDialog); gui_base->add_child(pick_main_scene); pick_main_scene->get_ok()->set_text(TTR("Select")); - pick_main_scene->connect("confirmed", this, "_menu_option", varray(SETTINGS_PICK_MAIN_SCENE)); + pick_main_scene->connect_compat("confirmed", this, "_menu_option", varray(SETTINGS_PICK_MAIN_SCENE)); for (int i = 0; i < _init_callbacks.size(); i++) _init_callbacks[i](); @@ -6855,7 +6855,7 @@ EditorNode::EditorNode() { screenshot_timer = memnew(Timer); screenshot_timer->set_one_shot(true); screenshot_timer->set_wait_time(settings_menu->get_popup()->get_submenu_popup_delay() + 0.1f); - screenshot_timer->connect("timeout", this, "_request_screenshot"); + screenshot_timer->connect_compat("timeout", this, "_request_screenshot"); add_child(screenshot_timer); screenshot_timer->set_owner(get_owner()); } diff --git a/editor/editor_path.cpp b/editor/editor_path.cpp index 6a1d052e02..cfb70a087a 100644 --- a/editor/editor_path.cpp +++ b/editor/editor_path.cpp @@ -152,6 +152,6 @@ EditorPath::EditorPath(EditorHistory *p_history) { history = p_history; set_clip_text(true); set_text_align(ALIGN_LEFT); - get_popup()->connect("about_to_show", this, "_about_to_show"); - get_popup()->connect("id_pressed", this, "_id_pressed"); + get_popup()->connect_compat("about_to_show", this, "_about_to_show"); + get_popup()->connect_compat("id_pressed", this, "_id_pressed"); } diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp index 16decf5c04..c499e52f79 100644 --- a/editor/editor_plugin_settings.cpp +++ b/editor/editor_plugin_settings.cpp @@ -43,8 +43,8 @@ void EditorPluginSettings::_notification(int p_what) { if (p_what == MainLoop::NOTIFICATION_WM_FOCUS_IN) { update_plugins(); } else if (p_what == Node::NOTIFICATION_READY) { - plugin_config_dialog->connect("plugin_ready", EditorNode::get_singleton(), "_on_plugin_ready"); - plugin_list->connect("button_pressed", this, "_cell_button_pressed"); + plugin_config_dialog->connect_compat("plugin_ready", EditorNode::get_singleton(), "_on_plugin_ready"); + plugin_list->connect_compat("button_pressed", this, "_cell_button_pressed"); } } @@ -219,10 +219,10 @@ EditorPluginSettings::EditorPluginSettings() { title_hb->add_child(memnew(Label(TTR("Installed Plugins:")))); title_hb->add_spacer(); create_plugin = memnew(Button(TTR("Create"))); - create_plugin->connect("pressed", this, "_create_clicked"); + create_plugin->connect_compat("pressed", this, "_create_clicked"); title_hb->add_child(create_plugin); update_list = memnew(Button(TTR("Update"))); - update_list->connect("pressed", this, "update_plugins"); + update_list->connect_compat("pressed", this, "update_plugins"); title_hb->add_child(update_list); add_child(title_hb); @@ -245,7 +245,7 @@ EditorPluginSettings::EditorPluginSettings() { plugin_list->set_column_min_width(3, 80 * EDSCALE); plugin_list->set_column_min_width(4, 40 * EDSCALE); plugin_list->set_hide_root(true); - plugin_list->connect("item_edited", this, "_plugin_activity_changed"); + plugin_list->connect_compat("item_edited", this, "_plugin_activity_changed"); VBoxContainer *mc = memnew(VBoxContainer); mc->add_child(plugin_list); diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp index 96a4551763..dd784c0980 100644 --- a/editor/editor_profiler.cpp +++ b/editor/editor_profiler.cpp @@ -686,12 +686,12 @@ EditorProfiler::EditorProfiler() { activate = memnew(Button); activate->set_toggle_mode(true); activate->set_text(TTR("Start")); - activate->connect("pressed", this, "_activate_pressed"); + activate->connect_compat("pressed", this, "_activate_pressed"); hb->add_child(activate); clear_button = memnew(Button); clear_button->set_text(TTR("Clear")); - clear_button->connect("pressed", this, "_clear_pressed"); + clear_button->connect_compat("pressed", this, "_clear_pressed"); hb->add_child(clear_button); hb->add_child(memnew(Label(TTR("Measure:")))); @@ -701,7 +701,7 @@ EditorProfiler::EditorProfiler() { display_mode->add_item(TTR("Average Time (sec)")); display_mode->add_item(TTR("Frame %")); display_mode->add_item(TTR("Physics Frame %")); - display_mode->connect("item_selected", this, "_combo_changed"); + display_mode->connect_compat("item_selected", this, "_combo_changed"); hb->add_child(display_mode); @@ -710,7 +710,7 @@ EditorProfiler::EditorProfiler() { display_time = memnew(OptionButton); display_time->add_item(TTR("Inclusive")); display_time->add_item(TTR("Self")); - display_time->connect("item_selected", this, "_combo_changed"); + display_time->connect_compat("item_selected", this, "_combo_changed"); hb->add_child(display_time); @@ -721,7 +721,7 @@ EditorProfiler::EditorProfiler() { cursor_metric_edit = memnew(SpinBox); cursor_metric_edit->set_h_size_flags(SIZE_FILL); hb->add_child(cursor_metric_edit); - cursor_metric_edit->connect("value_changed", this, "_cursor_metric_changed"); + cursor_metric_edit->connect_compat("value_changed", this, "_cursor_metric_changed"); hb->add_constant_override("separation", 8 * EDSCALE); @@ -745,14 +745,14 @@ EditorProfiler::EditorProfiler() { variables->set_column_title(2, TTR("Calls")); variables->set_column_expand(2, false); variables->set_column_min_width(2, 60 * EDSCALE); - variables->connect("item_edited", this, "_item_edited"); + variables->connect_compat("item_edited", this, "_item_edited"); graph = memnew(TextureRect); graph->set_expand(true); graph->set_mouse_filter(MOUSE_FILTER_STOP); - graph->connect("draw", this, "_graph_tex_draw"); - graph->connect("gui_input", this, "_graph_tex_input"); - graph->connect("mouse_exited", this, "_graph_tex_mouse_exit"); + graph->connect_compat("draw", this, "_graph_tex_draw"); + graph->connect_compat("gui_input", this, "_graph_tex_input"); + graph->connect_compat("mouse_exited", this, "_graph_tex_mouse_exit"); h_split->add_child(graph); graph->set_h_size_flags(SIZE_EXPAND_FILL); @@ -768,13 +768,13 @@ EditorProfiler::EditorProfiler() { frame_delay->set_wait_time(0.1); frame_delay->set_one_shot(true); add_child(frame_delay); - frame_delay->connect("timeout", this, "_update_frame"); + frame_delay->connect_compat("timeout", this, "_update_frame"); plot_delay = memnew(Timer); plot_delay->set_wait_time(0.1); plot_delay->set_one_shot(true); add_child(plot_delay); - plot_delay->connect("timeout", this, "_update_plot"); + plot_delay->connect_compat("timeout", this, "_update_plot"); plot_sigs.insert("physics_frame_time"); plot_sigs.insert("category_frame_time"); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index a93bc6169e..7ac321019a 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -89,8 +89,8 @@ EditorPropertyText::EditorPropertyText() { text = memnew(LineEdit); add_child(text); add_focusable(text); - text->connect("text_changed", this, "_text_changed"); - text->connect("text_entered", this, "_text_entered"); + text->connect_compat("text_changed", this, "_text_changed"); + text->connect_compat("text_entered", this, "_text_entered"); updating = false; } @@ -110,7 +110,7 @@ void EditorPropertyMultilineText::_open_big_text() { if (!big_text_dialog) { big_text = memnew(TextEdit); - big_text->connect("text_changed", this, "_big_text_changed"); + big_text->connect_compat("text_changed", this, "_big_text_changed"); big_text->set_wrap_enabled(true); big_text_dialog = memnew(AcceptDialog); big_text_dialog->add_child(big_text); @@ -156,13 +156,13 @@ EditorPropertyMultilineText::EditorPropertyMultilineText() { add_child(hb); set_bottom_editor(hb); text = memnew(TextEdit); - text->connect("text_changed", this, "_text_changed"); + text->connect_compat("text_changed", this, "_text_changed"); text->set_wrap_enabled(true); add_focusable(text); hb->add_child(text); text->set_h_size_flags(SIZE_EXPAND_FILL); open_big_text = memnew(ToolButton); - open_big_text->connect("pressed", this, "_open_big_text"); + open_big_text->connect_compat("pressed", this, "_open_big_text"); hb->add_child(open_big_text); big_text_dialog = NULL; big_text = NULL; @@ -205,7 +205,7 @@ EditorPropertyTextEnum::EditorPropertyTextEnum() { add_child(options); add_focusable(options); - options->connect("item_selected", this, "_option_selected"); + options->connect_compat("item_selected", this, "_option_selected"); } ///////////////////// PATH ///////////////////////// @@ -218,8 +218,8 @@ void EditorPropertyPath::_path_pressed() { if (!dialog) { dialog = memnew(EditorFileDialog); - dialog->connect("file_selected", this, "_path_selected"); - dialog->connect("dir_selected", this, "_path_selected"); + dialog->connect_compat("file_selected", this, "_path_selected"); + dialog->connect_compat("dir_selected", this, "_path_selected"); add_child(dialog); } @@ -293,8 +293,8 @@ EditorPropertyPath::EditorPropertyPath() { add_child(path_hb); path = memnew(LineEdit); path_hb->add_child(path); - path->connect("text_entered", this, "_path_selected"); - path->connect("focus_exited", this, "_path_focus_exited"); + path->connect_compat("text_entered", this, "_path_selected"); + path->connect_compat("focus_exited", this, "_path_focus_exited"); path->set_h_size_flags(SIZE_EXPAND_FILL); path_edit = memnew(Button); @@ -302,7 +302,7 @@ EditorPropertyPath::EditorPropertyPath() { path_hb->add_child(path_edit); add_focusable(path); dialog = NULL; - path_edit->connect("pressed", this, "_path_pressed"); + path_edit->connect_compat("pressed", this, "_path_pressed"); folder = false; global = false; save_mode = false; @@ -346,10 +346,10 @@ EditorPropertyClassName::EditorPropertyClassName() { add_child(property); add_focusable(property); property->set_text(selected_type); - property->connect("pressed", this, "_property_selected"); + property->connect_compat("pressed", this, "_property_selected"); dialog = memnew(CreateDialog); dialog->set_base_type(base_type); - dialog->connect("create", this, "_dialog_created"); + dialog->connect_compat("create", this, "_dialog_created"); add_child(dialog); } @@ -365,7 +365,7 @@ void EditorPropertyMember::_property_select() { if (!selector) { selector = memnew(PropertySelector); - selector->connect("selected", this, "_property_selected"); + selector->connect_compat("selected", this, "_property_selected"); add_child(selector); } @@ -455,7 +455,7 @@ EditorPropertyMember::EditorPropertyMember() { property->set_clip_text(true); add_child(property); add_focusable(property); - property->connect("pressed", this, "_property_select"); + property->connect_compat("pressed", this, "_property_select"); } ///////////////////// CHECK ///////////////////////// @@ -480,7 +480,7 @@ EditorPropertyCheck::EditorPropertyCheck() { checkbox->set_text(TTR("On")); add_child(checkbox); add_focusable(checkbox); - checkbox->connect("pressed", this, "_checkbox_pressed"); + checkbox->connect_compat("pressed", this, "_checkbox_pressed"); } ///////////////////// ENUM ///////////////////////// @@ -531,7 +531,7 @@ EditorPropertyEnum::EditorPropertyEnum() { options->set_flat(true); add_child(options); add_focusable(options); - options->connect("item_selected", this, "_option_selected"); + options->connect_compat("item_selected", this, "_option_selected"); } ///////////////////// FLAGS ///////////////////////// @@ -576,7 +576,7 @@ void EditorPropertyFlags::setup(const Vector<String> &p_options) { CheckBox *cb = memnew(CheckBox); cb->set_text(option); cb->set_clip_text(true); - cb->connect("pressed", this, "_flag_toggled"); + cb->connect_compat("pressed", this, "_flag_toggled"); add_focusable(cb); vbox->add_child(cb); flags.push_back(cb); @@ -787,20 +787,20 @@ EditorPropertyLayers::EditorPropertyLayers() { HBoxContainer *hb = memnew(HBoxContainer); add_child(hb); grid = memnew(EditorPropertyLayersGrid); - grid->connect("flag_changed", this, "_grid_changed"); + grid->connect_compat("flag_changed", this, "_grid_changed"); grid->set_h_size_flags(SIZE_EXPAND_FILL); hb->add_child(grid); button = memnew(Button); button->set_toggle_mode(true); button->set_text(".."); - button->connect("pressed", this, "_button_pressed"); + button->connect_compat("pressed", this, "_button_pressed"); hb->add_child(button); set_bottom_editor(hb); layers = memnew(PopupMenu); add_child(layers); layers->set_hide_on_checkable_item_selection(false); - layers->connect("id_pressed", this, "_menu_pressed"); - layers->connect("popup_hide", button, "set_pressed", varray(false)); + layers->connect_compat("id_pressed", this, "_menu_pressed"); + layers->connect_compat("popup_hide", button, "set_pressed", varray(false)); } ///////////////////// INT ///////////////////////// @@ -841,7 +841,7 @@ EditorPropertyInteger::EditorPropertyInteger() { spin->set_flat(true); add_child(spin); add_focusable(spin); - spin->connect("value_changed", this, "_value_changed"); + spin->connect_compat("value_changed", this, "_value_changed"); setting = false; } @@ -881,7 +881,7 @@ EditorPropertyObjectID::EditorPropertyObjectID() { edit = memnew(Button); add_child(edit); add_focusable(edit); - edit->connect("pressed", this, "_edit_pressed"); + edit->connect_compat("pressed", this, "_edit_pressed"); } ///////////////////// FLOAT ///////////////////////// @@ -921,7 +921,7 @@ EditorPropertyFloat::EditorPropertyFloat() { spin->set_flat(true); add_child(spin); add_focusable(spin); - spin->connect("value_changed", this, "_value_changed"); + spin->connect_compat("value_changed", this, "_value_changed"); setting = false; } @@ -1100,14 +1100,14 @@ void EditorPropertyEasing::_bind_methods() { EditorPropertyEasing::EditorPropertyEasing() { easing_draw = memnew(Control); - easing_draw->connect("draw", this, "_draw_easing"); - easing_draw->connect("gui_input", this, "_drag_easing"); + easing_draw->connect_compat("draw", this, "_draw_easing"); + easing_draw->connect_compat("gui_input", this, "_drag_easing"); easing_draw->set_default_cursor_shape(Control::CURSOR_MOVE); add_child(easing_draw); preset = memnew(PopupMenu); add_child(preset); - preset->connect("id_pressed", this, "_set_preset"); + preset->connect_compat("id_pressed", this, "_set_preset"); spin = memnew(EditorSpinSlider); spin->set_flat(true); @@ -1117,8 +1117,8 @@ EditorPropertyEasing::EditorPropertyEasing() { spin->set_hide_slider(true); spin->set_allow_lesser(true); spin->set_allow_greater(true); - spin->connect("value_changed", this, "_spin_value_changed"); - spin->get_line_edit()->connect("focus_exited", this, "_spin_focus_exited"); + spin->connect_compat("value_changed", this, "_spin_value_changed"); + spin->get_line_edit()->connect_compat("focus_exited", this, "_spin_focus_exited"); spin->hide(); add_child(spin); @@ -1196,7 +1196,7 @@ EditorPropertyVector2::EditorPropertyVector2() { spin[i]->set_label(desc[i]); bc->add_child(spin[i]); add_focusable(spin[i]); - spin[i]->connect("value_changed", this, "_value_changed", varray(desc[i])); + spin[i]->connect_compat("value_changed", this, "_value_changed", varray(desc[i])); if (horizontal) { spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); } @@ -1280,7 +1280,7 @@ EditorPropertyRect2::EditorPropertyRect2() { spin[i]->set_flat(true); bc->add_child(spin[i]); add_focusable(spin[i]); - spin[i]->connect("value_changed", this, "_value_changed", varray(desc[i])); + spin[i]->connect_compat("value_changed", this, "_value_changed", varray(desc[i])); if (horizontal) { spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); } @@ -1361,7 +1361,7 @@ EditorPropertyVector3::EditorPropertyVector3() { spin[i]->set_label(desc[i]); bc->add_child(spin[i]); add_focusable(spin[i]); - spin[i]->connect("value_changed", this, "_value_changed", varray(desc[i])); + spin[i]->connect_compat("value_changed", this, "_value_changed", varray(desc[i])); if (horizontal) { spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); } @@ -1444,7 +1444,7 @@ EditorPropertyPlane::EditorPropertyPlane() { spin[i]->set_label(desc[i]); bc->add_child(spin[i]); add_focusable(spin[i]); - spin[i]->connect("value_changed", this, "_value_changed", varray(desc[i])); + spin[i]->connect_compat("value_changed", this, "_value_changed", varray(desc[i])); if (horizontal) { spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); } @@ -1527,7 +1527,7 @@ EditorPropertyQuat::EditorPropertyQuat() { spin[i]->set_label(desc[i]); bc->add_child(spin[i]); add_focusable(spin[i]); - spin[i]->connect("value_changed", this, "_value_changed", varray(desc[i])); + spin[i]->connect_compat("value_changed", this, "_value_changed", varray(desc[i])); if (horizontal) { spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); } @@ -1609,7 +1609,7 @@ EditorPropertyAABB::EditorPropertyAABB() { g->add_child(spin[i]); spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); add_focusable(spin[i]); - spin[i]->connect("value_changed", this, "_value_changed", varray(desc[i])); + spin[i]->connect_compat("value_changed", this, "_value_changed", varray(desc[i])); } set_bottom_editor(g); setting = false; @@ -1684,7 +1684,7 @@ EditorPropertyTransform2D::EditorPropertyTransform2D() { g->add_child(spin[i]); spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); add_focusable(spin[i]); - spin[i]->connect("value_changed", this, "_value_changed", varray(desc[i])); + spin[i]->connect_compat("value_changed", this, "_value_changed", varray(desc[i])); } set_bottom_editor(g); setting = false; @@ -1765,7 +1765,7 @@ EditorPropertyBasis::EditorPropertyBasis() { g->add_child(spin[i]); spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); add_focusable(spin[i]); - spin[i]->connect("value_changed", this, "_value_changed", varray(desc[i])); + spin[i]->connect_compat("value_changed", this, "_value_changed", varray(desc[i])); } set_bottom_editor(g); setting = false; @@ -1852,7 +1852,7 @@ EditorPropertyTransform::EditorPropertyTransform() { g->add_child(spin[i]); spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); add_focusable(spin[i]); - spin[i]->connect("value_changed", this, "_value_changed", varray(desc[i])); + spin[i]->connect_compat("value_changed", this, "_value_changed", varray(desc[i])); } set_bottom_editor(g); setting = false; @@ -1917,9 +1917,9 @@ EditorPropertyColor::EditorPropertyColor() { picker = memnew(ColorPickerButton); add_child(picker); picker->set_flat(true); - picker->connect("color_changed", this, "_color_changed"); - picker->connect("popup_closed", this, "_popup_closed"); - picker->connect("picker_created", this, "_picker_created"); + picker->connect_compat("color_changed", this, "_color_changed"); + picker->connect_compat("popup_closed", this, "_popup_closed"); + picker->connect_compat("picker_created", this, "_picker_created"); } ////////////// NODE PATH ////////////////////// @@ -1966,7 +1966,7 @@ void EditorPropertyNodePath::_node_assign() { scene_tree->get_scene_tree()->set_show_enabled_subscene(true); scene_tree->get_scene_tree()->set_valid_types(valid_types); add_child(scene_tree); - scene_tree->connect("selected", this, "_node_selected"); + scene_tree->connect_compat("selected", this, "_node_selected"); } scene_tree->popup_centered_ratio(); } @@ -2048,12 +2048,12 @@ EditorPropertyNodePath::EditorPropertyNodePath() { assign->set_flat(true); assign->set_h_size_flags(SIZE_EXPAND_FILL); assign->set_clip_text(true); - assign->connect("pressed", this, "_node_assign"); + assign->connect_compat("pressed", this, "_node_assign"); hbc->add_child(assign); clear = memnew(Button); clear->set_flat(true); - clear->connect("pressed", this, "_node_clear"); + clear->connect_compat("pressed", this, "_node_clear"); hbc->add_child(clear); use_path_from_scene_root = false; @@ -2120,7 +2120,7 @@ void EditorPropertyResource::_menu_option(int p_which) { if (!file) { file = memnew(EditorFileDialog); - file->connect("file_selected", this, "_file_selected"); + file->connect_compat("file_selected", this, "_file_selected"); add_child(file); } file->set_mode(EditorFileDialog::MODE_OPEN_FILE); @@ -2289,7 +2289,7 @@ void EditorPropertyResource::_menu_option(int p_which) { scene_tree->get_scene_tree()->set_valid_types(valid_types); scene_tree->get_scene_tree()->set_show_enabled_subscene(true); add_child(scene_tree); - scene_tree->connect("selected", this, "_viewport_selected"); + scene_tree->connect_compat("selected", this, "_viewport_selected"); scene_tree->set_title(TTR("Pick a Viewport")); } scene_tree->popup_centered_ratio(); @@ -2607,9 +2607,9 @@ void EditorPropertyResource::update_property() { sub_inspector->set_sub_inspector(true); sub_inspector->set_enable_capitalize_paths(true); - sub_inspector->connect("property_keyed", this, "_sub_inspector_property_keyed"); - sub_inspector->connect("resource_selected", this, "_sub_inspector_resource_selected"); - sub_inspector->connect("object_id_selected", this, "_sub_inspector_object_id_selected"); + sub_inspector->connect_compat("property_keyed", this, "_sub_inspector_property_keyed"); + sub_inspector->connect_compat("resource_selected", this, "_sub_inspector_resource_selected"); + sub_inspector->connect_compat("object_id_selected", this, "_sub_inspector_object_id_selected"); sub_inspector->set_keying(is_keying()); sub_inspector->set_read_only(is_read_only()); sub_inspector->set_use_folding(is_using_folding()); @@ -2892,9 +2892,9 @@ EditorPropertyResource::EditorPropertyResource() { assign->set_flat(true); assign->set_h_size_flags(SIZE_EXPAND_FILL); assign->set_clip_text(true); - assign->connect("pressed", this, "_resource_selected"); + assign->connect_compat("pressed", this, "_resource_selected"); assign->set_drag_forwarding(this); - assign->connect("draw", this, "_button_draw"); + assign->connect_compat("draw", this, "_button_draw"); hbc->add_child(assign); add_focusable(assign); @@ -2905,18 +2905,18 @@ EditorPropertyResource::EditorPropertyResource() { preview->set_margin(MARGIN_BOTTOM, -1); preview->set_margin(MARGIN_RIGHT, -1); assign->add_child(preview); - assign->connect("gui_input", this, "_button_input"); + assign->connect_compat("gui_input", this, "_button_input"); menu = memnew(PopupMenu); add_child(menu); edit = memnew(Button); edit->set_flat(true); edit->set_toggle_mode(true); - menu->connect("id_pressed", this, "_menu_option"); - menu->connect("popup_hide", edit, "set_pressed", varray(false)); - edit->connect("pressed", this, "_update_menu"); + menu->connect_compat("id_pressed", this, "_menu_option"); + menu->connect_compat("popup_hide", edit, "set_pressed", varray(false)); + edit->connect_compat("pressed", this, "_update_menu"); hbc->add_child(edit); - edit->connect("gui_input", this, "_button_input"); + edit->connect_compat("gui_input", this, "_button_input"); add_focusable(edit); file = NULL; diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index 4b8bf7f687..ba66586c81 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -198,7 +198,7 @@ void EditorPropertyArray::_change_type_menu(int p_index) { } Variant value; - Variant::CallError ce; + Callable::CallError ce; value = Variant::construct(Variant::Type(p_index), NULL, 0, ce); Variant array = object->get_array(); array.set(changing_type_idx, value); @@ -290,7 +290,7 @@ void EditorPropertyArray::update_property() { length->set_max(1000000); length->set_h_size_flags(SIZE_EXPAND_FILL); hbc->add_child(length); - length->connect("value_changed", this, "_length_changed"); + length->connect_compat("value_changed", this, "_length_changed"); page_hb = memnew(HBoxContainer); vbox->add_child(page_hb); @@ -301,7 +301,7 @@ void EditorPropertyArray::update_property() { page->set_step(1); page_hb->add_child(page); page->set_h_size_flags(SIZE_EXPAND_FILL); - page->connect("value_changed", this, "_page_changed"); + page->connect_compat("value_changed", this, "_page_changed"); } else { //bye bye children of the box while (vbox->get_child_count() > 2) { @@ -353,8 +353,8 @@ void EditorPropertyArray::update_property() { prop->set_object_and_property(object.ptr(), prop_name); prop->set_label(itos(i + offset)); prop->set_selectable(false); - prop->connect("property_changed", this, "_property_changed"); - prop->connect("object_id_selected", this, "_object_id_selected"); + prop->connect_compat("property_changed", this, "_property_changed"); + prop->connect_compat("object_id_selected", this, "_object_id_selected"); prop->set_h_size_flags(SIZE_EXPAND_FILL); HBoxContainer *hb = memnew(HBoxContainer); @@ -369,12 +369,12 @@ void EditorPropertyArray::update_property() { Button *edit = memnew(Button); edit->set_icon(get_icon("Edit", "EditorIcons")); hb->add_child(edit); - edit->connect("pressed", this, "_change_type", varray(edit, i + offset)); + edit->connect_compat("pressed", this, "_change_type", varray(edit, i + offset)); } else { Button *remove = memnew(Button); remove->set_icon(get_icon("Remove", "EditorIcons")); - remove->connect("pressed", this, "_remove_pressed", varray(i + offset)); + remove->connect_compat("pressed", this, "_remove_pressed", varray(i + offset)); hb->add_child(remove); } @@ -412,7 +412,7 @@ void EditorPropertyArray::_edit_pressed() { Variant array = get_edited_object()->get(get_edited_property()); if (!array.is_array()) { - Variant::CallError ce; + Callable::CallError ce; array = Variant::construct(array_type, NULL, 0, ce); get_edited_object()->set(get_edited_property(), array); @@ -443,7 +443,7 @@ void EditorPropertyArray::_length_changed(double p_page) { int size = array.call("size"); for (int i = previous_size; i < size; i++) { if (array.get(i).get_type() == Variant::NIL) { - Variant::CallError ce; + Callable::CallError ce; array.set(i, Variant::construct(subtype, NULL, 0, ce)); } } @@ -453,7 +453,7 @@ void EditorPropertyArray::_length_changed(double p_page) { int size = array.call("size"); // Pool*Array don't initialize their elements, have to do it manually for (int i = previous_size; i < size; i++) { - Variant::CallError ce; + Callable::CallError ce; array.set(i, Variant::construct(array.get(i).get_type(), NULL, 0, ce)); } } @@ -503,7 +503,7 @@ EditorPropertyArray::EditorPropertyArray() { edit->set_flat(true); edit->set_h_size_flags(SIZE_EXPAND_FILL); edit->set_clip_text(true); - edit->connect("pressed", this, "_edit_pressed"); + edit->connect_compat("pressed", this, "_edit_pressed"); edit->set_toggle_mode(true); add_child(edit); add_focusable(edit); @@ -513,7 +513,7 @@ EditorPropertyArray::EditorPropertyArray() { updating = false; change_type = memnew(PopupMenu); add_child(change_type); - change_type->connect("id_pressed", this, "_change_type_menu"); + change_type->connect_compat("id_pressed", this, "_change_type_menu"); for (int i = 0; i < Variant::VARIANT_MAX; i++) { String type = Variant::get_type_name(Variant::Type(i)); @@ -586,7 +586,7 @@ void EditorPropertyDictionary::_change_type_menu(int p_index) { if (changing_type_idx < 0) { Variant value; - Variant::CallError ce; + Callable::CallError ce; value = Variant::construct(Variant::Type(p_index), NULL, 0, ce); if (changing_type_idx == -1) { object->set_new_item_key(value); @@ -602,7 +602,7 @@ void EditorPropertyDictionary::_change_type_menu(int p_index) { if (p_index < Variant::VARIANT_MAX) { Variant value; - Variant::CallError ce; + Callable::CallError ce; value = Variant::construct(Variant::Type(p_index), NULL, 0, ce); Variant key = dict.get_key_at_index(changing_type_idx); dict[key] = value; @@ -661,7 +661,7 @@ void EditorPropertyDictionary::update_property() { page->set_step(1); page_hb->add_child(page); page->set_h_size_flags(SIZE_EXPAND_FILL); - page->connect("value_changed", this, "_page_changed"); + page->connect_compat("value_changed", this, "_page_changed"); } else { // Queue children for deletion, deleting immediately might cause errors. for (int i = 1; i < vbox->get_child_count(); i++) { @@ -916,8 +916,8 @@ void EditorPropertyDictionary::update_property() { } prop->set_selectable(false); - prop->connect("property_changed", this, "_property_changed"); - prop->connect("object_id_selected", this, "_object_id_selected"); + prop->connect_compat("property_changed", this, "_property_changed"); + prop->connect_compat("object_id_selected", this, "_object_id_selected"); HBoxContainer *hb = memnew(HBoxContainer); if (add_vbox) { @@ -930,14 +930,14 @@ void EditorPropertyDictionary::update_property() { Button *edit = memnew(Button); edit->set_icon(get_icon("Edit", "EditorIcons")); hb->add_child(edit); - edit->connect("pressed", this, "_change_type", varray(edit, change_index)); + edit->connect_compat("pressed", this, "_change_type", varray(edit, change_index)); prop->update_property(); if (i == amount + 1) { Button *butt_add_item = memnew(Button); butt_add_item->set_text(TTR("Add Key/Value Pair")); - butt_add_item->connect("pressed", this, "_add_key_value"); + butt_add_item->connect_compat("pressed", this, "_add_key_value"); add_vbox->add_child(butt_add_item); } } @@ -964,7 +964,7 @@ void EditorPropertyDictionary::_edit_pressed() { Variant prop_val = get_edited_object()->get(get_edited_property()); if (prop_val.get_type() == Variant::NIL) { - Variant::CallError ce; + Callable::CallError ce; prop_val = Variant::construct(Variant::DICTIONARY, NULL, 0, ce); get_edited_object()->set(get_edited_property(), prop_val); } @@ -999,7 +999,7 @@ EditorPropertyDictionary::EditorPropertyDictionary() { edit->set_flat(true); edit->set_h_size_flags(SIZE_EXPAND_FILL); edit->set_clip_text(true); - edit->connect("pressed", this, "_edit_pressed"); + edit->connect_compat("pressed", this, "_edit_pressed"); edit->set_toggle_mode(true); add_child(edit); add_focusable(edit); @@ -1008,7 +1008,7 @@ EditorPropertyDictionary::EditorPropertyDictionary() { updating = false; change_type = memnew(PopupMenu); add_child(change_type); - change_type->connect("id_pressed", this, "_change_type_menu"); + change_type->connect_compat("id_pressed", this, "_change_type_menu"); for (int i = 0; i < Variant::VARIANT_MAX; i++) { String type = Variant::get_type_name(Variant::Type(i)); diff --git a/editor/editor_run_native.cpp b/editor/editor_run_native.cpp index db88b0cea4..490ae19e17 100644 --- a/editor/editor_run_native.cpp +++ b/editor/editor_run_native.cpp @@ -55,8 +55,8 @@ void EditorRunNative::_notification(int p_what) { small_icon.instance(); small_icon->create_from_image(im); MenuButton *mb = memnew(MenuButton); - mb->get_popup()->connect("id_pressed", this, "_run_native", varray(i)); - mb->connect("pressed", this, "_run_native", varray(-1, i)); + mb->get_popup()->connect_compat("id_pressed", this, "_run_native", varray(i)); + mb->connect_compat("pressed", this, "_run_native", varray(-1, i)); mb->set_icon(small_icon); add_child(mb); menus[i] = mb; diff --git a/editor/editor_run_script.cpp b/editor/editor_run_script.cpp index 1f269c246a..628055cac6 100644 --- a/editor/editor_run_script.cpp +++ b/editor/editor_run_script.cpp @@ -71,10 +71,10 @@ void EditorScript::_run() { return; } - Variant::CallError ce; - ce.error = Variant::CallError::CALL_OK; + Callable::CallError ce; + ce.error = Callable::CallError::CALL_OK; get_script_instance()->call("_run", NULL, 0, ce); - if (ce.error != Variant::CallError::CALL_OK) { + if (ce.error != Callable::CallError::CALL_OK) { EditorNode::add_io_error(TTR("Couldn't run script:") + "\n " + s->get_path() + "\n" + TTR("Did you forget the '_run' method?")); } diff --git a/editor/editor_sectioned_inspector.cpp b/editor/editor_sectioned_inspector.cpp index c4a84bfcdc..e95343afc9 100644 --- a/editor/editor_sectioned_inspector.cpp +++ b/editor/editor_sectioned_inspector.cpp @@ -294,7 +294,7 @@ void SectionedInspector::register_search_box(LineEdit *p_box) { search_box = p_box; inspector->register_text_enter(p_box); - search_box->connect("text_changed", this, "_search_changed"); + search_box->connect_compat("text_changed", this, "_search_changed"); } void SectionedInspector::_search_changed(const String &p_what) { @@ -332,7 +332,7 @@ SectionedInspector::SectionedInspector() : right_vb->add_child(inspector, true); inspector->set_use_doc_hints(true); - sections->connect("cell_selected", this, "_section_selected"); + sections->connect_compat("cell_selected", this, "_section_selected"); } SectionedInspector::~SectionedInspector() { diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index bdd5c57b43..9197546772 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -490,9 +490,9 @@ EditorSpinSlider::EditorSpinSlider() { grabber->hide(); grabber->set_as_toplevel(true); grabber->set_mouse_filter(MOUSE_FILTER_STOP); - grabber->connect("mouse_entered", this, "_grabber_mouse_entered"); - grabber->connect("mouse_exited", this, "_grabber_mouse_exited"); - grabber->connect("gui_input", this, "_grabber_gui_input"); + grabber->connect_compat("mouse_entered", this, "_grabber_mouse_entered"); + grabber->connect_compat("mouse_exited", this, "_grabber_mouse_exited"); + grabber->connect_compat("gui_input", this, "_grabber_gui_input"); mouse_over_spin = false; mouse_over_grabber = false; mousewheel_over_grabber = false; @@ -502,9 +502,9 @@ EditorSpinSlider::EditorSpinSlider() { add_child(value_input); value_input->set_as_toplevel(true); value_input->hide(); - value_input->connect("modal_closed", this, "_value_input_closed"); - value_input->connect("text_entered", this, "_value_input_entered"); - value_input->connect("focus_exited", this, "_value_focus_exited"); + value_input->connect_compat("modal_closed", this, "_value_input_closed"); + value_input->connect_compat("text_entered", this, "_value_input_entered"); + value_input->connect_compat("focus_exited", this, "_value_focus_exited"); value_input_just_closed = false; hide_slider = false; read_only = false; diff --git a/editor/editor_sub_scene.cpp b/editor/editor_sub_scene.cpp index cd533649e3..1dd3ac5246 100644 --- a/editor/editor_sub_scene.cpp +++ b/editor/editor_sub_scene.cpp @@ -239,24 +239,24 @@ EditorSubScene::EditorSubScene() { HBoxContainer *hb = memnew(HBoxContainer); path = memnew(LineEdit); - path->connect("text_entered", this, "_path_changed"); + path->connect_compat("text_entered", this, "_path_changed"); hb->add_child(path); path->set_h_size_flags(SIZE_EXPAND_FILL); Button *b = memnew(Button); b->set_text(TTR("Browse")); hb->add_child(b); - b->connect("pressed", this, "_path_browse"); + b->connect_compat("pressed", this, "_path_browse"); vb->add_margin_child(TTR("Scene Path:"), hb); tree = memnew(Tree); tree->set_v_size_flags(SIZE_EXPAND_FILL); vb->add_margin_child(TTR("Import From Node:"), tree, true); tree->set_select_mode(Tree::SELECT_MULTI); - tree->connect("multi_selected", this, "_item_multi_selected"); + tree->connect_compat("multi_selected", this, "_item_multi_selected"); //tree->connect("nothing_selected", this, "_deselect_items"); - tree->connect("cell_selected", this, "_selected_changed"); + tree->connect_compat("cell_selected", this, "_selected_changed"); - tree->connect("item_activated", this, "_ok", make_binds(), CONNECT_DEFERRED); + tree->connect_compat("item_activated", this, "_ok", make_binds(), CONNECT_DEFERRED); file_dialog = memnew(EditorFileDialog); List<String> extensions; @@ -269,5 +269,5 @@ EditorSubScene::EditorSubScene() { file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE); add_child(file_dialog); - file_dialog->connect("file_selected", this, "_path_selected"); + file_dialog->connect_compat("file_selected", this, "_path_selected"); } diff --git a/editor/editor_visual_profiler.cpp b/editor/editor_visual_profiler.cpp index 635d5302eb..5fb77181bc 100644 --- a/editor/editor_visual_profiler.cpp +++ b/editor/editor_visual_profiler.cpp @@ -753,12 +753,12 @@ EditorVisualProfiler::EditorVisualProfiler() { activate = memnew(Button); activate->set_toggle_mode(true); activate->set_text(TTR("Start")); - activate->connect("pressed", this, "_activate_pressed"); + activate->connect_compat("pressed", this, "_activate_pressed"); hb->add_child(activate); clear_button = memnew(Button); clear_button->set_text(TTR("Clear")); - clear_button->connect("pressed", this, "_clear_pressed"); + clear_button->connect_compat("pressed", this, "_clear_pressed"); hb->add_child(clear_button); hb->add_child(memnew(Label(TTR("Measure:")))); @@ -766,18 +766,18 @@ EditorVisualProfiler::EditorVisualProfiler() { display_mode = memnew(OptionButton); display_mode->add_item(TTR("Frame Time (msec)")); display_mode->add_item(TTR("Frame %")); - display_mode->connect("item_selected", this, "_combo_changed"); + display_mode->connect_compat("item_selected", this, "_combo_changed"); hb->add_child(display_mode); frame_relative = memnew(CheckBox(TTR("Fit to Frame"))); frame_relative->set_pressed(true); hb->add_child(frame_relative); - frame_relative->connect("pressed", this, "_update_plot"); + frame_relative->connect_compat("pressed", this, "_update_plot"); linked = memnew(CheckBox(TTR("Linked"))); linked->set_pressed(true); hb->add_child(linked); - linked->connect("pressed", this, "_update_plot"); + linked->connect_compat("pressed", this, "_update_plot"); hb->add_spacer(); @@ -786,7 +786,7 @@ EditorVisualProfiler::EditorVisualProfiler() { cursor_metric_edit = memnew(SpinBox); cursor_metric_edit->set_h_size_flags(SIZE_FILL); hb->add_child(cursor_metric_edit); - cursor_metric_edit->connect("value_changed", this, "_cursor_metric_changed"); + cursor_metric_edit->connect_compat("value_changed", this, "_cursor_metric_changed"); hb->add_constant_override("separation", 8 * EDSCALE); @@ -810,15 +810,15 @@ EditorVisualProfiler::EditorVisualProfiler() { variables->set_column_title(2, TTR("GPU")); variables->set_column_expand(2, false); variables->set_column_min_width(2, 60 * EDSCALE); - variables->connect("cell_selected", this, "_item_selected"); + variables->connect_compat("cell_selected", this, "_item_selected"); graph = memnew(TextureRect); graph->set_expand(true); graph->set_mouse_filter(MOUSE_FILTER_STOP); //graph->set_ignore_mouse(false); - graph->connect("draw", this, "_graph_tex_draw"); - graph->connect("gui_input", this, "_graph_tex_input"); - graph->connect("mouse_exited", this, "_graph_tex_mouse_exit"); + graph->connect_compat("draw", this, "_graph_tex_draw"); + graph->connect_compat("gui_input", this, "_graph_tex_input"); + graph->connect_compat("mouse_exited", this, "_graph_tex_mouse_exit"); h_split->add_child(graph); graph->set_h_size_flags(SIZE_EXPAND_FILL); @@ -835,13 +835,13 @@ EditorVisualProfiler::EditorVisualProfiler() { frame_delay->set_wait_time(0.1); frame_delay->set_one_shot(true); add_child(frame_delay); - frame_delay->connect("timeout", this, "_update_frame"); + frame_delay->connect_compat("timeout", this, "_update_frame"); plot_delay = memnew(Timer); plot_delay->set_wait_time(0.1); plot_delay->set_one_shot(true); add_child(plot_delay); - plot_delay->connect("timeout", this, "_update_plot"); + plot_delay->connect_compat("timeout", this, "_update_plot"); seeking = false; graph_height_cpu = 1; diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index 9f957cadc8..5ff4cb6246 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -93,14 +93,14 @@ void ExportTemplateManager::_update_template_list() { Button *redownload = memnew(Button); redownload->set_text(TTR("Redownload")); current_hb->add_child(redownload); - redownload->connect("pressed", this, "_download_template", varray(current_version)); + redownload->connect_compat("pressed", this, "_download_template", varray(current_version)); } Button *uninstall = memnew(Button); uninstall->set_text(TTR("Uninstall")); current_hb->add_child(uninstall); current->set_text(current_version + " " + TTR("(Installed)")); - uninstall->connect("pressed", this, "_uninstall_template", varray(current_version)); + uninstall->connect_compat("pressed", this, "_uninstall_template", varray(current_version)); } else { current->add_color_override("font_color", get_color("error_color", "Editor")); @@ -112,7 +112,7 @@ void ExportTemplateManager::_update_template_list() { redownload->set_tooltip(TTR("Official export templates aren't available for development builds.")); } - redownload->connect("pressed", this, "_download_template", varray(current_version)); + redownload->connect_compat("pressed", this, "_download_template", varray(current_version)); current_hb->add_child(redownload); current->set_text(current_version + " " + TTR("(Missing)")); } @@ -134,7 +134,7 @@ void ExportTemplateManager::_update_template_list() { uninstall->set_text(TTR("Uninstall")); hbc->add_child(uninstall); - uninstall->connect("pressed", this, "_uninstall_template", varray(E->get())); + uninstall->connect_compat("pressed", this, "_uninstall_template", varray(E->get())); installed_vb->add_child(hbc); } @@ -385,7 +385,7 @@ void ExportTemplateManager::_http_download_mirror_completed(int p_status, int p_ ERR_CONTINUE(!m.has("url") || !m.has("name")); LinkButton *lb = memnew(LinkButton); lb->set_text(m["name"]); - lb->connect("pressed", this, "_begin_template_download", varray(m["url"])); + lb->connect_compat("pressed", this, "_begin_template_download", varray(m["url"])); template_list->add_child(lb); mirrors_found = true; } @@ -689,14 +689,14 @@ ExportTemplateManager::ExportTemplateManager() { remove_confirm = memnew(ConfirmationDialog); remove_confirm->set_title(TTR("Remove Template")); add_child(remove_confirm); - remove_confirm->connect("confirmed", this, "_uninstall_template_confirm"); + remove_confirm->connect_compat("confirmed", this, "_uninstall_template_confirm"); template_open = memnew(FileDialog); template_open->set_title(TTR("Select Template File")); template_open->add_filter("*.tpz ; " + TTR("Godot Export Templates")); template_open->set_access(FileDialog::ACCESS_FILESYSTEM); template_open->set_mode(FileDialog::MODE_OPEN_FILE); - template_open->connect("file_selected", this, "_install_from_file", varray(true)); + template_open->connect_compat("file_selected", this, "_install_from_file", varray(true)); add_child(template_open); set_title(TTR("Export Template Manager")); @@ -704,18 +704,18 @@ ExportTemplateManager::ExportTemplateManager() { request_mirror = memnew(HTTPRequest); add_child(request_mirror); - request_mirror->connect("request_completed", this, "_http_download_mirror_completed"); + request_mirror->connect_compat("request_completed", this, "_http_download_mirror_completed"); download_templates = memnew(HTTPRequest); add_child(download_templates); - download_templates->connect("request_completed", this, "_http_download_templates_completed"); + download_templates->connect_compat("request_completed", this, "_http_download_templates_completed"); template_downloader = memnew(AcceptDialog); template_downloader->set_title(TTR("Download Templates")); template_downloader->get_ok()->set_text(TTR("Close")); template_downloader->set_exclusive(true); add_child(template_downloader); - template_downloader->connect("popup_hide", this, "_window_template_downloader_closed"); + template_downloader->connect_compat("popup_hide", this, "_window_template_downloader_closed"); VBoxContainer *vbc = memnew(VBoxContainer); template_downloader->add_child(vbc); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index b32f90f7b9..4172570089 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -300,19 +300,19 @@ void FileSystemDock::_notification(int p_what) { if (initialized) return; initialized = true; - EditorFeatureProfileManager::get_singleton()->connect("current_feature_profile_changed", this, "_feature_profile_changed"); + EditorFeatureProfileManager::get_singleton()->connect_compat("current_feature_profile_changed", this, "_feature_profile_changed"); - EditorFileSystem::get_singleton()->connect("filesystem_changed", this, "_fs_changed"); - EditorResourcePreview::get_singleton()->connect("preview_invalidated", this, "_preview_invalidated"); + EditorFileSystem::get_singleton()->connect_compat("filesystem_changed", this, "_fs_changed"); + EditorResourcePreview::get_singleton()->connect_compat("preview_invalidated", this, "_preview_invalidated"); String ei = "EditorIcons"; button_reload->set_icon(get_icon("Reload", ei)); button_toggle_display_mode->set_icon(get_icon("Panels2", ei)); - button_file_list_display_mode->connect("pressed", this, "_toggle_file_display"); + button_file_list_display_mode->connect_compat("pressed", this, "_toggle_file_display"); - files->connect("item_activated", this, "_file_list_activate_file"); - button_hist_next->connect("pressed", this, "_fw_history"); - button_hist_prev->connect("pressed", this, "_bw_history"); + files->connect_compat("item_activated", this, "_file_list_activate_file"); + button_hist_next->connect_compat("pressed", this, "_fw_history"); + button_hist_prev->connect_compat("pressed", this, "_bw_history"); tree_search_box->set_right_icon(get_icon("Search", ei)); tree_search_box->set_clear_button_enabled(true); file_list_search_box->set_right_icon(get_icon("Search", ei)); @@ -320,10 +320,10 @@ void FileSystemDock::_notification(int p_what) { button_hist_next->set_icon(get_icon("Forward", ei)); button_hist_prev->set_icon(get_icon("Back", ei)); - file_list_popup->connect("id_pressed", this, "_file_list_rmb_option"); - tree_popup->connect("id_pressed", this, "_tree_rmb_option"); + file_list_popup->connect_compat("id_pressed", this, "_file_list_rmb_option"); + tree_popup->connect_compat("id_pressed", this, "_tree_rmb_option"); - current_path->connect("text_entered", this, "_navigate_to_path"); + current_path->connect_compat("text_entered", this, "_navigate_to_path"); always_show_folders = bool(EditorSettings::get_singleton()->get("docks/filesystem/always_show_folders")); @@ -2552,7 +2552,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { button_reload = memnew(Button); button_reload->set_flat(true); - button_reload->connect("pressed", this, "_rescan"); + button_reload->connect_compat("pressed", this, "_rescan"); button_reload->set_focus_mode(FOCUS_NONE); button_reload->set_tooltip(TTR("Re-Scan Filesystem")); button_reload->hide(); @@ -2561,7 +2561,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { button_toggle_display_mode = memnew(Button); button_toggle_display_mode->set_flat(true); button_toggle_display_mode->set_toggle_mode(true); - button_toggle_display_mode->connect("toggled", this, "_toggle_split_mode"); + button_toggle_display_mode->connect_compat("toggled", this, "_toggle_split_mode"); button_toggle_display_mode->set_focus_mode(FOCUS_NONE); button_toggle_display_mode->set_tooltip(TTR("Toggle Split Mode")); toolbar_hbc->add_child(button_toggle_display_mode); @@ -2573,7 +2573,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { tree_search_box = memnew(LineEdit); tree_search_box->set_h_size_flags(SIZE_EXPAND_FILL); tree_search_box->set_placeholder(TTR("Search files")); - tree_search_box->connect("text_changed", this, "_search_changed", varray(tree_search_box)); + tree_search_box->connect_compat("text_changed", this, "_search_changed", varray(tree_search_box)); toolbar2_hbc->add_child(tree_search_box); file_list_popup = memnew(PopupMenu); @@ -2597,12 +2597,12 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { tree->set_custom_minimum_size(Size2(0, 15 * EDSCALE)); split_box->add_child(tree); - tree->connect("item_activated", this, "_tree_activate_file"); - tree->connect("multi_selected", this, "_tree_multi_selected"); - tree->connect("item_rmb_selected", this, "_tree_rmb_select"); - tree->connect("empty_rmb", this, "_tree_rmb_empty"); - tree->connect("nothing_selected", this, "_tree_empty_selected"); - tree->connect("gui_input", this, "_tree_gui_input"); + tree->connect_compat("item_activated", this, "_tree_activate_file"); + tree->connect_compat("multi_selected", this, "_tree_multi_selected"); + tree->connect_compat("item_rmb_selected", this, "_tree_rmb_select"); + tree->connect_compat("empty_rmb", this, "_tree_rmb_empty"); + tree->connect_compat("nothing_selected", this, "_tree_empty_selected"); + tree->connect_compat("gui_input", this, "_tree_gui_input"); file_list_vb = memnew(VBoxContainer); file_list_vb->set_v_size_flags(SIZE_EXPAND_FILL); @@ -2614,7 +2614,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { file_list_search_box = memnew(LineEdit); file_list_search_box->set_h_size_flags(SIZE_EXPAND_FILL); file_list_search_box->set_placeholder(TTR("Search files")); - file_list_search_box->connect("text_changed", this, "_search_changed", varray(file_list_search_box)); + file_list_search_box->connect_compat("text_changed", this, "_search_changed", varray(file_list_search_box)); path_hb->add_child(file_list_search_box); button_file_list_display_mode = memnew(ToolButton); @@ -2624,10 +2624,10 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { files->set_v_size_flags(SIZE_EXPAND_FILL); files->set_select_mode(ItemList::SELECT_MULTI); files->set_drag_forwarding(this); - files->connect("item_rmb_selected", this, "_file_list_rmb_select"); - files->connect("gui_input", this, "_file_list_gui_input"); - files->connect("multi_selected", this, "_file_multi_selected"); - files->connect("rmb_clicked", this, "_file_list_rmb_pressed"); + files->connect_compat("item_rmb_selected", this, "_file_list_rmb_select"); + files->connect_compat("gui_input", this, "_file_list_gui_input"); + files->connect_compat("multi_selected", this, "_file_multi_selected"); + files->connect_compat("rmb_clicked", this, "_file_list_rmb_pressed"); files->set_custom_minimum_size(Size2(0, 15 * EDSCALE)); files->set_allow_rmb_select(true); file_list_vb->add_child(files); @@ -2651,14 +2651,14 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { add_child(owners_editor); remove_dialog = memnew(DependencyRemoveDialog); - remove_dialog->connect("file_removed", this, "_file_deleted"); - remove_dialog->connect("folder_removed", this, "_folder_deleted"); + remove_dialog->connect_compat("file_removed", this, "_file_deleted"); + remove_dialog->connect_compat("folder_removed", this, "_folder_deleted"); add_child(remove_dialog); move_dialog = memnew(EditorDirDialog); move_dialog->get_ok()->set_text(TTR("Move")); add_child(move_dialog); - move_dialog->connect("dir_selected", this, "_move_operation_confirm"); + move_dialog->connect_compat("dir_selected", this, "_move_operation_confirm"); rename_dialog = memnew(ConfirmationDialog); VBoxContainer *rename_dialog_vb = memnew(VBoxContainer); @@ -2669,13 +2669,13 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { rename_dialog->get_ok()->set_text(TTR("Rename")); add_child(rename_dialog); rename_dialog->register_text_enter(rename_dialog_text); - rename_dialog->connect("confirmed", this, "_rename_operation_confirm"); + rename_dialog->connect_compat("confirmed", this, "_rename_operation_confirm"); overwrite_dialog = memnew(ConfirmationDialog); overwrite_dialog->set_text(TTR("There is already file or folder with the same name in this location.")); overwrite_dialog->get_ok()->set_text(TTR("Overwrite")); add_child(overwrite_dialog); - overwrite_dialog->connect("confirmed", this, "_move_with_overwrite"); + overwrite_dialog->connect_compat("confirmed", this, "_move_with_overwrite"); duplicate_dialog = memnew(ConfirmationDialog); VBoxContainer *duplicate_dialog_vb = memnew(VBoxContainer); @@ -2686,7 +2686,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { duplicate_dialog->get_ok()->set_text(TTR("Duplicate")); add_child(duplicate_dialog); duplicate_dialog->register_text_enter(duplicate_dialog_text); - duplicate_dialog->connect("confirmed", this, "_duplicate_operation_confirm"); + duplicate_dialog->connect_compat("confirmed", this, "_duplicate_operation_confirm"); make_dir_dialog = memnew(ConfirmationDialog); make_dir_dialog->set_title(TTR("Create Folder")); @@ -2697,7 +2697,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { make_folder_dialog_vb->add_margin_child(TTR("Name:"), make_dir_dialog_text); add_child(make_dir_dialog); make_dir_dialog->register_text_enter(make_dir_dialog_text); - make_dir_dialog->connect("confirmed", this, "_make_dir_confirm"); + make_dir_dialog->connect_compat("confirmed", this, "_make_dir_confirm"); make_scene_dialog = memnew(ConfirmationDialog); make_scene_dialog->set_title(TTR("Create Scene")); @@ -2708,7 +2708,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { make_scene_dialog_vb->add_margin_child(TTR("Name:"), make_scene_dialog_text); add_child(make_scene_dialog); make_scene_dialog->register_text_enter(make_scene_dialog_text); - make_scene_dialog->connect("confirmed", this, "_make_scene_confirm"); + make_scene_dialog->connect_compat("confirmed", this, "_make_scene_confirm"); make_script_dialog = memnew(ScriptCreateDialog); make_script_dialog->set_title(TTR("Create Script")); @@ -2717,7 +2717,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { new_resource_dialog = memnew(CreateDialog); add_child(new_resource_dialog); new_resource_dialog->set_base_type("Resource"); - new_resource_dialog->connect("create", this, "_resource_created"); + new_resource_dialog->connect_compat("create", this, "_resource_created"); searched_string = String(); uncollapsed_paths_before_search = Vector<String>(); diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index f4bc6ae4be..5c012183e7 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -319,8 +319,8 @@ FindInFilesDialog::FindInFilesDialog() { _search_text_line_edit = memnew(LineEdit); _search_text_line_edit->set_h_size_flags(SIZE_EXPAND_FILL); - _search_text_line_edit->connect("text_changed", this, "_on_search_text_modified"); - _search_text_line_edit->connect("text_entered", this, "_on_search_text_entered"); + _search_text_line_edit->connect_compat("text_changed", this, "_on_search_text_modified"); + _search_text_line_edit->connect_compat("text_entered", this, "_on_search_text_entered"); gc->add_child(_search_text_line_edit); _replace_label = memnew(Label); @@ -330,7 +330,7 @@ FindInFilesDialog::FindInFilesDialog() { _replace_text_line_edit = memnew(LineEdit); _replace_text_line_edit->set_h_size_flags(SIZE_EXPAND_FILL); - _replace_text_line_edit->connect("text_entered", this, "_on_replace_text_entered"); + _replace_text_line_edit->connect_compat("text_entered", this, "_on_replace_text_entered"); _replace_text_line_edit->hide(); gc->add_child(_replace_text_line_edit); @@ -367,12 +367,12 @@ FindInFilesDialog::FindInFilesDialog() { Button *folder_button = memnew(Button); folder_button->set_text("..."); - folder_button->connect("pressed", this, "_on_folder_button_pressed"); + folder_button->connect_compat("pressed", this, "_on_folder_button_pressed"); hbc->add_child(folder_button); _folder_dialog = memnew(FileDialog); _folder_dialog->set_mode(FileDialog::MODE_OPEN_DIR); - _folder_dialog->connect("dir_selected", this, "_on_folder_selected"); + _folder_dialog->connect_compat("dir_selected", this, "_on_folder_selected"); add_child(_folder_dialog); gc->add_child(hbc); @@ -563,8 +563,8 @@ const char *FindInFilesPanel::SIGNAL_FILES_MODIFIED = "files_modified"; FindInFilesPanel::FindInFilesPanel() { _finder = memnew(FindInFiles); - _finder->connect(FindInFiles::SIGNAL_RESULT_FOUND, this, "_on_result_found"); - _finder->connect(FindInFiles::SIGNAL_FINISHED, this, "_on_finished"); + _finder->connect_compat(FindInFiles::SIGNAL_RESULT_FOUND, this, "_on_result_found"); + _finder->connect_compat(FindInFiles::SIGNAL_FINISHED, this, "_on_finished"); add_child(_finder); VBoxContainer *vbc = memnew(VBoxContainer); @@ -596,7 +596,7 @@ FindInFilesPanel::FindInFilesPanel() { _cancel_button = memnew(Button); _cancel_button->set_text(TTR("Cancel")); - _cancel_button->connect("pressed", this, "_on_cancel_button_clicked"); + _cancel_button->connect_compat("pressed", this, "_on_cancel_button_clicked"); _cancel_button->hide(); hbc->add_child(_cancel_button); @@ -606,8 +606,8 @@ FindInFilesPanel::FindInFilesPanel() { _results_display = memnew(Tree); _results_display->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("source", "EditorFonts")); _results_display->set_v_size_flags(SIZE_EXPAND_FILL); - _results_display->connect("item_selected", this, "_on_result_selected"); - _results_display->connect("item_edited", this, "_on_item_edited"); + _results_display->connect_compat("item_selected", this, "_on_result_selected"); + _results_display->connect_compat("item_edited", this, "_on_item_edited"); _results_display->set_hide_root(true); _results_display->set_select_mode(Tree::SELECT_ROW); _results_display->set_allow_rmb_select(true); @@ -625,12 +625,12 @@ FindInFilesPanel::FindInFilesPanel() { _replace_line_edit = memnew(LineEdit); _replace_line_edit->set_h_size_flags(SIZE_EXPAND_FILL); - _replace_line_edit->connect("text_changed", this, "_on_replace_text_changed"); + _replace_line_edit->connect_compat("text_changed", this, "_on_replace_text_changed"); _replace_container->add_child(_replace_line_edit); _replace_all_button = memnew(Button); _replace_all_button->set_text(TTR("Replace all (no undo)")); - _replace_all_button->connect("pressed", this, "_on_replace_all_clicked"); + _replace_all_button->connect_compat("pressed", this, "_on_replace_all_clicked"); _replace_container->add_child(_replace_all_button); _replace_container->hide(); diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp index cd185ae12e..739e9f68c5 100644 --- a/editor/groups_editor.cpp +++ b/editor/groups_editor.cpp @@ -435,9 +435,9 @@ GroupDialog::GroupDialog() { groups->set_allow_rmb_select(true); groups->set_v_size_flags(SIZE_EXPAND_FILL); groups->add_constant_override("draw_guides", 1); - groups->connect("item_selected", this, "_group_selected"); - groups->connect("button_pressed", this, "_delete_group_pressed"); - groups->connect("item_edited", this, "_group_renamed"); + groups->connect_compat("item_selected", this, "_group_selected"); + groups->connect_compat("button_pressed", this, "_delete_group_pressed"); + groups->connect_compat("item_edited", this, "_group_renamed"); HBoxContainer *chbc = memnew(HBoxContainer); vbc_left->add_child(chbc); @@ -446,12 +446,12 @@ GroupDialog::GroupDialog() { add_group_text = memnew(LineEdit); chbc->add_child(add_group_text); add_group_text->set_h_size_flags(SIZE_EXPAND_FILL); - add_group_text->connect("text_entered", this, "_add_group_pressed"); + add_group_text->connect_compat("text_entered", this, "_add_group_pressed"); Button *add_group_button = memnew(Button); add_group_button->set_text(TTR("Add")); chbc->add_child(add_group_button); - add_group_button->connect("pressed", this, "_add_group_pressed", varray(String())); + add_group_button->connect_compat("pressed", this, "_add_group_pressed", varray(String())); VBoxContainer *vbc_add = memnew(VBoxContainer); hbc->add_child(vbc_add); @@ -468,7 +468,7 @@ GroupDialog::GroupDialog() { nodes_to_add->set_select_mode(Tree::SELECT_MULTI); nodes_to_add->set_v_size_flags(SIZE_EXPAND_FILL); nodes_to_add->add_constant_override("draw_guides", 1); - nodes_to_add->connect("item_selected", this, "_nodes_to_add_selected"); + nodes_to_add->connect_compat("item_selected", this, "_nodes_to_add_selected"); HBoxContainer *add_filter_hbc = memnew(HBoxContainer); add_filter_hbc->add_constant_override("separate", 0); @@ -478,7 +478,7 @@ GroupDialog::GroupDialog() { add_filter->set_h_size_flags(SIZE_EXPAND_FILL); add_filter->set_placeholder(TTR("Filter nodes")); add_filter_hbc->add_child(add_filter); - add_filter->connect("text_changed", this, "_add_filter_changed"); + add_filter->connect_compat("text_changed", this, "_add_filter_changed"); VBoxContainer *vbc_buttons = memnew(VBoxContainer); hbc->add_child(vbc_buttons); @@ -487,7 +487,7 @@ GroupDialog::GroupDialog() { add_button = memnew(ToolButton); add_button->set_text(TTR("Add")); - add_button->connect("pressed", this, "_add_pressed"); + add_button->connect_compat("pressed", this, "_add_pressed"); vbc_buttons->add_child(add_button); vbc_buttons->add_spacer(); @@ -496,7 +496,7 @@ GroupDialog::GroupDialog() { remove_button = memnew(ToolButton); remove_button->set_text(TTR("Remove")); - remove_button->connect("pressed", this, "_removed_pressed"); + remove_button->connect_compat("pressed", this, "_removed_pressed"); vbc_buttons->add_child(remove_button); @@ -515,7 +515,7 @@ GroupDialog::GroupDialog() { nodes_to_remove->set_hide_folding(true); nodes_to_remove->set_select_mode(Tree::SELECT_MULTI); nodes_to_remove->add_constant_override("draw_guides", 1); - nodes_to_remove->connect("item_selected", this, "_node_to_remove_selected"); + nodes_to_remove->connect_compat("item_selected", this, "_node_to_remove_selected"); HBoxContainer *remove_filter_hbc = memnew(HBoxContainer); remove_filter_hbc->add_constant_override("separate", 0); @@ -525,7 +525,7 @@ GroupDialog::GroupDialog() { remove_filter->set_h_size_flags(SIZE_EXPAND_FILL); remove_filter->set_placeholder(TTR("Filter nodes")); remove_filter_hbc->add_child(remove_filter); - remove_filter->connect("text_changed", this, "_remove_filter_changed"); + remove_filter->connect_compat("text_changed", this, "_remove_filter_changed"); group_empty = memnew(Label()); group_empty->set_text(TTR("Empty groups will be automatically removed.")); @@ -686,12 +686,12 @@ GroupsEditor::GroupsEditor() { group_dialog = memnew(GroupDialog); group_dialog->set_as_toplevel(true); add_child(group_dialog); - group_dialog->connect("group_edited", this, "update_tree"); + group_dialog->connect_compat("group_edited", this, "update_tree"); Button *group_dialog_button = memnew(Button); group_dialog_button->set_text(TTR("Manage Groups")); vbc->add_child(group_dialog_button); - group_dialog_button->connect("pressed", this, "_show_group_dialog"); + group_dialog_button->connect_compat("pressed", this, "_show_group_dialog"); HBoxContainer *hbc = memnew(HBoxContainer); vbc->add_child(hbc); @@ -699,18 +699,18 @@ GroupsEditor::GroupsEditor() { group_name = memnew(LineEdit); group_name->set_h_size_flags(SIZE_EXPAND_FILL); hbc->add_child(group_name); - group_name->connect("text_entered", this, "_add_group"); + group_name->connect_compat("text_entered", this, "_add_group"); add = memnew(Button); add->set_text(TTR("Add")); hbc->add_child(add); - add->connect("pressed", this, "_add_group", varray(String())); + add->connect_compat("pressed", this, "_add_group", varray(String())); tree = memnew(Tree); tree->set_hide_root(true); tree->set_v_size_flags(SIZE_EXPAND_FILL); vbc->add_child(tree); - tree->connect("button_pressed", this, "_remove_group"); + tree->connect_compat("button_pressed", this, "_remove_group"); tree->add_constant_override("draw_guides", 1); add_constant_override("separation", 3 * EDSCALE); } diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index 987082b1ec..06c6f9940c 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -537,26 +537,26 @@ ImportDock::ImportDock() { add_margin_child(TTR("Import As:"), hb); import_as = memnew(OptionButton); import_as->set_disabled(true); - import_as->connect("item_selected", this, "_importer_selected"); + import_as->connect_compat("item_selected", this, "_importer_selected"); hb->add_child(import_as); import_as->set_h_size_flags(SIZE_EXPAND_FILL); preset = memnew(MenuButton); preset->set_text(TTR("Preset")); preset->set_disabled(true); - preset->get_popup()->connect("index_pressed", this, "_preset_selected"); + preset->get_popup()->connect_compat("index_pressed", this, "_preset_selected"); hb->add_child(preset); import_opts = memnew(EditorInspector); add_child(import_opts); import_opts->set_v_size_flags(SIZE_EXPAND_FILL); - import_opts->connect("property_toggled", this, "_property_toggled"); + import_opts->connect_compat("property_toggled", this, "_property_toggled"); hb = memnew(HBoxContainer); add_child(hb); import = memnew(Button); import->set_text(TTR("Reimport")); import->set_disabled(true); - import->connect("pressed", this, "_reimport_attempt"); + import->connect_compat("pressed", this, "_reimport_attempt"); hb->add_spacer(); hb->add_child(import); hb->add_spacer(); @@ -564,7 +564,7 @@ ImportDock::ImportDock() { reimport_confirm = memnew(ConfirmationDialog); reimport_confirm->get_ok()->set_text(TTR("Save scenes, re-import and restart")); add_child(reimport_confirm); - reimport_confirm->connect("confirmed", this, "_reimport_and_restart"); + reimport_confirm->connect_compat("confirmed", this, "_reimport_and_restart"); VBoxContainer *vbc_confirm = memnew(VBoxContainer()); vbc_confirm->add_child(memnew(Label(TTR("Changing the type of an imported file requires editor restart.")))); diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index 954a941a96..6eaf6eb04a 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -511,14 +511,14 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) { resource_new_button->set_tooltip(TTR("Create a new resource in memory and edit it.")); resource_new_button->set_icon(get_icon("New", "EditorIcons")); general_options_hb->add_child(resource_new_button); - resource_new_button->connect("pressed", this, "_new_resource"); + resource_new_button->connect_compat("pressed", this, "_new_resource"); resource_new_button->set_focus_mode(Control::FOCUS_NONE); resource_load_button = memnew(ToolButton); resource_load_button->set_tooltip(TTR("Load an existing resource from disk and edit it.")); resource_load_button->set_icon(get_icon("Load", "EditorIcons")); general_options_hb->add_child(resource_load_button); - resource_load_button->connect("pressed", this, "_open_resource_selector"); + resource_load_button->connect_compat("pressed", this, "_open_resource_selector"); resource_load_button->set_focus_mode(Control::FOCUS_NONE); resource_save_button = memnew(MenuButton); @@ -527,7 +527,7 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) { general_options_hb->add_child(resource_save_button); resource_save_button->get_popup()->add_item(TTR("Save"), RESOURCE_SAVE); resource_save_button->get_popup()->add_item(TTR("Save As..."), RESOURCE_SAVE_AS); - resource_save_button->get_popup()->connect("id_pressed", this, "_menu_option"); + resource_save_button->get_popup()->connect_compat("id_pressed", this, "_menu_option"); resource_save_button->set_focus_mode(Control::FOCUS_NONE); resource_save_button->set_disabled(true); @@ -539,7 +539,7 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) { backward_button->set_flat(true); backward_button->set_tooltip(TTR("Go to the previous edited object in history.")); backward_button->set_disabled(true); - backward_button->connect("pressed", this, "_edit_back"); + backward_button->connect_compat("pressed", this, "_edit_back"); forward_button = memnew(ToolButton); general_options_hb->add_child(forward_button); @@ -547,14 +547,14 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) { forward_button->set_flat(true); forward_button->set_tooltip(TTR("Go to the next edited object in history.")); forward_button->set_disabled(true); - forward_button->connect("pressed", this, "_edit_forward"); + forward_button->connect_compat("pressed", this, "_edit_forward"); history_menu = memnew(MenuButton); history_menu->set_tooltip(TTR("History of recently edited objects.")); history_menu->set_icon(get_icon("History", "EditorIcons")); general_options_hb->add_child(history_menu); - history_menu->connect("about_to_show", this, "_prepare_history"); - history_menu->get_popup()->connect("id_pressed", this, "_select_history"); + history_menu->connect_compat("about_to_show", this, "_prepare_history"); + history_menu->get_popup()->connect_compat("id_pressed", this, "_select_history"); HBoxContainer *node_info_hb = memnew(HBoxContainer); add_child(node_info_hb); @@ -567,12 +567,12 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) { object_menu->set_icon(get_icon("Tools", "EditorIcons")); node_info_hb->add_child(object_menu); object_menu->set_tooltip(TTR("Object properties.")); - object_menu->get_popup()->connect("id_pressed", this, "_menu_option"); + object_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option"); new_resource_dialog = memnew(CreateDialog); editor->get_gui_base()->add_child(new_resource_dialog); new_resource_dialog->set_base_type("Resource"); - new_resource_dialog->connect("create", this, "_resource_created"); + new_resource_dialog->connect_compat("create", this, "_resource_created"); search = memnew(LineEdit); search->set_h_size_flags(Control::SIZE_EXPAND_FILL); @@ -588,7 +588,7 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) { warning->add_color_override("font_color", get_color("warning_color", "Editor")); warning->set_clip_text(true); warning->hide(); - warning->connect("pressed", this, "_warning_pressed"); + warning->connect_compat("pressed", this, "_warning_pressed"); warning_dialog = memnew(AcceptDialog); editor->get_gui_base()->add_child(warning_dialog); @@ -596,7 +596,7 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) { load_resource_dialog = memnew(EditorFileDialog); add_child(load_resource_dialog); load_resource_dialog->set_current_dir("res://"); - load_resource_dialog->connect("file_selected", this, "_resource_file_selected"); + load_resource_dialog->connect_compat("file_selected", this, "_resource_file_selected"); inspector = memnew(EditorInspector); add_child(inspector); @@ -612,8 +612,8 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) { inspector->set_use_filter(true); // TODO: check me - inspector->connect("resource_selected", this, "_resource_selected"); - inspector->connect("property_keyed", this, "_property_keyed"); + inspector->connect_compat("resource_selected", this, "_resource_selected"); + inspector->connect_compat("property_keyed", this, "_property_keyed"); } InspectorDock::~InspectorDock() { diff --git a/editor/node_dock.cpp b/editor/node_dock.cpp index c53c5f330b..f04afcd04d 100644 --- a/editor/node_dock.cpp +++ b/editor/node_dock.cpp @@ -107,7 +107,7 @@ NodeDock::NodeDock() { connections_button->set_h_size_flags(SIZE_EXPAND_FILL); connections_button->set_clip_text(true); mode_hb->add_child(connections_button); - connections_button->connect("pressed", this, "show_connections"); + connections_button->connect_compat("pressed", this, "show_connections"); groups_button = memnew(ToolButton); groups_button->set_text(TTR("Groups")); @@ -116,7 +116,7 @@ NodeDock::NodeDock() { groups_button->set_h_size_flags(SIZE_EXPAND_FILL); groups_button->set_clip_text(true); mode_hb->add_child(groups_button); - groups_button->connect("pressed", this, "show_groups"); + groups_button->connect_compat("pressed", this, "show_groups"); connections = memnew(ConnectionsDock(EditorNode::get_singleton())); connections->set_undoredo(EditorNode::get_undo_redo()); diff --git a/editor/plugin_config_dialog.cpp b/editor/plugin_config_dialog.cpp index 1506ba319c..4e3333f528 100644 --- a/editor/plugin_config_dialog.cpp +++ b/editor/plugin_config_dialog.cpp @@ -132,8 +132,8 @@ void PluginConfigDialog::_on_required_text_changed(const String &) { void PluginConfigDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_READY: { - connect("confirmed", this, "_on_confirmed"); - get_cancel()->connect("pressed", this, "_on_cancelled"); + connect_compat("confirmed", this, "_on_confirmed"); + get_cancel()->connect_compat("pressed", this, "_on_cancelled"); } break; case NOTIFICATION_POST_POPUP: { @@ -194,7 +194,7 @@ PluginConfigDialog::PluginConfigDialog() { grid->add_child(name_lb); name_edit = memnew(LineEdit); - name_edit->connect("text_changed", this, "_on_required_text_changed"); + name_edit->connect_compat("text_changed", this, "_on_required_text_changed"); name_edit->set_placeholder("MyPlugin"); grid->add_child(name_edit); @@ -253,7 +253,7 @@ PluginConfigDialog::PluginConfigDialog() { grid->add_child(script_lb); script_edit = memnew(LineEdit); - script_edit->connect("text_changed", this, "_on_required_text_changed"); + script_edit->connect_compat("text_changed", this, "_on_required_text_changed"); script_edit->set_placeholder("\"plugin.gd\" -> res://addons/my_plugin/plugin.gd"); grid->add_child(script_edit); diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index 2d038d11ad..6f29b6c76a 100644 --- a/editor/plugins/abstract_polygon_2d_editor.cpp +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -209,8 +209,8 @@ void AbstractPolygon2DEditor::_notification(int p_what) { button_delete->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveDelete", "EditorIcons")); button_edit->set_pressed(true); - get_tree()->connect("node_removed", this, "_node_removed"); - create_resource->connect("confirmed", this, "_create_resource"); + get_tree()->connect_compat("node_removed", this, "_node_removed"); + create_resource->connect_compat("confirmed", this, "_create_resource"); } break; } } @@ -820,17 +820,17 @@ AbstractPolygon2DEditor::AbstractPolygon2DEditor(EditorNode *p_editor, bool p_wi add_child(memnew(VSeparator)); button_create = memnew(ToolButton); add_child(button_create); - button_create->connect("pressed", this, "_menu_option", varray(MODE_CREATE)); + button_create->connect_compat("pressed", this, "_menu_option", varray(MODE_CREATE)); button_create->set_toggle_mode(true); button_edit = memnew(ToolButton); add_child(button_edit); - button_edit->connect("pressed", this, "_menu_option", varray(MODE_EDIT)); + button_edit->connect_compat("pressed", this, "_menu_option", varray(MODE_EDIT)); button_edit->set_toggle_mode(true); button_delete = memnew(ToolButton); add_child(button_delete); - button_delete->connect("pressed", this, "_menu_option", varray(MODE_DELETE)); + button_delete->connect_compat("pressed", this, "_menu_option", varray(MODE_DELETE)); button_delete->set_toggle_mode(true); create_resource = memnew(ConfirmationDialog); diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index 9261613ddd..c955f2b806 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -622,28 +622,28 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { top_hb->add_child(tool_blend); tool_blend->set_pressed(true); tool_blend->set_tooltip(TTR("Set the blending position within the space")); - tool_blend->connect("pressed", this, "_tool_switch", varray(3)); + tool_blend->connect_compat("pressed", this, "_tool_switch", varray(3)); tool_select = memnew(ToolButton); tool_select->set_toggle_mode(true); tool_select->set_button_group(bg); top_hb->add_child(tool_select); tool_select->set_tooltip(TTR("Select and move points, create points with RMB.")); - tool_select->connect("pressed", this, "_tool_switch", varray(0)); + tool_select->connect_compat("pressed", this, "_tool_switch", varray(0)); tool_create = memnew(ToolButton); tool_create->set_toggle_mode(true); tool_create->set_button_group(bg); top_hb->add_child(tool_create); tool_create->set_tooltip(TTR("Create points.")); - tool_create->connect("pressed", this, "_tool_switch", varray(1)); + tool_create->connect_compat("pressed", this, "_tool_switch", varray(1)); tool_erase_sep = memnew(VSeparator); top_hb->add_child(tool_erase_sep); tool_erase = memnew(ToolButton); top_hb->add_child(tool_erase); tool_erase->set_tooltip(TTR("Erase points.")); - tool_erase->connect("pressed", this, "_erase_selected"); + tool_erase->connect_compat("pressed", this, "_erase_selected"); top_hb->add_child(memnew(VSeparator)); @@ -652,7 +652,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { top_hb->add_child(snap); snap->set_pressed(true); snap->set_tooltip(TTR("Enable snap and show grid.")); - snap->connect("pressed", this, "_snap_toggled"); + snap->connect_compat("pressed", this, "_snap_toggled"); snap_value = memnew(SpinBox); top_hb->add_child(snap_value); @@ -670,12 +670,12 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { edit_value->set_min(-1000); edit_value->set_max(1000); edit_value->set_step(0.01); - edit_value->connect("value_changed", this, "_edit_point_pos"); + edit_value->connect_compat("value_changed", this, "_edit_point_pos"); open_editor = memnew(Button); edit_hb->add_child(open_editor); open_editor->set_text(TTR("Open Editor")); - open_editor->connect("pressed", this, "_open_editor", varray(), CONNECT_DEFERRED); + open_editor->connect_compat("pressed", this, "_open_editor", varray(), CONNECT_DEFERRED); edit_hb->hide(); open_editor->hide(); @@ -691,8 +691,8 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { panel->set_v_size_flags(SIZE_EXPAND_FILL); blend_space_draw = memnew(Control); - blend_space_draw->connect("gui_input", this, "_blend_space_gui_input"); - blend_space_draw->connect("draw", this, "_blend_space_draw"); + blend_space_draw->connect_compat("gui_input", this, "_blend_space_gui_input"); + blend_space_draw->connect_compat("draw", this, "_blend_space_draw"); blend_space_draw->set_focus_mode(FOCUS_ALL); panel->add_child(blend_space_draw); @@ -724,10 +724,10 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { bottom_hb->add_child(max_value); } - snap_value->connect("value_changed", this, "_config_changed"); - min_value->connect("value_changed", this, "_config_changed"); - max_value->connect("value_changed", this, "_config_changed"); - label_value->connect("text_changed", this, "_labels_changed"); + snap_value->connect_compat("value_changed", this, "_config_changed"); + min_value->connect_compat("value_changed", this, "_config_changed"); + max_value->connect_compat("value_changed", this, "_config_changed"); + label_value->connect_compat("text_changed", this, "_labels_changed"); error_panel = memnew(PanelContainer); add_child(error_panel); @@ -740,18 +740,18 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { menu = memnew(PopupMenu); add_child(menu); - menu->connect("id_pressed", this, "_add_menu_type"); + menu->connect_compat("id_pressed", this, "_add_menu_type"); animations_menu = memnew(PopupMenu); menu->add_child(animations_menu); animations_menu->set_name("animations"); - animations_menu->connect("index_pressed", this, "_add_animation_type"); + animations_menu->connect_compat("index_pressed", this, "_add_animation_type"); open_file = memnew(EditorFileDialog); add_child(open_file); open_file->set_title(TTR("Open Animation Node")); open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE); - open_file->connect("file_selected", this, "_file_opened"); + open_file->connect_compat("file_selected", this, "_file_opened"); undo_redo = EditorNode::get_undo_redo(); selected_point = -1; diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index fdd8ffd58f..d2306a5d6b 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -55,12 +55,12 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_changed() { void AnimationNodeBlendSpace2DEditor::edit(const Ref<AnimationNode> &p_node) { if (blend_space.is_valid()) { - blend_space->disconnect("triangles_updated", this, "_blend_space_changed"); + blend_space->disconnect_compat("triangles_updated", this, "_blend_space_changed"); } blend_space = p_node; if (!blend_space.is_null()) { - blend_space->connect("triangles_updated", this, "_blend_space_changed"); + blend_space->connect_compat("triangles_updated", this, "_blend_space_changed"); _update_space(); } } @@ -870,42 +870,42 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { top_hb->add_child(tool_blend); tool_blend->set_pressed(true); tool_blend->set_tooltip(TTR("Set the blending position within the space")); - tool_blend->connect("pressed", this, "_tool_switch", varray(3)); + tool_blend->connect_compat("pressed", this, "_tool_switch", varray(3)); tool_select = memnew(ToolButton); tool_select->set_toggle_mode(true); tool_select->set_button_group(bg); top_hb->add_child(tool_select); tool_select->set_tooltip(TTR("Select and move points, create points with RMB.")); - tool_select->connect("pressed", this, "_tool_switch", varray(0)); + tool_select->connect_compat("pressed", this, "_tool_switch", varray(0)); tool_create = memnew(ToolButton); tool_create->set_toggle_mode(true); tool_create->set_button_group(bg); top_hb->add_child(tool_create); tool_create->set_tooltip(TTR("Create points.")); - tool_create->connect("pressed", this, "_tool_switch", varray(1)); + tool_create->connect_compat("pressed", this, "_tool_switch", varray(1)); tool_triangle = memnew(ToolButton); tool_triangle->set_toggle_mode(true); tool_triangle->set_button_group(bg); top_hb->add_child(tool_triangle); tool_triangle->set_tooltip(TTR("Create triangles by connecting points.")); - tool_triangle->connect("pressed", this, "_tool_switch", varray(2)); + tool_triangle->connect_compat("pressed", this, "_tool_switch", varray(2)); tool_erase_sep = memnew(VSeparator); top_hb->add_child(tool_erase_sep); tool_erase = memnew(ToolButton); top_hb->add_child(tool_erase); tool_erase->set_tooltip(TTR("Erase points and triangles.")); - tool_erase->connect("pressed", this, "_erase_selected"); + tool_erase->connect_compat("pressed", this, "_erase_selected"); tool_erase->set_disabled(true); top_hb->add_child(memnew(VSeparator)); auto_triangles = memnew(ToolButton); top_hb->add_child(auto_triangles); - auto_triangles->connect("pressed", this, "_auto_triangles_toggled"); + auto_triangles->connect_compat("pressed", this, "_auto_triangles_toggled"); auto_triangles->set_toggle_mode(true); auto_triangles->set_tooltip(TTR("Generate blend triangles automatically (instead of manually)")); @@ -916,7 +916,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { top_hb->add_child(snap); snap->set_pressed(true); snap->set_tooltip(TTR("Enable snap and show grid.")); - snap->connect("pressed", this, "_snap_toggled"); + snap->connect_compat("pressed", this, "_snap_toggled"); snap_x = memnew(SpinBox); top_hb->add_child(snap_x); @@ -937,7 +937,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { top_hb->add_child(memnew(Label(TTR("Blend:")))); interpolation = memnew(OptionButton); top_hb->add_child(interpolation); - interpolation->connect("item_selected", this, "_config_changed"); + interpolation->connect_compat("item_selected", this, "_config_changed"); edit_hb = memnew(HBoxContainer); top_hb->add_child(edit_hb); @@ -948,17 +948,17 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { edit_x->set_min(-1000); edit_x->set_step(0.01); edit_x->set_max(1000); - edit_x->connect("value_changed", this, "_edit_point_pos"); + edit_x->connect_compat("value_changed", this, "_edit_point_pos"); edit_y = memnew(SpinBox); edit_hb->add_child(edit_y); edit_y->set_min(-1000); edit_y->set_step(0.01); edit_y->set_max(1000); - edit_y->connect("value_changed", this, "_edit_point_pos"); + edit_y->connect_compat("value_changed", this, "_edit_point_pos"); open_editor = memnew(Button); edit_hb->add_child(open_editor); open_editor->set_text(TTR("Open Editor")); - open_editor->connect("pressed", this, "_open_editor", varray(), CONNECT_DEFERRED); + open_editor->connect_compat("pressed", this, "_open_editor", varray(), CONNECT_DEFERRED); edit_hb->hide(); open_editor->hide(); @@ -999,8 +999,8 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { panel->set_h_size_flags(SIZE_EXPAND_FILL); blend_space_draw = memnew(Control); - blend_space_draw->connect("gui_input", this, "_blend_space_gui_input"); - blend_space_draw->connect("draw", this, "_blend_space_draw"); + blend_space_draw->connect_compat("gui_input", this, "_blend_space_gui_input"); + blend_space_draw->connect_compat("draw", this, "_blend_space_draw"); blend_space_draw->set_focus_mode(FOCUS_ALL); panel->add_child(blend_space_draw); @@ -1029,14 +1029,14 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { min_x_value->set_step(0.01); } - snap_x->connect("value_changed", this, "_config_changed"); - snap_y->connect("value_changed", this, "_config_changed"); - max_x_value->connect("value_changed", this, "_config_changed"); - min_x_value->connect("value_changed", this, "_config_changed"); - max_y_value->connect("value_changed", this, "_config_changed"); - min_y_value->connect("value_changed", this, "_config_changed"); - label_x->connect("text_changed", this, "_labels_changed"); - label_y->connect("text_changed", this, "_labels_changed"); + snap_x->connect_compat("value_changed", this, "_config_changed"); + snap_y->connect_compat("value_changed", this, "_config_changed"); + max_x_value->connect_compat("value_changed", this, "_config_changed"); + min_x_value->connect_compat("value_changed", this, "_config_changed"); + max_y_value->connect_compat("value_changed", this, "_config_changed"); + min_y_value->connect_compat("value_changed", this, "_config_changed"); + label_x->connect_compat("text_changed", this, "_labels_changed"); + label_y->connect_compat("text_changed", this, "_labels_changed"); error_panel = memnew(PanelContainer); add_child(error_panel); @@ -1050,18 +1050,18 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { menu = memnew(PopupMenu); add_child(menu); - menu->connect("id_pressed", this, "_add_menu_type"); + menu->connect_compat("id_pressed", this, "_add_menu_type"); animations_menu = memnew(PopupMenu); menu->add_child(animations_menu); animations_menu->set_name("animations"); - animations_menu->connect("index_pressed", this, "_add_animation_type"); + animations_menu->connect_compat("index_pressed", this, "_add_animation_type"); open_file = memnew(EditorFileDialog); add_child(open_file); open_file->set_title(TTR("Open Animation Node")); open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE); - open_file->connect("file_selected", this, "_file_opened"); + open_file->connect_compat("file_selected", this, "_file_opened"); undo_redo = EditorNode::get_undo_redo(); selected_point = -1; diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index a100525d10..f2daa809b4 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -146,11 +146,11 @@ void AnimationNodeBlendTreeEditor::_update_graph() { name->set_expand_to_text_length(true); node->add_child(name); node->set_slot(0, false, 0, Color(), true, 0, get_color("font_color", "Label")); - name->connect("text_entered", this, "_node_renamed", varray(agnode)); - name->connect("focus_exited", this, "_node_renamed_focus_out", varray(name, agnode), CONNECT_DEFERRED); + name->connect_compat("text_entered", this, "_node_renamed", varray(agnode)); + name->connect_compat("focus_exited", this, "_node_renamed_focus_out", varray(name, agnode), CONNECT_DEFERRED); base = 1; node->set_show_close_button(true); - node->connect("close_request", this, "_delete_request", varray(E->get()), CONNECT_DEFERRED); + node->connect_compat("close_request", this, "_delete_request", varray(E->get()), CONNECT_DEFERRED); } for (int i = 0; i < agnode->get_input_count(); i++) { @@ -173,13 +173,13 @@ void AnimationNodeBlendTreeEditor::_update_graph() { prop->set_object_and_property(AnimationTreeEditor::get_singleton()->get_tree(), base_path); prop->update_property(); prop->set_name_split_ratio(0); - prop->connect("property_changed", this, "_property_changed"); + prop->connect_compat("property_changed", this, "_property_changed"); node->add_child(prop); visible_properties.push_back(prop); } } - node->connect("dragged", this, "_node_dragged", varray(E->get())); + node->connect_compat("dragged", this, "_node_dragged", varray(E->get())); if (AnimationTreeEditor::get_singleton()->can_edit(agnode)) { node->add_child(memnew(HSeparator)); @@ -187,7 +187,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() { open_in_editor->set_text(TTR("Open Editor")); open_in_editor->set_icon(get_icon("Edit", "EditorIcons")); node->add_child(open_in_editor); - open_in_editor->connect("pressed", this, "_open_in_editor", varray(E->get()), CONNECT_DEFERRED); + open_in_editor->connect_compat("pressed", this, "_open_in_editor", varray(E->get()), CONNECT_DEFERRED); open_in_editor->set_h_size_flags(SIZE_SHRINK_CENTER); } @@ -198,7 +198,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() { edit_filters->set_text(TTR("Edit Filters")); edit_filters->set_icon(get_icon("AnimationFilter", "EditorIcons")); node->add_child(edit_filters); - edit_filters->connect("pressed", this, "_edit_filters", varray(E->get()), CONNECT_DEFERRED); + edit_filters->connect_compat("pressed", this, "_edit_filters", varray(E->get()), CONNECT_DEFERRED); edit_filters->set_h_size_flags(SIZE_SHRINK_CENTER); } @@ -238,7 +238,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() { animations[E->get()] = pb; node->add_child(pb); - mb->get_popup()->connect("index_pressed", this, "_anim_selected", varray(options, E->get()), CONNECT_DEFERRED); + mb->get_popup()->connect_compat("index_pressed", this, "_anim_selected", varray(options, E->get()), CONNECT_DEFERRED); } if (EditorSettings::get_singleton()->get("interface/theme/use_graph_node_headers")) { @@ -911,7 +911,7 @@ bool AnimationNodeBlendTreeEditor::can_edit(const Ref<AnimationNode> &p_node) { void AnimationNodeBlendTreeEditor::edit(const Ref<AnimationNode> &p_node) { if (blend_tree.is_valid()) { - blend_tree->disconnect("removed_from_graph", this, "_removed_from_graph"); + blend_tree->disconnect_compat("removed_from_graph", this, "_removed_from_graph"); } blend_tree = p_node; @@ -919,7 +919,7 @@ void AnimationNodeBlendTreeEditor::edit(const Ref<AnimationNode> &p_node) { if (blend_tree.is_null()) { hide(); } else { - blend_tree->connect("removed_from_graph", this, "_removed_from_graph"); + blend_tree->connect_compat("removed_from_graph", this, "_removed_from_graph"); _update_graph(); } @@ -936,12 +936,12 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() { graph->add_valid_right_disconnect_type(0); graph->add_valid_left_disconnect_type(0); graph->set_v_size_flags(SIZE_EXPAND_FILL); - graph->connect("connection_request", this, "_connection_request", varray(), CONNECT_DEFERRED); - graph->connect("disconnection_request", this, "_disconnection_request", varray(), CONNECT_DEFERRED); - graph->connect("node_selected", this, "_node_selected"); - graph->connect("scroll_offset_changed", this, "_scroll_changed"); - graph->connect("delete_nodes_request", this, "_delete_nodes_request"); - graph->connect("popup_request", this, "_popup_request"); + graph->connect_compat("connection_request", this, "_connection_request", varray(), CONNECT_DEFERRED); + graph->connect_compat("disconnection_request", this, "_disconnection_request", varray(), CONNECT_DEFERRED); + graph->connect_compat("node_selected", this, "_node_selected"); + graph->connect_compat("scroll_offset_changed", this, "_scroll_changed"); + graph->connect_compat("delete_nodes_request", this, "_delete_nodes_request"); + graph->connect_compat("popup_request", this, "_popup_request"); VSeparator *vs = memnew(VSeparator); graph->get_zoom_hbox()->add_child(vs); @@ -951,8 +951,8 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() { graph->get_zoom_hbox()->add_child(add_node); add_node->set_text(TTR("Add Node...")); graph->get_zoom_hbox()->move_child(add_node, 0); - add_node->get_popup()->connect("id_pressed", this, "_add_node"); - add_node->connect("about_to_show", this, "_update_options_menu"); + add_node->get_popup()->connect_compat("id_pressed", this, "_add_node"); + add_node->connect_compat("about_to_show", this, "_update_options_menu"); add_options.push_back(AddOption("Animation", "AnimationNodeAnimation")); add_options.push_back(AddOption("OneShot", "AnimationNodeOneShot")); @@ -984,19 +984,19 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() { filter_enabled = memnew(CheckBox); filter_enabled->set_text(TTR("Enable Filtering")); - filter_enabled->connect("pressed", this, "_filter_toggled"); + filter_enabled->connect_compat("pressed", this, "_filter_toggled"); filter_vbox->add_child(filter_enabled); filters = memnew(Tree); filter_vbox->add_child(filters); filters->set_v_size_flags(SIZE_EXPAND_FILL); filters->set_hide_root(true); - filters->connect("item_edited", this, "_filter_edited"); + filters->connect_compat("item_edited", this, "_filter_edited"); open_file = memnew(EditorFileDialog); add_child(open_file); open_file->set_title(TTR("Open Animation Node")); open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE); - open_file->connect("file_selected", this, "_file_opened"); + open_file->connect_compat("file_selected", this, "_file_opened"); undo_redo = EditorNode::get_undo_redo(); } diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index d8bbac9c49..26c3c21d61 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -99,13 +99,13 @@ void AnimationPlayerEditor::_notification(int p_what) { } break; case NOTIFICATION_ENTER_TREE: { - tool_anim->get_popup()->connect("id_pressed", this, "_animation_tool_menu"); + tool_anim->get_popup()->connect_compat("id_pressed", this, "_animation_tool_menu"); - onion_skinning->get_popup()->connect("id_pressed", this, "_onion_skinning_menu"); + onion_skinning->get_popup()->connect_compat("id_pressed", this, "_onion_skinning_menu"); - blend_editor.next->connect("item_selected", this, "_blend_editor_next_changed"); + blend_editor.next->connect_compat("item_selected", this, "_blend_editor_next_changed"); - get_tree()->connect("node_removed", this, "_node_removed"); + get_tree()->connect_compat("node_removed", this, "_node_removed"); add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel")); } break; @@ -1504,16 +1504,16 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() { void AnimationPlayerEditor::_start_onion_skinning() { // FIXME: Using "idle_frame" makes onion layers update one frame behind the current. - if (!get_tree()->is_connected("idle_frame", this, "call_deferred")) { - get_tree()->connect("idle_frame", this, "call_deferred", varray("_prepare_onion_layers_1")); + if (!get_tree()->is_connected_compat("idle_frame", this, "call_deferred")) { + get_tree()->connect_compat("idle_frame", this, "call_deferred", varray("_prepare_onion_layers_1")); } } void AnimationPlayerEditor::_stop_onion_skinning() { - if (get_tree()->is_connected("idle_frame", this, "call_deferred")) { + if (get_tree()->is_connected_compat("idle_frame", this, "call_deferred")) { - get_tree()->disconnect("idle_frame", this, "call_deferred"); + get_tree()->disconnect_compat("idle_frame", this, "call_deferred"); _free_onion_layers(); @@ -1630,11 +1630,11 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay accept = memnew(AcceptDialog); add_child(accept); - accept->connect("confirmed", this, "_menu_confirm_current"); + accept->connect_compat("confirmed", this, "_menu_confirm_current"); delete_dialog = memnew(ConfirmationDialog); add_child(delete_dialog); - delete_dialog->connect("confirmed", this, "_animation_remove_confirmed"); + delete_dialog->connect_compat("confirmed", this, "_animation_remove_confirmed"); tool_anim = memnew(MenuButton); tool_anim->set_flat(false); @@ -1679,7 +1679,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay onion_toggle = memnew(ToolButton); onion_toggle->set_toggle_mode(true); onion_toggle->set_tooltip(TTR("Enable Onion Skinning")); - onion_toggle->connect("pressed", this, "_onion_skinning_menu", varray(ONION_SKINNING_ENABLE)); + onion_toggle->connect_compat("pressed", this, "_onion_skinning_menu", varray(ONION_SKINNING_ENABLE)); hb->add_child(onion_toggle); onion_skinning = memnew(MenuButton); @@ -1705,7 +1705,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay pin->set_toggle_mode(true); pin->set_tooltip(TTR("Pin AnimationPlayer")); hb->add_child(pin); - pin->connect("pressed", this, "_pin_pressed"); + pin->connect_compat("pressed", this, "_pin_pressed"); file = memnew(EditorFileDialog); add_child(file); @@ -1729,7 +1729,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay error_dialog->set_title(TTR("Error!")); add_child(error_dialog); - name_dialog->connect("confirmed", this, "_animation_name_edited"); + name_dialog->connect_compat("confirmed", this, "_animation_name_edited"); blend_editor.dialog = memnew(AcceptDialog); add_child(blend_editor.dialog); @@ -1745,21 +1745,21 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay blend_editor.dialog->set_title(TTR("Cross-Animation Blend Times")); updating_blends = false; - blend_editor.tree->connect("item_edited", this, "_blend_edited"); + blend_editor.tree->connect_compat("item_edited", this, "_blend_edited"); - autoplay->connect("pressed", this, "_autoplay_pressed"); + autoplay->connect_compat("pressed", this, "_autoplay_pressed"); autoplay->set_toggle_mode(true); - play->connect("pressed", this, "_play_pressed"); - play_from->connect("pressed", this, "_play_from_pressed"); - play_bw->connect("pressed", this, "_play_bw_pressed"); - play_bw_from->connect("pressed", this, "_play_bw_from_pressed"); - stop->connect("pressed", this, "_stop_pressed"); + play->connect_compat("pressed", this, "_play_pressed"); + play_from->connect_compat("pressed", this, "_play_from_pressed"); + play_bw->connect_compat("pressed", this, "_play_bw_pressed"); + play_bw_from->connect_compat("pressed", this, "_play_bw_from_pressed"); + stop->connect_compat("pressed", this, "_stop_pressed"); - animation->connect("item_selected", this, "_animation_selected", Vector<Variant>(), true); + animation->connect_compat("item_selected", this, "_animation_selected", Vector<Variant>(), true); - file->connect("file_selected", this, "_dialog_action"); - frame->connect("value_changed", this, "_seek_value_changed", Vector<Variant>(), true); - scale->connect("text_entered", this, "_scale_changed", Vector<Variant>(), true); + file->connect_compat("file_selected", this, "_dialog_action"); + frame->connect_compat("value_changed", this, "_seek_value_changed", Vector<Variant>(), true); + scale->connect_compat("text_entered", this, "_scale_changed", Vector<Variant>(), true); renaming = false; last_active = false; @@ -1769,14 +1769,14 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay add_child(track_editor); track_editor->set_v_size_flags(SIZE_EXPAND_FILL); - track_editor->connect("timeline_changed", this, "_animation_key_editor_seek"); - track_editor->connect("animation_len_changed", this, "_animation_key_editor_anim_len_changed"); + track_editor->connect_compat("timeline_changed", this, "_animation_key_editor_seek"); + track_editor->connect_compat("animation_len_changed", this, "_animation_key_editor_anim_len_changed"); _update_player(); // Onion skinning. - track_editor->connect("visibility_changed", this, "_editor_visibility_changed"); + track_editor->connect_compat("visibility_changed", this, "_editor_visibility_changed"); onion.enabled = false; onion.past = true; diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index 035a67b821..6f29aba356 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -1276,21 +1276,21 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { tool_select->set_button_group(bg); tool_select->set_pressed(true); tool_select->set_tooltip(TTR("Select and move nodes.\nRMB to add new nodes.\nShift+LMB to create connections.")); - tool_select->connect("pressed", this, "_update_mode", varray(), CONNECT_DEFERRED); + tool_select->connect_compat("pressed", this, "_update_mode", varray(), CONNECT_DEFERRED); tool_create = memnew(ToolButton); top_hb->add_child(tool_create); tool_create->set_toggle_mode(true); tool_create->set_button_group(bg); tool_create->set_tooltip(TTR("Create new nodes.")); - tool_create->connect("pressed", this, "_update_mode", varray(), CONNECT_DEFERRED); + tool_create->connect_compat("pressed", this, "_update_mode", varray(), CONNECT_DEFERRED); tool_connect = memnew(ToolButton); top_hb->add_child(tool_connect); tool_connect->set_toggle_mode(true); tool_connect->set_button_group(bg); tool_connect->set_tooltip(TTR("Connect nodes.")); - tool_connect->connect("pressed", this, "_update_mode", varray(), CONNECT_DEFERRED); + tool_connect->connect_compat("pressed", this, "_update_mode", varray(), CONNECT_DEFERRED); tool_erase_hb = memnew(HBoxContainer); top_hb->add_child(tool_erase_hb); @@ -1298,7 +1298,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { tool_erase = memnew(ToolButton); tool_erase->set_tooltip(TTR("Remove selected node or transition.")); tool_erase_hb->add_child(tool_erase); - tool_erase->connect("pressed", this, "_erase_selected"); + tool_erase->connect_compat("pressed", this, "_erase_selected"); tool_erase->set_disabled(true); tool_erase_hb->add_child(memnew(VSeparator)); @@ -1306,13 +1306,13 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { tool_autoplay = memnew(ToolButton); tool_autoplay->set_tooltip(TTR("Toggle autoplay this animation on start, restart or seek to zero.")); tool_erase_hb->add_child(tool_autoplay); - tool_autoplay->connect("pressed", this, "_autoplay_selected"); + tool_autoplay->connect_compat("pressed", this, "_autoplay_selected"); tool_autoplay->set_disabled(true); tool_end = memnew(ToolButton); tool_end->set_tooltip(TTR("Set the end animation. This is useful for sub-transitions.")); tool_erase_hb->add_child(tool_end); - tool_end->connect("pressed", this, "_end_selected"); + tool_end->connect_compat("pressed", this, "_end_selected"); tool_end->set_disabled(true); top_hb->add_child(memnew(VSeparator)); @@ -1333,26 +1333,26 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { state_machine_draw = memnew(Control); panel->add_child(state_machine_draw); - state_machine_draw->connect("gui_input", this, "_state_machine_gui_input"); - state_machine_draw->connect("draw", this, "_state_machine_draw"); + state_machine_draw->connect_compat("gui_input", this, "_state_machine_gui_input"); + state_machine_draw->connect_compat("draw", this, "_state_machine_draw"); state_machine_draw->set_focus_mode(FOCUS_ALL); state_machine_play_pos = memnew(Control); state_machine_draw->add_child(state_machine_play_pos); state_machine_play_pos->set_mouse_filter(MOUSE_FILTER_PASS); //pass all to parent state_machine_play_pos->set_anchors_and_margins_preset(PRESET_WIDE); - state_machine_play_pos->connect("draw", this, "_state_machine_pos_draw"); + state_machine_play_pos->connect_compat("draw", this, "_state_machine_pos_draw"); v_scroll = memnew(VScrollBar); state_machine_draw->add_child(v_scroll); v_scroll->set_anchors_and_margins_preset(PRESET_RIGHT_WIDE); - v_scroll->connect("value_changed", this, "_scroll_changed"); + v_scroll->connect_compat("value_changed", this, "_scroll_changed"); h_scroll = memnew(HScrollBar); state_machine_draw->add_child(h_scroll); h_scroll->set_anchors_and_margins_preset(PRESET_BOTTOM_WIDE); h_scroll->set_margin(MARGIN_RIGHT, -v_scroll->get_size().x * EDSCALE); - h_scroll->connect("value_changed", this, "_scroll_changed"); + h_scroll->connect_compat("value_changed", this, "_scroll_changed"); error_panel = memnew(PanelContainer); add_child(error_panel); @@ -1366,25 +1366,25 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { menu = memnew(PopupMenu); add_child(menu); - menu->connect("id_pressed", this, "_add_menu_type"); + menu->connect_compat("id_pressed", this, "_add_menu_type"); animations_menu = memnew(PopupMenu); menu->add_child(animations_menu); animations_menu->set_name("animations"); - animations_menu->connect("index_pressed", this, "_add_animation_type"); + animations_menu->connect_compat("index_pressed", this, "_add_animation_type"); name_edit = memnew(LineEdit); state_machine_draw->add_child(name_edit); name_edit->hide(); - name_edit->connect("text_entered", this, "_name_edited"); - name_edit->connect("focus_exited", this, "_name_edited_focus_out"); + name_edit->connect_compat("text_entered", this, "_name_edited"); + name_edit->connect_compat("focus_exited", this, "_name_edited_focus_out"); name_edit->set_as_toplevel(true); open_file = memnew(EditorFileDialog); add_child(open_file); open_file->set_title(TTR("Open Animation Node")); open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE); - open_file->connect("file_selected", this, "_file_opened"); + open_file->connect_compat("file_selected", this, "_file_opened"); undo_redo = EditorNode::get_undo_redo(); over_text = false; diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp index a729c90160..8900882725 100644 --- a/editor/plugins/animation_tree_editor_plugin.cpp +++ b/editor/plugins/animation_tree_editor_plugin.cpp @@ -85,7 +85,7 @@ void AnimationTreeEditor::_update_path() { b->set_button_group(group); b->set_pressed(true); b->set_focus_mode(FOCUS_NONE); - b->connect("pressed", this, "_path_button_pressed", varray(-1)); + b->connect_compat("pressed", this, "_path_button_pressed", varray(-1)); path_hb->add_child(b); for (int i = 0; i < button_path.size(); i++) { b = memnew(Button); @@ -95,7 +95,7 @@ void AnimationTreeEditor::_update_path() { path_hb->add_child(b); b->set_pressed(true); b->set_focus_mode(FOCUS_NONE); - b->connect("pressed", this, "_path_button_pressed", varray(i)); + b->connect_compat("pressed", this, "_path_button_pressed", varray(i)); } } diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 3d47dd46db..01c3c33995 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -112,7 +112,7 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() { icon = memnew(TextureButton); icon->set_custom_minimum_size(Size2(64, 64) * EDSCALE); icon->set_default_cursor_shape(CURSOR_POINTING_HAND); - icon->connect("pressed", this, "_asset_clicked"); + icon->connect_compat("pressed", this, "_asset_clicked"); hb->add_child(icon); @@ -123,17 +123,17 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() { title = memnew(LinkButton); title->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER); - title->connect("pressed", this, "_asset_clicked"); + title->connect_compat("pressed", this, "_asset_clicked"); vb->add_child(title); category = memnew(LinkButton); category->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER); - category->connect("pressed", this, "_category_clicked"); + category->connect_compat("pressed", this, "_category_clicked"); vb->add_child(category); author = memnew(LinkButton); author->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER); - author->connect("pressed", this, "_author_clicked"); + author->connect_compat("pressed", this, "_author_clicked"); vb->add_child(author); price = memnew(Label); @@ -263,7 +263,7 @@ void EditorAssetLibraryItemDescription::add_preview(int p_id, bool p_video, cons preview.button->set_flat(true); preview.button->set_icon(get_icon("ThumbnailWait", "EditorIcons")); preview.button->set_toggle_mode(true); - preview.button->connect("pressed", this, "_preview_click", varray(p_id)); + preview.button->connect_compat("pressed", this, "_preview_click", varray(p_id)); preview_hb->add_child(preview.button); if (!p_video) { preview.image = get_icon("ThumbnailWait", "EditorIcons"); @@ -290,7 +290,7 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() { description = memnew(RichTextLabel); desc_vbox->add_child(description); description->set_v_size_flags(SIZE_EXPAND_FILL); - description->connect("meta_clicked", this, "_link_click"); + description->connect_compat("meta_clicked", this, "_link_click"); description->add_constant_override("line_separation", Math::round(5 * EDSCALE)); VBoxContainer *previews_vbox = memnew(VBoxContainer); @@ -526,7 +526,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { title->set_h_size_flags(SIZE_EXPAND_FILL); dismiss = memnew(TextureButton); - dismiss->connect("pressed", this, "_close"); + dismiss->connect_compat("pressed", this, "_close"); title_hb->add_child(dismiss); title->set_clip_text(true); @@ -546,11 +546,11 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { install = memnew(Button); install->set_text(TTR("Install...")); install->set_disabled(true); - install->connect("pressed", this, "_install"); + install->connect_compat("pressed", this, "_install"); retry = memnew(Button); retry->set_text(TTR("Retry")); - retry->connect("pressed", this, "_make_request"); + retry->connect_compat("pressed", this, "_make_request"); hb2->add_child(retry); hb2->add_child(install); @@ -558,7 +558,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { download = memnew(HTTPRequest); add_child(download); - download->connect("request_completed", this, "_http_download_completed"); + download->connect_compat("request_completed", this, "_http_download_completed"); download->set_use_threads(EDITOR_DEF("asset_library/use_threads", true)); download_error = memnew(AcceptDialog); @@ -567,7 +567,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { asset_installer = memnew(EditorAssetInstaller); add_child(asset_installer); - asset_installer->connect("confirmed", this, "_close"); + asset_installer->connect_compat("confirmed", this, "_close"); prev_status = -1; @@ -657,7 +657,7 @@ void EditorAssetLibrary::_install_asset() { if (templates_only) { download->set_external_install(true); - download->connect("install_asset", this, "_install_external_asset"); + download->connect_compat("install_asset", this, "_install_external_asset"); } } @@ -892,7 +892,7 @@ void EditorAssetLibrary::_request_image(ObjectID p_for, String p_image_url, Imag iq.queue_id = ++last_queue_id; iq.active = false; - iq.request->connect("request_completed", this, "_image_request_completed", varray(iq.queue_id)); + iq.request->connect_compat("request_completed", this, "_image_request_completed", varray(iq.queue_id)); image_queue[iq.queue_id] = iq; @@ -991,7 +991,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int Button *first = memnew(Button); first->set_text(TTR("First")); if (p_page != 0) { - first->connect("pressed", this, "_search", varray(0)); + first->connect_compat("pressed", this, "_search", varray(0)); } else { first->set_disabled(true); first->set_focus_mode(Control::FOCUS_NONE); @@ -1001,7 +1001,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int Button *prev = memnew(Button); prev->set_text(TTR("Previous")); if (p_page > 0) { - prev->connect("pressed", this, "_search", varray(p_page - 1)); + prev->connect_compat("pressed", this, "_search", varray(p_page - 1)); } else { prev->set_disabled(true); prev->set_focus_mode(Control::FOCUS_NONE); @@ -1023,7 +1023,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int Button *current = memnew(Button); current->set_text(itos(i + 1)); - current->connect("pressed", this, "_search", varray(i)); + current->connect_compat("pressed", this, "_search", varray(i)); hbc->add_child(current); } @@ -1032,7 +1032,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int Button *next = memnew(Button); next->set_text(TTR("Next")); if (p_page < p_page_count - 1) { - next->connect("pressed", this, "_search", varray(p_page + 1)); + next->connect_compat("pressed", this, "_search", varray(p_page + 1)); } else { next->set_disabled(true); next->set_focus_mode(Control::FOCUS_NONE); @@ -1043,7 +1043,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int Button *last = memnew(Button); last->set_text(TTR("Last")); if (p_page != p_page_count - 1) { - last->connect("pressed", this, "_search", varray(p_page_count - 1)); + last->connect_compat("pressed", this, "_search", varray(p_page_count - 1)); } else { last->set_disabled(true); last->set_focus_mode(Control::FOCUS_NONE); @@ -1229,9 +1229,9 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const EditorAssetLibraryItem *item = memnew(EditorAssetLibraryItem); asset_items->add_child(item); item->configure(r["title"], r["asset_id"], category_map[r["category_id"]], r["category_id"], r["author"], r["author_id"], r["cost"]); - item->connect("asset_selected", this, "_select_asset"); - item->connect("author_selected", this, "_select_author"); - item->connect("category_selected", this, "_select_category"); + item->connect_compat("asset_selected", this, "_select_asset"); + item->connect_compat("author_selected", this, "_select_author"); + item->connect_compat("category_selected", this, "_select_category"); if (r.has("icon_url") && r["icon_url"] != "") { _request_image(item->get_instance_id(), r["icon_url"], IMAGE_QUEUE_ICON, 0); @@ -1262,7 +1262,7 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const description = memnew(EditorAssetLibraryItemDescription); add_child(description); description->popup_centered_minsize(); - description->connect("confirmed", this, "_install_asset"); + description->connect_compat("confirmed", this, "_install_asset"); description->configure(r["title"], r["asset_id"], category_map[r["category_id"]], r["category_id"], r["author"], r["author_id"], r["cost"], r["version"], r["version_string"], r["description"], r["download_url"], r["browse_url"], r["download_hash"]); @@ -1374,9 +1374,9 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { filter = memnew(LineEdit); search_hb->add_child(filter); filter->set_h_size_flags(SIZE_EXPAND_FILL); - filter->connect("text_entered", this, "_search_text_entered"); + filter->connect_compat("text_entered", this, "_search_text_entered"); search = memnew(Button(TTR("Search"))); - search->connect("pressed", this, "_search"); + search->connect_compat("pressed", this, "_search"); search_hb->add_child(search); if (!p_templates_only) @@ -1385,12 +1385,12 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { Button *open_asset = memnew(Button); open_asset->set_text(TTR("Import...")); search_hb->add_child(open_asset); - open_asset->connect("pressed", this, "_asset_open"); + open_asset->connect_compat("pressed", this, "_asset_open"); Button *plugins = memnew(Button); plugins->set_text(TTR("Plugins...")); search_hb->add_child(plugins); - plugins->connect("pressed", this, "_manage_plugins"); + plugins->connect_compat("pressed", this, "_manage_plugins"); if (p_templates_only) { open_asset->hide(); @@ -1409,7 +1409,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { search_hb2->add_child(sort); sort->set_h_size_flags(SIZE_EXPAND_FILL); - sort->connect("item_selected", this, "_rerun_search"); + sort->connect_compat("item_selected", this, "_rerun_search"); search_hb2->add_child(memnew(VSeparator)); @@ -1418,7 +1418,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { categories->add_item(TTR("All")); search_hb2->add_child(categories); categories->set_h_size_flags(SIZE_EXPAND_FILL); - categories->connect("item_selected", this, "_rerun_search"); + categories->connect_compat("item_selected", this, "_rerun_search"); search_hb2->add_child(memnew(VSeparator)); @@ -1430,7 +1430,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { repository->add_item("localhost"); repository->set_item_metadata(1, "http://127.0.0.1/asset-library/api"); - repository->connect("item_selected", this, "_repository_changed"); + repository->connect_compat("item_selected", this, "_repository_changed"); search_hb2->add_child(repository); repository->set_h_size_flags(SIZE_EXPAND_FILL); @@ -1445,7 +1445,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { support->get_popup()->add_check_item(TTR("Testing"), SUPPORT_TESTING); support->get_popup()->set_item_checked(SUPPORT_OFFICIAL, true); support->get_popup()->set_item_checked(SUPPORT_COMMUNITY, true); - support->get_popup()->connect("id_pressed", this, "_support_toggled"); + support->get_popup()->connect_compat("id_pressed", this, "_support_toggled"); ///////// @@ -1501,7 +1501,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { request = memnew(HTTPRequest); add_child(request); request->set_use_threads(EDITOR_DEF("asset_library/use_threads", true)); - request->connect("request_completed", this, "_http_request_completed"); + request->connect_compat("request_completed", this, "_http_request_completed"); last_queue_id = 0; @@ -1534,7 +1534,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { asset_open->add_filter("*.zip ; " + TTR("Assets ZIP File")); asset_open->set_mode(EditorFileDialog::MODE_OPEN_FILE); add_child(asset_open); - asset_open->connect("file_selected", this, "_asset_file_selected"); + asset_open->connect_compat("file_selected", this, "_asset_file_selected"); asset_installer = NULL; } diff --git a/editor/plugins/audio_stream_editor_plugin.cpp b/editor/plugins/audio_stream_editor_plugin.cpp index 60cb2ff54d..e4a9c38a99 100644 --- a/editor/plugins/audio_stream_editor_plugin.cpp +++ b/editor/plugins/audio_stream_editor_plugin.cpp @@ -39,7 +39,7 @@ void AudioStreamEditor::_notification(int p_what) { if (p_what == NOTIFICATION_READY) { - AudioStreamPreviewGenerator::get_singleton()->connect("preview_updated", this, "_preview_changed"); + AudioStreamPreviewGenerator::get_singleton()->connect_compat("preview_updated", this, "_preview_changed"); } if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) { @@ -214,7 +214,7 @@ AudioStreamEditor::AudioStreamEditor() { _dragging = false; _player = memnew(AudioStreamPlayer); - _player->connect("finished", this, "_on_finished"); + _player->connect_compat("finished", this, "_on_finished"); add_child(_player); VBoxContainer *vbox = memnew(VBoxContainer); @@ -223,13 +223,13 @@ AudioStreamEditor::AudioStreamEditor() { _preview = memnew(ColorRect); _preview->set_v_size_flags(SIZE_EXPAND_FILL); - _preview->connect("draw", this, "_draw_preview"); + _preview->connect_compat("draw", this, "_draw_preview"); vbox->add_child(_preview); _indicator = memnew(Control); _indicator->set_anchors_and_margins_preset(PRESET_WIDE); - _indicator->connect("draw", this, "_draw_indicator"); - _indicator->connect("gui_input", this, "_on_input_indicator"); + _indicator->connect_compat("draw", this, "_draw_indicator"); + _indicator->connect_compat("gui_input", this, "_on_input_indicator"); _preview->add_child(_indicator); HBoxContainer *hbox = memnew(HBoxContainer); @@ -239,12 +239,12 @@ AudioStreamEditor::AudioStreamEditor() { _play_button = memnew(ToolButton); hbox->add_child(_play_button); _play_button->set_focus_mode(Control::FOCUS_NONE); - _play_button->connect("pressed", this, "_play"); + _play_button->connect_compat("pressed", this, "_play"); _stop_button = memnew(ToolButton); hbox->add_child(_stop_button); _stop_button->set_focus_mode(Control::FOCUS_NONE); - _stop_button->connect("pressed", this, "_stop"); + _stop_button->connect_compat("pressed", this, "_stop"); _current_label = memnew(Label); _current_label->set_align(Label::ALIGN_RIGHT); diff --git a/editor/plugins/camera_editor_plugin.cpp b/editor/plugins/camera_editor_plugin.cpp index 6f5bc69bd1..0440785eaf 100644 --- a/editor/plugins/camera_editor_plugin.cpp +++ b/editor/plugins/camera_editor_plugin.cpp @@ -81,7 +81,7 @@ CameraEditor::CameraEditor() { preview->set_margin(MARGIN_RIGHT, 0); preview->set_margin(MARGIN_TOP, 0); preview->set_margin(MARGIN_BOTTOM, 10); - preview->connect("pressed", this, "_pressed"); + preview->connect_compat("pressed", this, "_pressed"); } void CameraEditorPlugin::edit(Object *p_object) { diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index c5f6a88783..b91b346089 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -3891,10 +3891,10 @@ void CanvasItemEditor::_notification(int p_what) { select_sb->set_default_margin(Margin(i), 4); } - AnimationPlayerEditor::singleton->get_track_editor()->connect("visibility_changed", this, "_keying_changed"); + AnimationPlayerEditor::singleton->get_track_editor()->connect_compat("visibility_changed", this, "_keying_changed"); _keying_changed(); - get_tree()->connect("node_added", this, "_tree_changed", varray()); - get_tree()->connect("node_removed", this, "_tree_changed", varray()); + get_tree()->connect_compat("node_added", this, "_tree_changed", varray()); + get_tree()->connect_compat("node_removed", this, "_tree_changed", varray()); } else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { @@ -3902,8 +3902,8 @@ void CanvasItemEditor::_notification(int p_what) { } if (p_what == NOTIFICATION_EXIT_TREE) { - get_tree()->disconnect("node_added", this, "_tree_changed"); - get_tree()->disconnect("node_removed", this, "_tree_changed"); + get_tree()->disconnect_compat("node_added", this, "_tree_changed"); + get_tree()->disconnect_compat("node_removed", this, "_tree_changed"); } if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { @@ -4181,7 +4181,7 @@ void CanvasItemEditor::_popup_warning_temporarily(Control *p_control, const floa Timer *timer; if (!popup_temporarily_timers.has(p_control)) { timer = memnew(Timer); - timer->connect("timeout", this, "_popup_warning_depop", varray(p_control)); + timer->connect_compat("timeout", this, "_popup_warning_depop", varray(p_control)); timer->set_one_shot(true); add_child(timer); @@ -5410,11 +5410,11 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { editor = p_editor; editor_selection = p_editor->get_editor_selection(); editor_selection->add_editor_plugin(this); - editor_selection->connect("selection_changed", this, "update"); - editor_selection->connect("selection_changed", this, "_selection_changed"); + editor_selection->connect_compat("selection_changed", this, "update"); + editor_selection->connect_compat("selection_changed", this, "_selection_changed"); - editor->call_deferred("connect", make_binds("play_pressed", this, "_update_override_camera_button", true)); - editor->call_deferred("connect", make_binds("stop_pressed", this, "_update_override_camera_button", false)); + editor->call_deferred("connect", make_binds("play_pressed", Callable(this, "_update_override_camera_button"), true)); + editor->call_deferred("connect", make_binds("stop_pressed", Callable(this, "_update_override_camera_button"), false)); hb = memnew(HBoxContainer); add_child(hb); @@ -5434,7 +5434,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { viewport_scrollable->set_clip_contents(true); viewport_scrollable->set_v_size_flags(SIZE_EXPAND_FILL); viewport_scrollable->set_h_size_flags(SIZE_EXPAND_FILL); - viewport_scrollable->connect("draw", this, "_update_scrollbars"); + viewport_scrollable->connect_compat("draw", this, "_update_scrollbars"); ViewportContainer *scene_tree = memnew(ViewportContainer); viewport_scrollable->add_child(scene_tree); @@ -5456,8 +5456,8 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { viewport->set_anchors_and_margins_preset(Control::PRESET_WIDE); viewport->set_clip_contents(true); viewport->set_focus_mode(FOCUS_ALL); - viewport->connect("draw", this, "_draw_viewport"); - viewport->connect("gui_input", this, "_gui_input_viewport"); + viewport->connect_compat("draw", this, "_draw_viewport"); + viewport->connect_compat("gui_input", this, "_gui_input_viewport"); info_overlay = memnew(VBoxContainer); info_overlay->set_anchors_and_margins_preset(Control::PRESET_BOTTOM_LEFT); @@ -5485,25 +5485,25 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { h_scroll = memnew(HScrollBar); viewport->add_child(h_scroll); - h_scroll->connect("value_changed", this, "_update_scroll"); + h_scroll->connect_compat("value_changed", this, "_update_scroll"); h_scroll->hide(); v_scroll = memnew(VScrollBar); viewport->add_child(v_scroll); - v_scroll->connect("value_changed", this, "_update_scroll"); + v_scroll->connect_compat("value_changed", this, "_update_scroll"); v_scroll->hide(); viewport->add_child(controls_vb); zoom_minus = memnew(ToolButton); zoom_hb->add_child(zoom_minus); - zoom_minus->connect("pressed", this, "_button_zoom_minus"); + zoom_minus->connect_compat("pressed", this, "_button_zoom_minus"); zoom_minus->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_minus", TTR("Zoom Out"), KEY_MASK_CMD | KEY_MINUS)); zoom_minus->set_focus_mode(FOCUS_NONE); zoom_reset = memnew(ToolButton); zoom_hb->add_child(zoom_reset); - zoom_reset->connect("pressed", this, "_button_zoom_reset"); + zoom_reset->connect_compat("pressed", this, "_button_zoom_reset"); zoom_reset->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_reset", TTR("Zoom Reset"), KEY_MASK_CMD | KEY_0)); zoom_reset->set_focus_mode(FOCUS_NONE); zoom_reset->set_text_align(Button::TextAlign::ALIGN_CENTER); @@ -5512,7 +5512,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { zoom_plus = memnew(ToolButton); zoom_hb->add_child(zoom_plus); - zoom_plus->connect("pressed", this, "_button_zoom_plus"); + zoom_plus->connect_compat("pressed", this, "_button_zoom_plus"); zoom_plus->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_plus", TTR("Zoom In"), KEY_MASK_CMD | KEY_EQUAL)); // Usually direct access key for PLUS zoom_plus->set_focus_mode(FOCUS_NONE); @@ -5521,7 +5521,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { select_button = memnew(ToolButton); hb->add_child(select_button); select_button->set_toggle_mode(true); - select_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_SELECT)); + select_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_SELECT)); select_button->set_pressed(true); select_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/select_mode", TTR("Select Mode"), KEY_Q)); select_button->set_tooltip(keycode_get_string(KEY_MASK_CMD) + TTR("Drag: Rotate") + "\n" + TTR("Alt+Drag: Move") + "\n" + TTR("Press 'v' to Change Pivot, 'Shift+v' to Drag Pivot (while moving).") + "\n" + TTR("Alt+RMB: Depth list selection")); @@ -5531,21 +5531,21 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { move_button = memnew(ToolButton); hb->add_child(move_button); move_button->set_toggle_mode(true); - move_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_MOVE)); + move_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_MOVE)); move_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/move_mode", TTR("Move Mode"), KEY_W)); move_button->set_tooltip(TTR("Move Mode")); rotate_button = memnew(ToolButton); hb->add_child(rotate_button); rotate_button->set_toggle_mode(true); - rotate_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_ROTATE)); + rotate_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_ROTATE)); rotate_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/rotate_mode", TTR("Rotate Mode"), KEY_E)); rotate_button->set_tooltip(TTR("Rotate Mode")); scale_button = memnew(ToolButton); hb->add_child(scale_button); scale_button->set_toggle_mode(true); - scale_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_SCALE)); + scale_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_SCALE)); scale_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/scale_mode", TTR("Scale Mode"), KEY_S)); scale_button->set_tooltip(TTR("Scale Mode")); @@ -5554,25 +5554,25 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { list_select_button = memnew(ToolButton); hb->add_child(list_select_button); list_select_button->set_toggle_mode(true); - list_select_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_LIST_SELECT)); + list_select_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_LIST_SELECT)); list_select_button->set_tooltip(TTR("Show a list of all objects at the position clicked\n(same as Alt+RMB in select mode).")); pivot_button = memnew(ToolButton); hb->add_child(pivot_button); pivot_button->set_toggle_mode(true); - pivot_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_EDIT_PIVOT)); + pivot_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_EDIT_PIVOT)); pivot_button->set_tooltip(TTR("Click to change object's rotation pivot.")); pan_button = memnew(ToolButton); hb->add_child(pan_button); pan_button->set_toggle_mode(true); - pan_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_PAN)); + pan_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_PAN)); pan_button->set_tooltip(TTR("Pan Mode")); ruler_button = memnew(ToolButton); hb->add_child(ruler_button); ruler_button->set_toggle_mode(true); - ruler_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_RULER)); + ruler_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_RULER)); ruler_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/ruler_mode", TTR("Ruler Mode"), KEY_R)); ruler_button->set_tooltip(TTR("Ruler Mode")); @@ -5581,14 +5581,14 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { smart_snap_button = memnew(ToolButton); hb->add_child(smart_snap_button); smart_snap_button->set_toggle_mode(true); - smart_snap_button->connect("toggled", this, "_button_toggle_smart_snap"); + smart_snap_button->connect_compat("toggled", this, "_button_toggle_smart_snap"); smart_snap_button->set_tooltip(TTR("Toggle smart snapping.")); smart_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_smart_snap", TTR("Use Smart Snap"), KEY_MASK_SHIFT | KEY_S)); grid_snap_button = memnew(ToolButton); hb->add_child(grid_snap_button); grid_snap_button->set_toggle_mode(true); - grid_snap_button->connect("toggled", this, "_button_toggle_grid_snap"); + grid_snap_button->connect_compat("toggled", this, "_button_toggle_grid_snap"); grid_snap_button->set_tooltip(TTR("Toggle grid snapping.")); grid_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_grid_snap", TTR("Use Grid Snap"), KEY_MASK_SHIFT | KEY_G)); @@ -5599,7 +5599,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { snap_config_menu->set_switch_on_hover(true); PopupMenu *p = snap_config_menu->get_popup(); - p->connect("id_pressed", this, "_popup_callback"); + p->connect_compat("id_pressed", this, "_popup_callback"); p->set_hide_on_checkable_item_selection(false); p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_rotation_snap", TTR("Use Rotation Snap")), SNAP_USE_ROTATION); p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_scale_snap", TTR("Use Scale Snap")), SNAP_USE_SCALE); @@ -5613,7 +5613,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { smartsnap_config_popup = memnew(PopupMenu); p->add_child(smartsnap_config_popup); smartsnap_config_popup->set_name("SmartSnapping"); - smartsnap_config_popup->connect("id_pressed", this, "_popup_callback"); + smartsnap_config_popup->connect_compat("id_pressed", this, "_popup_callback"); smartsnap_config_popup->set_hide_on_checkable_item_selection(false); smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_parent", TTR("Snap to Parent")), SNAP_USE_NODE_PARENT); smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_anchors", TTR("Snap to Node Anchor")), SNAP_USE_NODE_ANCHORS); @@ -5627,22 +5627,22 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { lock_button = memnew(ToolButton); hb->add_child(lock_button); - lock_button->connect("pressed", this, "_popup_callback", varray(LOCK_SELECTED)); + lock_button->connect_compat("pressed", this, "_popup_callback", varray(LOCK_SELECTED)); lock_button->set_tooltip(TTR("Lock the selected object in place (can't be moved).")); unlock_button = memnew(ToolButton); hb->add_child(unlock_button); - unlock_button->connect("pressed", this, "_popup_callback", varray(UNLOCK_SELECTED)); + unlock_button->connect_compat("pressed", this, "_popup_callback", varray(UNLOCK_SELECTED)); unlock_button->set_tooltip(TTR("Unlock the selected object (can be moved).")); group_button = memnew(ToolButton); hb->add_child(group_button); - group_button->connect("pressed", this, "_popup_callback", varray(GROUP_SELECTED)); + group_button->connect_compat("pressed", this, "_popup_callback", varray(GROUP_SELECTED)); group_button->set_tooltip(TTR("Makes sure the object's children are not selectable.")); ungroup_button = memnew(ToolButton); hb->add_child(ungroup_button); - ungroup_button->connect("pressed", this, "_popup_callback", varray(UNGROUP_SELECTED)); + ungroup_button->connect_compat("pressed", this, "_popup_callback", varray(UNGROUP_SELECTED)); ungroup_button->set_tooltip(TTR("Restores the object's children's ability to be selected.")); hb->add_child(memnew(VSeparator)); @@ -5661,13 +5661,13 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { p->add_separator(); p->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_make_bones", TTR("Make Custom Bone(s) from Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B), SKELETON_MAKE_BONES); p->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_clear_bones", TTR("Clear Custom Bones")), SKELETON_CLEAR_BONES); - p->connect("id_pressed", this, "_popup_callback"); + p->connect_compat("id_pressed", this, "_popup_callback"); hb->add_child(memnew(VSeparator)); override_camera_button = memnew(ToolButton); hb->add_child(override_camera_button); - override_camera_button->connect("toggled", this, "_button_override_camera"); + override_camera_button->connect_compat("toggled", this, "_button_override_camera"); override_camera_button->set_toggle_mode(true); override_camera_button->set_disabled(true); _update_override_camera_button(false); @@ -5677,7 +5677,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { view_menu = memnew(MenuButton); view_menu->set_text(TTR("View")); hb->add_child(view_menu); - view_menu->get_popup()->connect("id_pressed", this, "_popup_callback"); + view_menu->get_popup()->connect_compat("id_pressed", this, "_popup_callback"); view_menu->set_switch_on_hover(true); p = view_menu->get_popup(); @@ -5705,18 +5705,18 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { presets_menu->set_switch_on_hover(true); p = presets_menu->get_popup(); - p->connect("id_pressed", this, "_popup_callback"); + p->connect_compat("id_pressed", this, "_popup_callback"); anchors_popup = memnew(PopupMenu); p->add_child(anchors_popup); anchors_popup->set_name("Anchors"); - anchors_popup->connect("id_pressed", this, "_popup_callback"); + anchors_popup->connect_compat("id_pressed", this, "_popup_callback"); anchor_mode_button = memnew(ToolButton); hb->add_child(anchor_mode_button); anchor_mode_button->set_toggle_mode(true); anchor_mode_button->hide(); - anchor_mode_button->connect("toggled", this, "_button_toggle_anchor_mode"); + anchor_mode_button->connect_compat("toggled", this, "_button_toggle_anchor_mode"); animation_hb = memnew(HBoxContainer); hb->add_child(animation_hb); @@ -5728,7 +5728,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { key_loc_button->set_flat(true); key_loc_button->set_pressed(true); key_loc_button->set_focus_mode(FOCUS_NONE); - key_loc_button->connect("pressed", this, "_popup_callback", varray(ANIM_INSERT_POS)); + key_loc_button->connect_compat("pressed", this, "_popup_callback", varray(ANIM_INSERT_POS)); key_loc_button->set_tooltip(TTR("Translation mask for inserting keys.")); animation_hb->add_child(key_loc_button); key_rot_button = memnew(Button); @@ -5736,20 +5736,20 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { key_rot_button->set_flat(true); key_rot_button->set_pressed(true); key_rot_button->set_focus_mode(FOCUS_NONE); - key_rot_button->connect("pressed", this, "_popup_callback", varray(ANIM_INSERT_ROT)); + key_rot_button->connect_compat("pressed", this, "_popup_callback", varray(ANIM_INSERT_ROT)); key_rot_button->set_tooltip(TTR("Rotation mask for inserting keys.")); animation_hb->add_child(key_rot_button); key_scale_button = memnew(Button); key_scale_button->set_toggle_mode(true); key_scale_button->set_flat(true); key_scale_button->set_focus_mode(FOCUS_NONE); - key_scale_button->connect("pressed", this, "_popup_callback", varray(ANIM_INSERT_SCALE)); + key_scale_button->connect_compat("pressed", this, "_popup_callback", varray(ANIM_INSERT_SCALE)); key_scale_button->set_tooltip(TTR("Scale mask for inserting keys.")); animation_hb->add_child(key_scale_button); key_insert_button = memnew(Button); key_insert_button->set_flat(true); key_insert_button->set_focus_mode(FOCUS_NONE); - key_insert_button->connect("pressed", this, "_popup_callback", varray(ANIM_INSERT_KEY)); + key_insert_button->connect_compat("pressed", this, "_popup_callback", varray(ANIM_INSERT_KEY)); key_insert_button->set_tooltip(TTR("Insert keys (based on mask).")); key_insert_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/anim_insert_key", TTR("Insert Key"), KEY_INSERT)); animation_hb->add_child(key_insert_button); @@ -5765,7 +5765,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { animation_menu = memnew(MenuButton); animation_menu->set_tooltip(TTR("Animation Key and Pose Options")); animation_hb->add_child(animation_menu); - animation_menu->get_popup()->connect("id_pressed", this, "_popup_callback"); + animation_menu->get_popup()->connect_compat("id_pressed", this, "_popup_callback"); animation_menu->set_switch_on_hover(true); p = animation_menu->get_popup(); @@ -5778,7 +5778,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { p->add_shortcut(ED_SHORTCUT("canvas_item_editor/anim_clear_pose", TTR("Clear Pose"), KEY_MASK_SHIFT | KEY_K), ANIM_CLEAR_POSE); snap_dialog = memnew(SnapDialog); - snap_dialog->connect("confirmed", this, "_snap_changed"); + snap_dialog->connect_compat("confirmed", this, "_snap_changed"); add_child(snap_dialog); select_sb = Ref<StyleBoxTexture>(memnew(StyleBoxTexture)); @@ -5786,8 +5786,8 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { selection_menu = memnew(PopupMenu); add_child(selection_menu); selection_menu->set_custom_minimum_size(Vector2(100, 0)); - selection_menu->connect("id_pressed", this, "_selection_result_pressed"); - selection_menu->connect("popup_hide", this, "_selection_menu_hide"); + selection_menu->connect_compat("id_pressed", this, "_selection_result_pressed"); + selection_menu->connect_compat("popup_hide", this, "_selection_menu_hide"); multiply_grid_step_shortcut = ED_SHORTCUT("canvas_item_editor/multiply_grid_step", TTR("Multiply grid step by 2"), KEY_KP_MULTIPLY); divide_grid_step_shortcut = ED_SHORTCUT("canvas_item_editor/divide_grid_step", TTR("Divide grid step by 2"), KEY_KP_DIVIDE); @@ -6234,11 +6234,11 @@ void CanvasItemEditorViewport::drop_data(const Point2 &p_point, const Variant &p void CanvasItemEditorViewport::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - connect("mouse_exited", this, "_on_mouse_exit"); + connect_compat("mouse_exited", this, "_on_mouse_exit"); label->add_color_override("font_color", get_color("warning_color", "Editor")); } break; case NOTIFICATION_EXIT_TREE: { - disconnect("mouse_exited", this, "_on_mouse_exit"); + disconnect_compat("mouse_exited", this, "_on_mouse_exit"); } break; default: break; @@ -6276,8 +6276,8 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte selector = memnew(AcceptDialog); editor->get_gui_base()->add_child(selector); selector->set_title(TTR("Change Default Type")); - selector->connect("confirmed", this, "_on_change_type_confirmed"); - selector->connect("popup_hide", this, "_on_change_type_closed"); + selector->connect_compat("confirmed", this, "_on_change_type_confirmed"); + selector->connect_compat("popup_hide", this, "_on_change_type_closed"); VBoxContainer *vbc = memnew(VBoxContainer); selector->add_child(vbc); @@ -6294,7 +6294,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte CheckBox *check = memnew(CheckBox); btn_group->add_child(check); check->set_text(types[i]); - check->connect("button_down", this, "_on_select_type", varray(check)); + check->connect_compat("button_down", this, "_on_select_type", varray(check)); check->set_button_group(button_group); } diff --git a/editor/plugins/collision_polygon_editor_plugin.cpp b/editor/plugins/collision_polygon_editor_plugin.cpp index 9aa9b6cda5..59bbe031ed 100644 --- a/editor/plugins/collision_polygon_editor_plugin.cpp +++ b/editor/plugins/collision_polygon_editor_plugin.cpp @@ -47,7 +47,7 @@ void Polygon3DEditor::_notification(int p_what) { button_create->set_icon(get_icon("Edit", "EditorIcons")); button_edit->set_icon(get_icon("MovePoint", "EditorIcons")); button_edit->set_pressed(true); - get_tree()->connect("node_removed", this, "_node_removed"); + get_tree()->connect_compat("node_removed", this, "_node_removed"); } break; case NOTIFICATION_PROCESS: { @@ -532,12 +532,12 @@ Polygon3DEditor::Polygon3DEditor(EditorNode *p_editor) { add_child(memnew(VSeparator)); button_create = memnew(ToolButton); add_child(button_create); - button_create->connect("pressed", this, "_menu_option", varray(MODE_CREATE)); + button_create->connect_compat("pressed", this, "_menu_option", varray(MODE_CREATE)); button_create->set_toggle_mode(true); button_edit = memnew(ToolButton); add_child(button_edit); - button_edit->connect("pressed", this, "_menu_option", varray(MODE_EDIT)); + button_edit->connect_compat("pressed", this, "_menu_option", varray(MODE_EDIT)); button_edit->set_toggle_mode(true); mode = MODE_EDIT; diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp index 80f5e26d48..ad3f01ec37 100644 --- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp @@ -240,9 +240,9 @@ void CPUParticles2DEditorPlugin::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - menu->get_popup()->connect("id_pressed", this, "_menu_callback"); + menu->get_popup()->connect_compat("id_pressed", this, "_menu_callback"); menu->set_icon(menu->get_popup()->get_icon("Particles2D", "EditorIcons")); - file->connect("file_selected", this, "_file_selected"); + file->connect_compat("file_selected", this, "_file_selected"); } } @@ -305,7 +305,7 @@ CPUParticles2DEditorPlugin::CPUParticles2DEditorPlugin(EditorNode *p_node) { toolbar->add_child(emission_mask); - emission_mask->connect("confirmed", this, "_generate_emission_mask"); + emission_mask->connect_compat("confirmed", this, "_generate_emission_mask"); } CPUParticles2DEditorPlugin::~CPUParticles2DEditorPlugin() { diff --git a/editor/plugins/cpu_particles_editor_plugin.cpp b/editor/plugins/cpu_particles_editor_plugin.cpp index be3e9cd8e0..8a73ae1e1f 100644 --- a/editor/plugins/cpu_particles_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_editor_plugin.cpp @@ -116,7 +116,7 @@ CPUParticlesEditor::CPUParticlesEditor() { options->get_popup()->add_item(TTR("Create Emission Points From Node"), MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE); options->get_popup()->add_separator(); options->get_popup()->add_item(TTR("Restart"), MENU_OPTION_RESTART); - options->get_popup()->connect("id_pressed", this, "_menu_option"); + options->get_popup()->connect_compat("id_pressed", this, "_menu_option"); } void CPUParticlesEditorPlugin::edit(Object *p_object) { diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index 62a3ff9b58..5f4fb19d9e 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -49,7 +49,7 @@ CurveEditor::CurveEditor() { set_clip_contents(true); _context_menu = memnew(PopupMenu); - _context_menu->connect("id_pressed", this, "_on_context_menu_item_selected"); + _context_menu->connect_compat("id_pressed", this, "_on_context_menu_item_selected"); add_child(_context_menu); _presets_menu = memnew(PopupMenu); @@ -60,7 +60,7 @@ CurveEditor::CurveEditor() { _presets_menu->add_item(TTR("Ease In"), PRESET_EASE_IN); _presets_menu->add_item(TTR("Ease Out"), PRESET_EASE_OUT); _presets_menu->add_item(TTR("Smoothstep"), PRESET_SMOOTHSTEP); - _presets_menu->connect("id_pressed", this, "_on_preset_item_selected"); + _presets_menu->connect_compat("id_pressed", this, "_on_preset_item_selected"); _context_menu->add_child(_presets_menu); } @@ -70,15 +70,15 @@ void CurveEditor::set_curve(Ref<Curve> curve) { return; if (_curve_ref.is_valid()) { - _curve_ref->disconnect(CoreStringNames::get_singleton()->changed, this, "_curve_changed"); - _curve_ref->disconnect(Curve::SIGNAL_RANGE_CHANGED, this, "_curve_changed"); + _curve_ref->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_curve_changed"); + _curve_ref->disconnect_compat(Curve::SIGNAL_RANGE_CHANGED, this, "_curve_changed"); } _curve_ref = curve; if (_curve_ref.is_valid()) { - _curve_ref->connect(CoreStringNames::get_singleton()->changed, this, "_curve_changed"); - _curve_ref->connect(Curve::SIGNAL_RANGE_CHANGED, this, "_curve_changed"); + _curve_ref->connect_compat(CoreStringNames::get_singleton()->changed, this, "_curve_changed"); + _curve_ref->connect_compat(Curve::SIGNAL_RANGE_CHANGED, this, "_curve_changed"); } _selected_point = -1; diff --git a/editor/plugins/gi_probe_editor_plugin.cpp b/editor/plugins/gi_probe_editor_plugin.cpp index fe2c0d33b7..9231d38a02 100644 --- a/editor/plugins/gi_probe_editor_plugin.cpp +++ b/editor/plugins/gi_probe_editor_plugin.cpp @@ -147,7 +147,7 @@ GIProbeEditorPlugin::GIProbeEditorPlugin(EditorNode *p_node) { bake = memnew(ToolButton); bake->set_icon(editor->get_gui_base()->get_icon("Bake", "EditorIcons")); bake->set_text(TTR("Bake GI Probe")); - bake->connect("pressed", this, "_bake"); + bake->connect_compat("pressed", this, "_bake"); bake_hb->add_child(bake); bake_info = memnew(Label); bake_info->set_h_size_flags(Control::SIZE_EXPAND_FILL); @@ -159,7 +159,7 @@ GIProbeEditorPlugin::GIProbeEditorPlugin(EditorNode *p_node) { probe_file = memnew(EditorFileDialog); probe_file->set_mode(EditorFileDialog::MODE_SAVE_FILE); probe_file->add_filter("*.res"); - probe_file->connect("file_selected", this, "_giprobe_save_path_and_bake"); + probe_file->connect_compat("file_selected", this, "_giprobe_save_path_and_bake"); get_editor_interface()->get_base_control()->add_child(probe_file); probe_file->set_title(TTR("Select path for GIProbe Data File")); diff --git a/editor/plugins/gradient_editor_plugin.cpp b/editor/plugins/gradient_editor_plugin.cpp index 0a3a994eb7..b36782ee14 100644 --- a/editor/plugins/gradient_editor_plugin.cpp +++ b/editor/plugins/gradient_editor_plugin.cpp @@ -69,8 +69,8 @@ void GradientEditor::_bind_methods() { void GradientEditor::set_gradient(const Ref<Gradient> &p_gradient) { gradient = p_gradient; - connect("ramp_changed", this, "_ramp_changed"); - gradient->connect("changed", this, "_gradient_changed"); + connect_compat("ramp_changed", this, "_ramp_changed"); + gradient->connect_compat("changed", this, "_gradient_changed"); set_points(gradient->get_points()); } diff --git a/editor/plugins/item_list_editor_plugin.cpp b/editor/plugins/item_list_editor_plugin.cpp index b7dfe97081..b872a2d932 100644 --- a/editor/plugins/item_list_editor_plugin.cpp +++ b/editor/plugins/item_list_editor_plugin.cpp @@ -268,7 +268,7 @@ void ItemListEditor::_notification(int p_notification) { del_button->set_icon(get_icon("Remove", "EditorIcons")); } else if (p_notification == NOTIFICATION_READY) { - get_tree()->connect("node_removed", this, "_node_removed"); + get_tree()->connect_compat("node_removed", this, "_node_removed"); } } @@ -359,7 +359,7 @@ ItemListEditor::ItemListEditor() { toolbar_button = memnew(ToolButton); toolbar_button->set_text(TTR("Items")); add_child(toolbar_button); - toolbar_button->connect("pressed", this, "_edit_items"); + toolbar_button->connect_compat("pressed", this, "_edit_items"); dialog = memnew(AcceptDialog); dialog->set_title(TTR("Item List Editor")); @@ -376,14 +376,14 @@ ItemListEditor::ItemListEditor() { add_button = memnew(Button); add_button->set_text(TTR("Add")); hbc->add_child(add_button); - add_button->connect("pressed", this, "_add_button"); + add_button->connect_compat("pressed", this, "_add_button"); hbc->add_spacer(); del_button = memnew(Button); del_button->set_text(TTR("Delete")); hbc->add_child(del_button); - del_button->connect("pressed", this, "_delete_button"); + del_button->connect_compat("pressed", this, "_delete_button"); property_editor = memnew(EditorInspector); vbc->add_child(property_editor); diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp index 4e44082853..bca0bde441 100644 --- a/editor/plugins/material_editor_plugin.cpp +++ b/editor/plugins/material_editor_plugin.cpp @@ -171,13 +171,13 @@ MaterialEditor::MaterialEditor() { sphere_switch->set_toggle_mode(true); sphere_switch->set_pressed(true); vb_shape->add_child(sphere_switch); - sphere_switch->connect("pressed", this, "_button_pressed", varray(sphere_switch)); + sphere_switch->connect_compat("pressed", this, "_button_pressed", varray(sphere_switch)); box_switch = memnew(TextureButton); box_switch->set_toggle_mode(true); box_switch->set_pressed(false); vb_shape->add_child(box_switch); - box_switch->connect("pressed", this, "_button_pressed", varray(box_switch)); + box_switch->connect_compat("pressed", this, "_button_pressed", varray(box_switch)); hb->add_spacer(); @@ -187,12 +187,12 @@ MaterialEditor::MaterialEditor() { light_1_switch = memnew(TextureButton); light_1_switch->set_toggle_mode(true); vb_light->add_child(light_1_switch); - light_1_switch->connect("pressed", this, "_button_pressed", varray(light_1_switch)); + light_1_switch->connect_compat("pressed", this, "_button_pressed", varray(light_1_switch)); light_2_switch = memnew(TextureButton); light_2_switch->set_toggle_mode(true); vb_light->add_child(light_2_switch); - light_2_switch->connect("pressed", this, "_button_pressed", varray(light_2_switch)); + light_2_switch->connect_compat("pressed", this, "_button_pressed", varray(light_2_switch)); first_enter = true; } diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp index d06e5b6349..2b25a2328c 100644 --- a/editor/plugins/mesh_editor_plugin.cpp +++ b/editor/plugins/mesh_editor_plugin.cpp @@ -157,12 +157,12 @@ MeshEditor::MeshEditor() { light_1_switch = memnew(TextureButton); light_1_switch->set_toggle_mode(true); vb_light->add_child(light_1_switch); - light_1_switch->connect("pressed", this, "_button_pressed", varray(light_1_switch)); + light_1_switch->connect_compat("pressed", this, "_button_pressed", varray(light_1_switch)); light_2_switch = memnew(TextureButton); light_2_switch->set_toggle_mode(true); vb_light->add_child(light_2_switch); - light_2_switch->connect("pressed", this, "_button_pressed", varray(light_2_switch)); + light_2_switch->connect_compat("pressed", this, "_button_pressed", varray(light_2_switch)); first_enter = true; diff --git a/editor/plugins/mesh_instance_editor_plugin.cpp b/editor/plugins/mesh_instance_editor_plugin.cpp index 574646956e..182a8600e4 100644 --- a/editor/plugins/mesh_instance_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_editor_plugin.cpp @@ -469,7 +469,7 @@ MeshInstanceEditor::MeshInstanceEditor() { options->get_popup()->add_item(TTR("View UV2"), MENU_OPTION_DEBUG_UV2); options->get_popup()->add_item(TTR("Unwrap UV2 for Lightmap/AO"), MENU_OPTION_CREATE_UV2); - options->get_popup()->connect("id_pressed", this, "_menu_option"); + options->get_popup()->connect_compat("id_pressed", this, "_menu_option"); outline_dialog = memnew(ConfirmationDialog); outline_dialog->set_title(TTR("Create Outline Mesh")); @@ -487,7 +487,7 @@ MeshInstanceEditor::MeshInstanceEditor() { outline_dialog_vbc->add_margin_child(TTR("Outline Size:"), outline_size); add_child(outline_dialog); - outline_dialog->connect("confirmed", this, "_create_outline_mesh"); + outline_dialog->connect_compat("confirmed", this, "_create_outline_mesh"); err_dialog = memnew(AcceptDialog); add_child(err_dialog); @@ -497,7 +497,7 @@ MeshInstanceEditor::MeshInstanceEditor() { add_child(debug_uv_dialog); debug_uv = memnew(Control); debug_uv->set_custom_minimum_size(Size2(600, 600) * EDSCALE); - debug_uv->connect("draw", this, "_debug_uv_draw"); + debug_uv->connect_compat("draw", this, "_debug_uv_draw"); debug_uv_dialog->add_child(debug_uv); } diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp index b77cb6453f..ea8842a56f 100644 --- a/editor/plugins/mesh_library_editor_plugin.cpp +++ b/editor/plugins/mesh_library_editor_plugin.cpp @@ -268,7 +268,7 @@ MeshLibraryEditor::MeshLibraryEditor(EditorNode *p_editor) { file->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper()); } add_child(file); - file->connect("file_selected", this, "_import_scene_cbk"); + file->connect_compat("file_selected", this, "_import_scene_cbk"); menu = memnew(MenuButton); SpatialEditor::get_singleton()->add_control_to_menu_panel(menu); @@ -281,13 +281,13 @@ MeshLibraryEditor::MeshLibraryEditor(EditorNode *p_editor) { menu->get_popup()->add_item(TTR("Import from Scene"), MENU_OPTION_IMPORT_FROM_SCENE); menu->get_popup()->add_item(TTR("Update from Scene"), MENU_OPTION_UPDATE_FROM_SCENE); menu->get_popup()->set_item_disabled(menu->get_popup()->get_item_index(MENU_OPTION_UPDATE_FROM_SCENE), true); - menu->get_popup()->connect("id_pressed", this, "_menu_cbk"); + menu->get_popup()->connect_compat("id_pressed", this, "_menu_cbk"); menu->hide(); editor = p_editor; cd = memnew(ConfirmationDialog); add_child(cd); - cd->get_ok()->connect("pressed", this, "_menu_confirm"); + cd->get_ok()->connect_compat("pressed", this, "_menu_confirm"); } void MeshLibraryEditorPlugin::edit(Object *p_node) { diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp index 4b7fd6399b..b2ce01b8d8 100644 --- a/editor/plugins/multimesh_editor_plugin.cpp +++ b/editor/plugins/multimesh_editor_plugin.cpp @@ -295,7 +295,7 @@ MultiMeshEditor::MultiMeshEditor() { options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("MultiMeshInstance", "EditorIcons")); options->get_popup()->add_item(TTR("Populate Surface")); - options->get_popup()->connect("id_pressed", this, "_menu_option"); + options->get_popup()->connect_compat("id_pressed", this, "_menu_option"); populate_dialog = memnew(ConfirmationDialog); populate_dialog->set_title(TTR("Populate MultiMesh")); @@ -313,7 +313,7 @@ MultiMeshEditor::MultiMeshEditor() { Button *b = memnew(Button); hbc->add_child(b); b->set_text(".."); - b->connect("pressed", this, "_browse", make_binds(false)); + b->connect_compat("pressed", this, "_browse", make_binds(false)); vbc->add_margin_child(TTR("Target Surface:"), hbc); @@ -325,7 +325,7 @@ MultiMeshEditor::MultiMeshEditor() { hbc->add_child(b); b->set_text(".."); vbc->add_margin_child(TTR("Source Mesh:"), hbc); - b->connect("pressed", this, "_browse", make_binds(true)); + b->connect_compat("pressed", this, "_browse", make_binds(true)); populate_axis = memnew(OptionButton); populate_axis->add_item(TTR("X-Axis")); @@ -371,10 +371,10 @@ MultiMeshEditor::MultiMeshEditor() { populate_dialog->get_ok()->set_text(TTR("Populate")); - populate_dialog->get_ok()->connect("pressed", this, "_populate"); + populate_dialog->get_ok()->connect_compat("pressed", this, "_populate"); std = memnew(SceneTreeDialog); populate_dialog->add_child(std); - std->connect("selected", this, "_browsed"); + std->connect_compat("selected", this, "_browsed"); _last_pp_node = NULL; diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp index 2e149a0f65..ab23cb9054 100644 --- a/editor/plugins/particles_2d_editor_plugin.cpp +++ b/editor/plugins/particles_2d_editor_plugin.cpp @@ -349,9 +349,9 @@ void Particles2DEditorPlugin::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - menu->get_popup()->connect("id_pressed", this, "_menu_callback"); + menu->get_popup()->connect_compat("id_pressed", this, "_menu_callback"); menu->set_icon(menu->get_popup()->get_icon("Particles2D", "EditorIcons")); - file->connect("file_selected", this, "_file_selected"); + file->connect_compat("file_selected", this, "_file_selected"); } } @@ -416,7 +416,7 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) { toolbar->add_child(generate_visibility_rect); - generate_visibility_rect->connect("confirmed", this, "_generate_visibility_rect"); + generate_visibility_rect->connect_compat("confirmed", this, "_generate_visibility_rect"); emission_mask = memnew(ConfirmationDialog); emission_mask->set_title(TTR("Load Emission Mask")); @@ -433,7 +433,7 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) { toolbar->add_child(emission_mask); - emission_mask->connect("confirmed", this, "_generate_emission_mask"); + emission_mask->connect_compat("confirmed", this, "_generate_emission_mask"); } Particles2DEditorPlugin::~Particles2DEditorPlugin() { diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp index 940874846f..cea2182ae9 100644 --- a/editor/plugins/particles_editor_plugin.cpp +++ b/editor/plugins/particles_editor_plugin.cpp @@ -229,14 +229,14 @@ ParticlesEditorBase::ParticlesEditorBase() { emd_vb->add_margin_child(TTR("Emission Source: "), emission_fill); emission_dialog->get_ok()->set_text(TTR("Create")); - emission_dialog->connect("confirmed", this, "_generate_emission_points"); + emission_dialog->connect_compat("confirmed", this, "_generate_emission_points"); emission_file_dialog = memnew(EditorFileDialog); add_child(emission_file_dialog); - emission_file_dialog->connect("file_selected", this, "_resource_seleted"); + emission_file_dialog->connect_compat("file_selected", this, "_resource_seleted"); emission_tree_dialog = memnew(SceneTreeDialog); add_child(emission_tree_dialog); - emission_tree_dialog->connect("selected", this, "_node_selected"); + emission_tree_dialog->connect_compat("selected", this, "_node_selected"); List<String> extensions; ResourceLoader::get_recognized_extensions_for_type("Mesh", &extensions); @@ -262,7 +262,7 @@ void ParticlesEditor::_notification(int p_notification) { if (p_notification == NOTIFICATION_ENTER_TREE) { options->set_icon(options->get_popup()->get_icon("Particles", "EditorIcons")); - get_tree()->connect("node_removed", this, "_node_removed"); + get_tree()->connect_compat("node_removed", this, "_node_removed"); } } @@ -474,7 +474,7 @@ ParticlesEditor::ParticlesEditor() { options->get_popup()->add_separator(); options->get_popup()->add_item(TTR("Restart"), MENU_OPTION_RESTART); - options->get_popup()->connect("id_pressed", this, "_menu_option"); + options->get_popup()->connect_compat("id_pressed", this, "_menu_option"); generate_aabb = memnew(ConfirmationDialog); generate_aabb->set_title(TTR("Generate Visibility AABB")); @@ -488,7 +488,7 @@ ParticlesEditor::ParticlesEditor() { add_child(generate_aabb); - generate_aabb->connect("confirmed", this, "_generate_aabb"); + generate_aabb->connect_compat("confirmed", this, "_generate_aabb"); } void ParticlesEditorPlugin::edit(Object *p_object) { diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp index 383dada590..e642233c64 100644 --- a/editor/plugins/path_2d_editor_plugin.cpp +++ b/editor/plugins/path_2d_editor_plugin.cpp @@ -441,14 +441,14 @@ void Path2DEditor::edit(Node *p_path2d) { if (p_path2d) { node = Object::cast_to<Path2D>(p_path2d); - if (!node->is_connected("visibility_changed", this, "_node_visibility_changed")) - node->connect("visibility_changed", this, "_node_visibility_changed"); + if (!node->is_connected_compat("visibility_changed", this, "_node_visibility_changed")) + node->connect_compat("visibility_changed", this, "_node_visibility_changed"); } else { // node may have been deleted at this point - if (node && node->is_connected("visibility_changed", this, "_node_visibility_changed")) - node->disconnect("visibility_changed", this, "_node_visibility_changed"); + if (node && node->is_connected_compat("visibility_changed", this, "_node_visibility_changed")) + node->disconnect_compat("visibility_changed", this, "_node_visibility_changed"); node = NULL; } } @@ -555,34 +555,34 @@ Path2DEditor::Path2DEditor(EditorNode *p_editor) { curve_edit->set_toggle_mode(true); curve_edit->set_focus_mode(Control::FOCUS_NONE); curve_edit->set_tooltip(TTR("Select Points") + "\n" + TTR("Shift+Drag: Select Control Points") + "\n" + keycode_get_string(KEY_MASK_CMD) + TTR("Click: Add Point") + "\n" + TTR("Left Click: Split Segment (in curve)") + "\n" + TTR("Right Click: Delete Point")); - curve_edit->connect("pressed", this, "_mode_selected", varray(MODE_EDIT)); + curve_edit->connect_compat("pressed", this, "_mode_selected", varray(MODE_EDIT)); base_hb->add_child(curve_edit); curve_edit_curve = memnew(ToolButton); curve_edit_curve->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveCurve", "EditorIcons")); curve_edit_curve->set_toggle_mode(true); curve_edit_curve->set_focus_mode(Control::FOCUS_NONE); curve_edit_curve->set_tooltip(TTR("Select Control Points (Shift+Drag)")); - curve_edit_curve->connect("pressed", this, "_mode_selected", varray(MODE_EDIT_CURVE)); + curve_edit_curve->connect_compat("pressed", this, "_mode_selected", varray(MODE_EDIT_CURVE)); base_hb->add_child(curve_edit_curve); curve_create = memnew(ToolButton); curve_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveCreate", "EditorIcons")); curve_create->set_toggle_mode(true); curve_create->set_focus_mode(Control::FOCUS_NONE); curve_create->set_tooltip(TTR("Add Point (in empty space)")); - curve_create->connect("pressed", this, "_mode_selected", varray(MODE_CREATE)); + curve_create->connect_compat("pressed", this, "_mode_selected", varray(MODE_CREATE)); base_hb->add_child(curve_create); curve_del = memnew(ToolButton); curve_del->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveDelete", "EditorIcons")); curve_del->set_toggle_mode(true); curve_del->set_focus_mode(Control::FOCUS_NONE); curve_del->set_tooltip(TTR("Delete Point")); - curve_del->connect("pressed", this, "_mode_selected", varray(MODE_DELETE)); + curve_del->connect_compat("pressed", this, "_mode_selected", varray(MODE_DELETE)); base_hb->add_child(curve_del); curve_close = memnew(ToolButton); curve_close->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveClose", "EditorIcons")); curve_close->set_focus_mode(Control::FOCUS_NONE); curve_close->set_tooltip(TTR("Close Curve")); - curve_close->connect("pressed", this, "_mode_selected", varray(ACTION_CLOSE)); + curve_close->connect_compat("pressed", this, "_mode_selected", varray(ACTION_CLOSE)); base_hb->add_child(curve_close); PopupMenu *menu; @@ -596,7 +596,7 @@ Path2DEditor::Path2DEditor(EditorNode *p_editor) { menu->set_item_checked(HANDLE_OPTION_ANGLE, mirror_handle_angle); menu->add_check_item(TTR("Mirror Handle Lengths")); menu->set_item_checked(HANDLE_OPTION_LENGTH, mirror_handle_length); - menu->connect("id_pressed", this, "_handle_option_pressed"); + menu->connect_compat("id_pressed", this, "_handle_option_pressed"); base_hb->hide(); diff --git a/editor/plugins/path_editor_plugin.cpp b/editor/plugins/path_editor_plugin.cpp index 75c9776f0f..b955bf7f41 100644 --- a/editor/plugins/path_editor_plugin.cpp +++ b/editor/plugins/path_editor_plugin.cpp @@ -543,10 +543,10 @@ void PathEditorPlugin::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - curve_create->connect("pressed", this, "_mode_changed", make_binds(0)); - curve_edit->connect("pressed", this, "_mode_changed", make_binds(1)); - curve_del->connect("pressed", this, "_mode_changed", make_binds(2)); - curve_close->connect("pressed", this, "_close_curve"); + curve_create->connect_compat("pressed", this, "_mode_changed", make_binds(0)); + curve_edit->connect_compat("pressed", this, "_mode_changed", make_binds(1)); + curve_del->connect_compat("pressed", this, "_mode_changed", make_binds(2)); + curve_close->connect_compat("pressed", this, "_close_curve"); } } @@ -614,7 +614,7 @@ PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) { menu->set_item_checked(HANDLE_OPTION_ANGLE, mirror_handle_angle); menu->add_check_item(TTR("Mirror Handle Lengths")); menu->set_item_checked(HANDLE_OPTION_LENGTH, mirror_handle_length); - menu->connect("id_pressed", this, "_handle_option_pressed"); + menu->connect_compat("id_pressed", this, "_handle_option_pressed"); curve_edit->set_pressed(true); /* diff --git a/editor/plugins/physical_bone_plugin.cpp b/editor/plugins/physical_bone_plugin.cpp index 28099a927b..4b63d82961 100644 --- a/editor/plugins/physical_bone_plugin.cpp +++ b/editor/plugins/physical_bone_plugin.cpp @@ -64,7 +64,7 @@ PhysicalBoneEditor::PhysicalBoneEditor(EditorNode *p_editor) : button_transform_joint->set_text(TTR("Move Joint")); button_transform_joint->set_icon(SpatialEditor::get_singleton()->get_icon("PhysicalBone", "EditorIcons")); button_transform_joint->set_toggle_mode(true); - button_transform_joint->connect("toggled", this, "_on_toggle_button_transform_joint"); + button_transform_joint->connect_compat("toggled", this, "_on_toggle_button_transform_joint"); hide(); } diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index 8b0adbafa2..91c0222f6d 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -192,7 +192,7 @@ void Polygon2DEditor::_update_bone_list() { if (np == selected || bone_scroll_vb->get_child_count() < 2) cb->set_pressed(true); - cb->connect("pressed", this, "_bone_paint_selected", varray(i)); + cb->connect_compat("pressed", this, "_bone_paint_selected", varray(i)); } uv_edit_draw->update(); @@ -1273,14 +1273,14 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : button_uv = memnew(ToolButton); add_child(button_uv); button_uv->set_tooltip(TTR("Open Polygon 2D UV editor.")); - button_uv->connect("pressed", this, "_menu_option", varray(MODE_EDIT_UV)); + button_uv->connect_compat("pressed", this, "_menu_option", varray(MODE_EDIT_UV)); uv_mode = UV_MODE_EDIT_POINT; uv_edit = memnew(AcceptDialog); add_child(uv_edit); uv_edit->set_title(TTR("Polygon 2D UV Editor")); uv_edit->set_resizable(true); - uv_edit->connect("popup_hide", this, "_uv_edit_popup_hide"); + uv_edit->connect_compat("popup_hide", this, "_uv_edit_popup_hide"); VBoxContainer *uv_main_vb = memnew(VBoxContainer); uv_edit->add_child(uv_main_vb); @@ -1312,10 +1312,10 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : uv_edit_mode[2]->set_button_group(uv_edit_group); uv_edit_mode[3]->set_button_group(uv_edit_group); - uv_edit_mode[0]->connect("pressed", this, "_uv_edit_mode_select", varray(0)); - uv_edit_mode[1]->connect("pressed", this, "_uv_edit_mode_select", varray(1)); - uv_edit_mode[2]->connect("pressed", this, "_uv_edit_mode_select", varray(2)); - uv_edit_mode[3]->connect("pressed", this, "_uv_edit_mode_select", varray(3)); + uv_edit_mode[0]->connect_compat("pressed", this, "_uv_edit_mode_select", varray(0)); + uv_edit_mode[1]->connect_compat("pressed", this, "_uv_edit_mode_select", varray(1)); + uv_edit_mode[2]->connect_compat("pressed", this, "_uv_edit_mode_select", varray(2)); + uv_edit_mode[3]->connect_compat("pressed", this, "_uv_edit_mode_select", varray(3)); uv_mode_hb->add_child(memnew(VSeparator)); @@ -1325,7 +1325,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : uv_button[i] = memnew(ToolButton); uv_button[i]->set_toggle_mode(true); uv_mode_hb->add_child(uv_button[i]); - uv_button[i]->connect("pressed", this, "_uv_mode", varray(i)); + uv_button[i]->connect_compat("pressed", this, "_uv_mode", varray(i)); uv_button[i]->set_focus_mode(FOCUS_NONE); } @@ -1388,7 +1388,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : uv_menu->get_popup()->add_item(TTR("Clear UV"), UVEDIT_UV_CLEAR); uv_menu->get_popup()->add_separator(); uv_menu->get_popup()->add_item(TTR("Grid Settings"), UVEDIT_GRID_SETTINGS); - uv_menu->get_popup()->connect("id_pressed", this, "_menu_option"); + uv_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option"); uv_mode_hb->add_child(memnew(VSeparator)); @@ -1399,7 +1399,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : b_snap_enable->set_toggle_mode(true); b_snap_enable->set_pressed(use_snap); b_snap_enable->set_tooltip(TTR("Enable Snap")); - b_snap_enable->connect("toggled", this, "_set_use_snap"); + b_snap_enable->connect_compat("toggled", this, "_set_use_snap"); b_snap_grid = memnew(ToolButton); uv_mode_hb->add_child(b_snap_grid); @@ -1408,7 +1408,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : b_snap_grid->set_toggle_mode(true); b_snap_grid->set_pressed(snap_show_grid); b_snap_grid->set_tooltip(TTR("Show Grid")); - b_snap_grid->connect("toggled", this, "_set_show_grid"); + b_snap_grid->connect_compat("toggled", this, "_set_show_grid"); grid_settings = memnew(AcceptDialog); grid_settings->set_title(TTR("Configure Grid:")); @@ -1422,7 +1422,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : sb_off_x->set_step(1); sb_off_x->set_value(snap_offset.x); sb_off_x->set_suffix("px"); - sb_off_x->connect("value_changed", this, "_set_snap_off_x"); + sb_off_x->connect_compat("value_changed", this, "_set_snap_off_x"); grid_settings_vb->add_margin_child(TTR("Grid Offset X:"), sb_off_x); SpinBox *sb_off_y = memnew(SpinBox); @@ -1431,7 +1431,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : sb_off_y->set_step(1); sb_off_y->set_value(snap_offset.y); sb_off_y->set_suffix("px"); - sb_off_y->connect("value_changed", this, "_set_snap_off_y"); + sb_off_y->connect_compat("value_changed", this, "_set_snap_off_y"); grid_settings_vb->add_margin_child(TTR("Grid Offset Y:"), sb_off_y); SpinBox *sb_step_x = memnew(SpinBox); @@ -1440,7 +1440,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : sb_step_x->set_step(1); sb_step_x->set_value(snap_step.x); sb_step_x->set_suffix("px"); - sb_step_x->connect("value_changed", this, "_set_snap_step_x"); + sb_step_x->connect_compat("value_changed", this, "_set_snap_step_x"); grid_settings_vb->add_margin_child(TTR("Grid Step X:"), sb_step_x); SpinBox *sb_step_y = memnew(SpinBox); @@ -1449,7 +1449,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : sb_step_y->set_step(1); sb_step_y->set_value(snap_step.y); sb_step_y->set_suffix("px"); - sb_step_y->connect("value_changed", this, "_set_snap_step_y"); + sb_step_y->connect_compat("value_changed", this, "_set_snap_step_y"); grid_settings_vb->add_margin_child(TTR("Grid Step Y:"), sb_step_y); uv_mode_hb->add_child(memnew(VSeparator)); @@ -1469,16 +1469,16 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : uv_zoom->share(uv_zoom_value); uv_zoom_value->set_custom_minimum_size(Size2(50, 0)); uv_mode_hb->add_child(uv_zoom_value); - uv_zoom->connect("value_changed", this, "_uv_scroll_changed"); + uv_zoom->connect_compat("value_changed", this, "_uv_scroll_changed"); uv_vscroll = memnew(VScrollBar); uv_vscroll->set_step(0.001); uv_edit_draw->add_child(uv_vscroll); - uv_vscroll->connect("value_changed", this, "_uv_scroll_changed"); + uv_vscroll->connect_compat("value_changed", this, "_uv_scroll_changed"); uv_hscroll = memnew(HScrollBar); uv_hscroll->set_step(0.001); uv_edit_draw->add_child(uv_hscroll); - uv_hscroll->connect("value_changed", this, "_uv_scroll_changed"); + uv_hscroll->connect_compat("value_changed", this, "_uv_scroll_changed"); bone_scroll_main_vb = memnew(VBoxContainer); bone_scroll_main_vb->hide(); @@ -1486,7 +1486,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : sync_bones = memnew(Button(TTR("Sync Bones to Polygon"))); bone_scroll_main_vb->add_child(sync_bones); sync_bones->set_h_size_flags(0); - sync_bones->connect("pressed", this, "_sync_bones"); + sync_bones->connect_compat("pressed", this, "_sync_bones"); uv_main_hsc->add_child(bone_scroll_main_vb); bone_scroll = memnew(ScrollContainer); bone_scroll->set_v_scroll(true); @@ -1496,8 +1496,8 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : bone_scroll_vb = memnew(VBoxContainer); bone_scroll->add_child(bone_scroll_vb); - uv_edit_draw->connect("draw", this, "_uv_draw"); - uv_edit_draw->connect("gui_input", this, "_uv_input"); + uv_edit_draw->connect_compat("draw", this, "_uv_draw"); + uv_edit_draw->connect_compat("gui_input", this, "_uv_input"); uv_draw_zoom = 1.0; point_drag_index = -1; uv_drag = false; diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp index fb04f50827..12b8ac9008 100644 --- a/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/editor/plugins/resource_preloader_editor_plugin.cpp @@ -382,7 +382,7 @@ ResourcePreloaderEditor::ResourcePreloaderEditor() { add_child(file); tree = memnew(Tree); - tree->connect("button_pressed", this, "_cell_button_pressed"); + tree->connect_compat("button_pressed", this, "_cell_button_pressed"); tree->set_columns(2); tree->set_column_min_width(0, 2); tree->set_column_min_width(1, 3); @@ -396,10 +396,10 @@ ResourcePreloaderEditor::ResourcePreloaderEditor() { dialog = memnew(AcceptDialog); add_child(dialog); - load->connect("pressed", this, "_load_pressed"); - paste->connect("pressed", this, "_paste_pressed"); - file->connect("files_selected", this, "_files_load_request"); - tree->connect("item_edited", this, "_item_edited"); + load->connect_compat("pressed", this, "_load_pressed"); + paste->connect_compat("pressed", this, "_paste_pressed"); + file->connect_compat("files_selected", this, "_files_load_request"); + tree->connect_compat("item_edited", this, "_item_edited"); loading_scene = false; } diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp index 1349de5d8e..132ec40dd2 100644 --- a/editor/plugins/root_motion_editor_plugin.cpp +++ b/editor/plugins/root_motion_editor_plugin.cpp @@ -262,24 +262,24 @@ EditorPropertyRootMotion::EditorPropertyRootMotion() { assign->set_flat(true); assign->set_h_size_flags(SIZE_EXPAND_FILL); assign->set_clip_text(true); - assign->connect("pressed", this, "_node_assign"); + assign->connect_compat("pressed", this, "_node_assign"); hbc->add_child(assign); clear = memnew(Button); clear->set_flat(true); - clear->connect("pressed", this, "_node_clear"); + clear->connect_compat("pressed", this, "_node_clear"); hbc->add_child(clear); filter_dialog = memnew(ConfirmationDialog); add_child(filter_dialog); filter_dialog->set_title(TTR("Edit Filtered Tracks:")); - filter_dialog->connect("confirmed", this, "_confirmed"); + filter_dialog->connect_compat("confirmed", this, "_confirmed"); filters = memnew(Tree); filter_dialog->add_child(filters); filters->set_v_size_flags(SIZE_EXPAND_FILL); filters->set_hide_root(true); - filters->connect("item_activated", this, "_confirmed"); + filters->connect_compat("item_activated", this, "_confirmed"); //filters->connect("item_edited", this, "_filter_edited"); } ////////////////////////// diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index f12be18c21..cea18b63f1 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -210,7 +210,7 @@ void ScriptEditorQuickOpen::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - connect("confirmed", this, "_confirmed"); + connect_compat("confirmed", this, "_confirmed"); search_box->set_clear_button_enabled(true); FALLTHROUGH; @@ -219,7 +219,7 @@ void ScriptEditorQuickOpen::_notification(int p_what) { search_box->set_right_icon(get_icon("Search", "EditorIcons")); } break; case NOTIFICATION_EXIT_TREE: { - disconnect("confirmed", this, "_confirmed"); + disconnect_compat("confirmed", this, "_confirmed"); } break; } } @@ -239,15 +239,15 @@ ScriptEditorQuickOpen::ScriptEditorQuickOpen() { add_child(vbc); search_box = memnew(LineEdit); vbc->add_margin_child(TTR("Search:"), search_box); - search_box->connect("text_changed", this, "_text_changed"); - search_box->connect("gui_input", this, "_sbox_input"); + search_box->connect_compat("text_changed", this, "_text_changed"); + search_box->connect_compat("gui_input", this, "_sbox_input"); search_options = memnew(Tree); vbc->add_margin_child(TTR("Matches:"), search_options, true); get_ok()->set_text(TTR("Open")); get_ok()->set_disabled(true); register_text_enter(search_box); set_hide_on_ok(false); - search_options->connect("item_activated", this, "_confirmed"); + search_options->connect_compat("item_activated", this, "_confirmed"); search_options->set_hide_root(true); search_options->set_hide_folding(true); search_options->add_constant_override("draw_guides", 1); @@ -1439,18 +1439,18 @@ void ScriptEditor::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { - editor->connect("play_pressed", this, "_editor_play"); - editor->connect("pause_pressed", this, "_editor_pause"); - editor->connect("stop_pressed", this, "_editor_stop"); - editor->connect("script_add_function_request", this, "_add_callback"); - editor->connect("resource_saved", this, "_res_saved_callback"); - script_list->connect("item_selected", this, "_script_selected"); + editor->connect_compat("play_pressed", this, "_editor_play"); + editor->connect_compat("pause_pressed", this, "_editor_pause"); + editor->connect_compat("stop_pressed", this, "_editor_stop"); + editor->connect_compat("script_add_function_request", this, "_add_callback"); + editor->connect_compat("resource_saved", this, "_res_saved_callback"); + script_list->connect_compat("item_selected", this, "_script_selected"); - members_overview->connect("item_selected", this, "_members_overview_selected"); - help_overview->connect("item_selected", this, "_help_overview_selected"); - script_split->connect("dragged", this, "_script_split_dragged"); + members_overview->connect_compat("item_selected", this, "_members_overview_selected"); + help_overview->connect_compat("item_selected", this, "_help_overview_selected"); + script_split->connect_compat("dragged", this, "_script_split_dragged"); - EditorSettings::get_singleton()->connect("settings_changed", this, "_editor_settings_changed"); + EditorSettings::get_singleton()->connect_compat("settings_changed", this, "_editor_settings_changed"); FALLTHROUGH; } case NOTIFICATION_THEME_CHANGED: { @@ -1474,16 +1474,16 @@ void ScriptEditor::_notification(int p_what) { case NOTIFICATION_READY: { - get_tree()->connect("tree_changed", this, "_tree_changed"); - editor->get_inspector_dock()->connect("request_help", this, "_request_help"); - editor->connect("request_help_search", this, "_help_search"); + get_tree()->connect_compat("tree_changed", this, "_tree_changed"); + editor->get_inspector_dock()->connect_compat("request_help", this, "_request_help"); + editor->connect_compat("request_help_search", this, "_help_search"); } break; case NOTIFICATION_EXIT_TREE: { - editor->disconnect("play_pressed", this, "_editor_play"); - editor->disconnect("pause_pressed", this, "_editor_pause"); - editor->disconnect("stop_pressed", this, "_editor_stop"); + editor->disconnect_compat("play_pressed", this, "_editor_play"); + editor->disconnect_compat("pause_pressed", this, "_editor_pause"); + editor->disconnect_compat("stop_pressed", this, "_editor_stop"); } break; case MainLoop::NOTIFICATION_WM_FOCUS_IN: { @@ -2194,14 +2194,14 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra _sort_list_on_update = true; _update_script_names(); _save_layout(); - se->connect("name_changed", this, "_update_script_names"); - se->connect("edited_script_changed", this, "_script_changed"); - se->connect("request_help", this, "_help_search"); - se->connect("request_open_script_at_line", this, "_goto_script_line"); - se->connect("go_to_help", this, "_help_class_goto"); - se->connect("request_save_history", this, "_save_history"); - se->connect("search_in_files_requested", this, "_on_find_in_files_requested"); - se->connect("replace_in_files_requested", this, "_on_replace_in_files_requested"); + se->connect_compat("name_changed", this, "_update_script_names"); + se->connect_compat("edited_script_changed", this, "_script_changed"); + se->connect_compat("request_help", this, "_help_search"); + se->connect_compat("request_open_script_at_line", this, "_goto_script_line"); + se->connect_compat("go_to_help", this, "_help_class_goto"); + se->connect_compat("request_save_history", this, "_save_history"); + se->connect_compat("search_in_files_requested", this, "_on_find_in_files_requested"); + se->connect_compat("replace_in_files_requested", this, "_on_replace_in_files_requested"); //test for modification, maybe the script was not edited but was loaded @@ -2813,7 +2813,7 @@ void ScriptEditor::_help_class_open(const String &p_class) { tab_container->add_child(eh); _go_to_tab(tab_container->get_tab_count() - 1); eh->go_to_class(p_class, 0); - eh->connect("go_to_help", this, "_help_class_goto"); + eh->connect_compat("go_to_help", this, "_help_class_goto"); _add_recent_script(p_class); _sort_list_on_update = true; _update_script_names(); @@ -2843,7 +2843,7 @@ void ScriptEditor::_help_class_goto(const String &p_desc) { tab_container->add_child(eh); _go_to_tab(tab_container->get_tab_count() - 1); eh->go_to_help(p_desc); - eh->connect("go_to_help", this, "_help_class_goto"); + eh->connect_compat("go_to_help", this, "_help_class_goto"); _add_recent_script(eh->get_class()); _sort_list_on_update = true; _update_script_names(); @@ -3221,7 +3221,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { filter_scripts = memnew(LineEdit); filter_scripts->set_placeholder(TTR("Filter scripts")); filter_scripts->set_clear_button_enabled(true); - filter_scripts->connect("text_changed", this, "_filter_scripts_text_changed"); + filter_scripts->connect_compat("text_changed", this, "_filter_scripts_text_changed"); scripts_vbox->add_child(filter_scripts); script_list = memnew(ItemList); @@ -3230,13 +3230,13 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { script_list->set_v_size_flags(SIZE_EXPAND_FILL); script_split->set_split_offset(140); _sort_list_on_update = true; - script_list->connect("gui_input", this, "_script_list_gui_input", varray(), CONNECT_DEFERRED); + script_list->connect_compat("gui_input", this, "_script_list_gui_input", varray(), CONNECT_DEFERRED); script_list->set_allow_rmb_select(true); script_list->set_drag_forwarding(this); context_menu = memnew(PopupMenu); add_child(context_menu); - context_menu->connect("id_pressed", this, "_menu_option"); + context_menu->connect_compat("id_pressed", this, "_menu_option"); context_menu->set_hide_on_window_lose_focus(true); overview_vbox = memnew(VBoxContainer); @@ -3257,14 +3257,14 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { members_overview_alphabeta_sort_button->set_tooltip(TTR("Toggle alphabetical sorting of the method list.")); members_overview_alphabeta_sort_button->set_toggle_mode(true); members_overview_alphabeta_sort_button->set_pressed(EditorSettings::get_singleton()->get("text_editor/tools/sort_members_outline_alphabetically")); - members_overview_alphabeta_sort_button->connect("toggled", this, "_toggle_members_overview_alpha_sort"); + members_overview_alphabeta_sort_button->connect_compat("toggled", this, "_toggle_members_overview_alpha_sort"); buttons_hbox->add_child(members_overview_alphabeta_sort_button); filter_methods = memnew(LineEdit); filter_methods->set_placeholder(TTR("Filter methods")); filter_methods->set_clear_button_enabled(true); - filter_methods->connect("text_changed", this, "_filter_methods_text_changed"); + filter_methods->connect_compat("text_changed", this, "_filter_methods_text_changed"); overview_vbox->add_child(filter_methods); members_overview = memnew(ItemList); @@ -3308,7 +3308,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { recent_scripts = memnew(PopupMenu); recent_scripts->set_name("RecentScripts"); file_menu->get_popup()->add_child(recent_scripts); - recent_scripts->connect("id_pressed", this, "_open_recent_script"); + recent_scripts->connect_compat("id_pressed", this, "_open_recent_script"); _update_recent_scripts(); file_menu->get_popup()->add_separator(); @@ -3330,7 +3330,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { theme_submenu = memnew(PopupMenu); theme_submenu->set_name("Theme"); file_menu->get_popup()->add_child(theme_submenu); - theme_submenu->connect("id_pressed", this, "_theme_option"); + theme_submenu->connect_compat("id_pressed", this, "_theme_option"); theme_submenu->add_shortcut(ED_SHORTCUT("script_editor/import_theme", TTR("Import Theme...")), THEME_IMPORT); theme_submenu->add_shortcut(ED_SHORTCUT("script_editor/reload_theme", TTR("Reload Theme")), THEME_RELOAD); @@ -3349,14 +3349,14 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { file_menu->get_popup()->add_separator(); file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/toggle_scripts_panel", TTR("Toggle Scripts Panel"), KEY_MASK_CMD | KEY_BACKSLASH), TOGGLE_SCRIPTS_PANEL); - file_menu->get_popup()->connect("id_pressed", this, "_menu_option"); + file_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option"); script_search_menu = memnew(MenuButton); menu_hb->add_child(script_search_menu); script_search_menu->set_text(TTR("Search")); script_search_menu->set_switch_on_hover(true); script_search_menu->get_popup()->set_hide_on_window_lose_focus(true); - script_search_menu->get_popup()->connect("id_pressed", this, "_menu_option"); + script_search_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option"); debug_menu = memnew(MenuButton); menu_hb->add_child(debug_menu); @@ -3372,7 +3372,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { //debug_menu->get_popup()->add_check_item("Show Debugger",DEBUG_SHOW); debug_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("debugger/keep_debugger_open", TTR("Keep Debugger Open")), DEBUG_SHOW_KEEP_OPEN); debug_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("debugger/debug_with_external_editor", TTR("Debug with External Editor")), DEBUG_WITH_EXTERNAL_EDITOR); - debug_menu->get_popup()->connect("id_pressed", this, "_menu_option"); + debug_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option"); debug_menu->get_popup()->set_item_disabled(debug_menu->get_popup()->get_item_index(DEBUG_NEXT), true); debug_menu->get_popup()->set_item_disabled(debug_menu->get_popup()->get_item_index(DEBUG_STEP), true); @@ -3393,63 +3393,63 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { site_search = memnew(ToolButton); site_search->set_text(TTR("Online Docs")); - site_search->connect("pressed", this, "_menu_option", varray(SEARCH_WEBSITE)); + site_search->connect_compat("pressed", this, "_menu_option", varray(SEARCH_WEBSITE)); menu_hb->add_child(site_search); site_search->set_tooltip(TTR("Open Godot online documentation.")); request_docs = memnew(ToolButton); request_docs->set_text(TTR("Request Docs")); - request_docs->connect("pressed", this, "_menu_option", varray(REQUEST_DOCS)); + request_docs->connect_compat("pressed", this, "_menu_option", varray(REQUEST_DOCS)); menu_hb->add_child(request_docs); request_docs->set_tooltip(TTR("Help improve the Godot documentation by giving feedback.")); help_search = memnew(ToolButton); help_search->set_text(TTR("Search Help")); - help_search->connect("pressed", this, "_menu_option", varray(SEARCH_HELP)); + help_search->connect_compat("pressed", this, "_menu_option", varray(SEARCH_HELP)); menu_hb->add_child(help_search); help_search->set_tooltip(TTR("Search the reference documentation.")); menu_hb->add_child(memnew(VSeparator)); script_back = memnew(ToolButton); - script_back->connect("pressed", this, "_history_back"); + script_back->connect_compat("pressed", this, "_history_back"); menu_hb->add_child(script_back); script_back->set_disabled(true); script_back->set_tooltip(TTR("Go to previous edited document.")); script_forward = memnew(ToolButton); - script_forward->connect("pressed", this, "_history_forward"); + script_forward->connect_compat("pressed", this, "_history_forward"); menu_hb->add_child(script_forward); script_forward->set_disabled(true); script_forward->set_tooltip(TTR("Go to next edited document.")); - tab_container->connect("tab_changed", this, "_tab_changed"); + tab_container->connect_compat("tab_changed", this, "_tab_changed"); erase_tab_confirm = memnew(ConfirmationDialog); erase_tab_confirm->get_ok()->set_text(TTR("Save")); erase_tab_confirm->add_button(TTR("Discard"), OS::get_singleton()->get_swap_ok_cancel(), "discard"); - erase_tab_confirm->connect("confirmed", this, "_close_current_tab"); - erase_tab_confirm->connect("custom_action", this, "_close_discard_current_tab"); + erase_tab_confirm->connect_compat("confirmed", this, "_close_current_tab"); + erase_tab_confirm->connect_compat("custom_action", this, "_close_discard_current_tab"); add_child(erase_tab_confirm); script_create_dialog = memnew(ScriptCreateDialog); script_create_dialog->set_title(TTR("Create Script")); add_child(script_create_dialog); - script_create_dialog->connect("script_created", this, "_script_created"); + script_create_dialog->connect_compat("script_created", this, "_script_created"); file_dialog_option = -1; file_dialog = memnew(EditorFileDialog); add_child(file_dialog); - file_dialog->connect("file_selected", this, "_file_dialog_action"); + file_dialog->connect_compat("file_selected", this, "_file_dialog_action"); error_dialog = memnew(AcceptDialog); add_child(error_dialog); debugger = memnew(ScriptEditorDebugger(editor)); - debugger->connect("goto_script_line", this, "_goto_script_line"); - debugger->connect("set_execution", this, "_set_execution"); - debugger->connect("clear_execution", this, "_clear_execution"); - debugger->connect("show_debugger", this, "_show_debugger"); + debugger->connect_compat("goto_script_line", this, "_goto_script_line"); + debugger->connect_compat("set_execution", this, "_set_execution"); + debugger->connect_compat("clear_execution", this, "_clear_execution"); + debugger->connect_compat("show_debugger", this, "_show_debugger"); disk_changed = memnew(ConfirmationDialog); { @@ -3464,11 +3464,11 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { vbc->add_child(disk_changed_list); disk_changed_list->set_v_size_flags(SIZE_EXPAND_FILL); - disk_changed->connect("confirmed", this, "_reload_scripts"); + disk_changed->connect_compat("confirmed", this, "_reload_scripts"); disk_changed->get_ok()->set_text(TTR("Reload")); disk_changed->add_button(TTR("Resave"), !OS::get_singleton()->get_swap_ok_cancel(), "resave"); - disk_changed->connect("custom_action", this, "_resave_scripts"); + disk_changed->connect_compat("custom_action", this, "_resave_scripts"); } add_child(disk_changed); @@ -3478,29 +3478,29 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { Button *db = EditorNode::get_singleton()->add_bottom_panel_item(TTR("Debugger"), debugger); debugger->set_tool_button(db); - debugger->connect("breaked", this, "_breaked"); + debugger->connect_compat("breaked", this, "_breaked"); autosave_timer = memnew(Timer); autosave_timer->set_one_shot(false); - autosave_timer->connect(SceneStringNames::get_singleton()->tree_entered, this, "_update_autosave_timer"); - autosave_timer->connect("timeout", this, "_autosave_scripts"); + autosave_timer->connect_compat(SceneStringNames::get_singleton()->tree_entered, this, "_update_autosave_timer"); + autosave_timer->connect_compat("timeout", this, "_autosave_scripts"); add_child(autosave_timer); grab_focus_block = false; help_search_dialog = memnew(EditorHelpSearch); add_child(help_search_dialog); - help_search_dialog->connect("go_to_help", this, "_help_class_goto"); + help_search_dialog->connect_compat("go_to_help", this, "_help_class_goto"); find_in_files_dialog = memnew(FindInFilesDialog); - find_in_files_dialog->connect(FindInFilesDialog::SIGNAL_FIND_REQUESTED, this, "_start_find_in_files", varray(false)); - find_in_files_dialog->connect(FindInFilesDialog::SIGNAL_REPLACE_REQUESTED, this, "_start_find_in_files", varray(true)); + find_in_files_dialog->connect_compat(FindInFilesDialog::SIGNAL_FIND_REQUESTED, this, "_start_find_in_files", varray(false)); + find_in_files_dialog->connect_compat(FindInFilesDialog::SIGNAL_REPLACE_REQUESTED, this, "_start_find_in_files", varray(true)); add_child(find_in_files_dialog); find_in_files = memnew(FindInFilesPanel); find_in_files_button = editor->add_bottom_panel_item(TTR("Search Results"), find_in_files); find_in_files->set_custom_minimum_size(Size2(0, 200) * EDSCALE); - find_in_files->connect(FindInFilesPanel::SIGNAL_RESULT_SELECTED, this, "_on_find_in_files_result_selected"); - find_in_files->connect(FindInFilesPanel::SIGNAL_FILES_MODIFIED, this, "_on_find_in_files_modified_files"); + find_in_files->connect_compat(FindInFilesPanel::SIGNAL_RESULT_SELECTED, this, "_on_find_in_files_result_selected"); + find_in_files->connect_compat(FindInFilesPanel::SIGNAL_FILES_MODIFIED, this, "_on_find_in_files_modified_files"); find_in_files->hide(); find_in_files_button->hide(); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 9f1e2f0353..2069c035fb 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -53,24 +53,24 @@ void ConnectionInfoDialog::popup_connections(String p_method, Vector<Node *> p_n for (List<Connection>::Element *E = all_connections.front(); E; E = E->next()) { Connection connection = E->get(); - if (connection.method != p_method) { + if (connection.callable.get_method() != p_method) { continue; } TreeItem *node_item = tree->create_item(root); - node_item->set_text(0, Object::cast_to<Node>(connection.source)->get_name()); - node_item->set_icon(0, EditorNode::get_singleton()->get_object_icon(connection.source, "Node")); + node_item->set_text(0, Object::cast_to<Node>(connection.signal.get_object())->get_name()); + node_item->set_icon(0, EditorNode::get_singleton()->get_object_icon(connection.signal.get_object(), "Node")); node_item->set_selectable(0, false); node_item->set_editable(0, false); - node_item->set_text(1, connection.signal); + node_item->set_text(1, connection.signal.get_name()); node_item->set_icon(1, get_parent_control()->get_icon("Slot", "EditorIcons")); node_item->set_selectable(1, false); node_item->set_editable(1, false); - node_item->set_text(2, Object::cast_to<Node>(connection.target)->get_name()); - node_item->set_icon(2, EditorNode::get_singleton()->get_object_icon(connection.target, "Node")); + node_item->set_text(2, Object::cast_to<Node>(connection.callable.get_object())->get_name()); + node_item->set_icon(2, EditorNode::get_singleton()->get_object_icon(connection.callable.get_object(), "Node")); node_item->set_selectable(2, false); node_item->set_editable(2, false); } @@ -603,12 +603,12 @@ void ScriptTextEditor::_validate_script() { Connection connection = E->get(); String base_path = base->get_name(); - String source_path = base == connection.source ? base_path : base_path + "/" + base->get_path_to(Object::cast_to<Node>(connection.source)); - String target_path = base == connection.target ? base_path : base_path + "/" + base->get_path_to(Object::cast_to<Node>(connection.target)); + String source_path = base == connection.signal.get_object() ? base_path : base_path + "/" + base->get_path_to(Object::cast_to<Node>(connection.signal.get_object())); + String target_path = base == connection.callable.get_object() ? base_path : base_path + "/" + base->get_path_to(Object::cast_to<Node>(connection.callable.get_object())); warnings_panel->push_cell(); warnings_panel->push_color(warnings_panel->get_color("warning_color", "Editor")); - warnings_panel->add_text(vformat(TTR("Missing connected method '%s' for signal '%s' from node '%s' to node '%s'."), connection.method, connection.signal, source_path, target_path)); + warnings_panel->add_text(vformat(TTR("Missing connected method '%s' for signal '%s' from node '%s' to node '%s'."), connection.callable.get_method(), connection.signal.get_name(), source_path, target_path)); warnings_panel->pop(); // Color. warnings_panel->pop(); // Cell. } @@ -1006,24 +1006,24 @@ void ScriptTextEditor::_update_connected_methods() { } // As deleted nodes are still accessible via the undo/redo system, check if they're still on the tree. - Node *source = Object::cast_to<Node>(connection.source); + Node *source = Object::cast_to<Node>(connection.signal.get_object()); if (source && !source->is_inside_tree()) { continue; } - if (methods_found.has(connection.method)) { + if (methods_found.has(connection.callable.get_method())) { continue; } - if (!ClassDB::has_method(script->get_instance_base_type(), connection.method)) { + if (!ClassDB::has_method(script->get_instance_base_type(), connection.callable.get_method())) { int line = -1; for (int j = 0; j < functions.size(); j++) { String name = functions[j].get_slice(":", 0); - if (name == connection.method) { + if (name == connection.callable.get_method()) { line = functions[j].get_slice(":", 1).to_int(); - text_edit->set_line_info_icon(line - 1, get_parent_control()->get_icon("Slot", "EditorIcons"), connection.method); - methods_found.insert(connection.method); + text_edit->set_line_info_icon(line - 1, get_parent_control()->get_icon("Slot", "EditorIcons"), connection.callable.get_method()); + methods_found.insert(connection.callable.get_method()); break; } } @@ -1036,7 +1036,7 @@ void ScriptTextEditor::_update_connected_methods() { bool found_inherited_function = false; Ref<Script> inherited_script = script->get_base_script(); while (!inherited_script.is_null()) { - if (inherited_script->has_method(connection.method)) { + if (inherited_script->has_method(connection.callable.get_method())) { found_inherited_function = true; break; } @@ -1774,12 +1774,12 @@ ScriptTextEditor::ScriptTextEditor() { editor_box->add_child(code_editor); code_editor->add_constant_override("separation", 2); code_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE); - code_editor->connect("validate_script", this, "_validate_script"); - code_editor->connect("load_theme_settings", this, "_load_theme_settings"); + code_editor->connect_compat("validate_script", this, "_validate_script"); + code_editor->connect_compat("load_theme_settings", this, "_load_theme_settings"); code_editor->set_code_complete_func(_code_complete_scripts, this); - code_editor->get_text_edit()->connect("breakpoint_toggled", this, "_breakpoint_toggled"); - code_editor->get_text_edit()->connect("symbol_lookup", this, "_lookup_symbol"); - code_editor->get_text_edit()->connect("info_clicked", this, "_lookup_connections"); + code_editor->get_text_edit()->connect_compat("breakpoint_toggled", this, "_breakpoint_toggled"); + code_editor->get_text_edit()->connect_compat("symbol_lookup", this, "_lookup_symbol"); + code_editor->get_text_edit()->connect_compat("info_clicked", this, "_lookup_connections"); code_editor->set_v_size_flags(SIZE_EXPAND_FILL); code_editor->show_toggle_scripts_button(); @@ -1792,9 +1792,9 @@ ScriptTextEditor::ScriptTextEditor() { warnings_panel->set_focus_mode(FOCUS_CLICK); warnings_panel->hide(); - code_editor->connect("error_pressed", this, "_error_pressed"); - code_editor->connect("show_warnings_panel", this, "_show_warnings_panel"); - warnings_panel->connect("meta_clicked", this, "_warning_clicked"); + code_editor->connect_compat("error_pressed", this, "_error_pressed"); + code_editor->connect_compat("show_warnings_panel", this, "_show_warnings_panel"); + warnings_panel->connect_compat("meta_clicked", this, "_warning_clicked"); update_settings(); @@ -1804,11 +1804,11 @@ ScriptTextEditor::ScriptTextEditor() { code_editor->get_text_edit()->set_select_identifiers_on_hover(true); code_editor->get_text_edit()->set_context_menu_enabled(false); - code_editor->get_text_edit()->connect("gui_input", this, "_text_edit_gui_input"); + code_editor->get_text_edit()->connect_compat("gui_input", this, "_text_edit_gui_input"); context_menu = memnew(PopupMenu); add_child(context_menu); - context_menu->connect("id_pressed", this, "_edit_option"); + context_menu->connect_compat("id_pressed", this, "_edit_option"); context_menu->set_hide_on_window_lose_focus(true); color_panel = memnew(PopupPanel); @@ -1816,7 +1816,7 @@ ScriptTextEditor::ScriptTextEditor() { color_picker = memnew(ColorPicker); color_picker->set_deferred_mode(true); color_panel->add_child(color_picker); - color_picker->connect("color_changed", this, "_color_changed"); + color_picker->connect_compat("color_changed", this, "_color_changed"); // get default color picker mode from editor settings int default_color_mode = EDITOR_GET("interface/inspector/default_color_picker_mode"); @@ -1857,7 +1857,7 @@ ScriptTextEditor::ScriptTextEditor() { edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_indent_to_spaces"), EDIT_CONVERT_INDENT_TO_SPACES); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_indent_to_tabs"), EDIT_CONVERT_INDENT_TO_TABS); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/auto_indent"), EDIT_AUTO_INDENT); - edit_menu->get_popup()->connect("id_pressed", this, "_edit_option"); + edit_menu->get_popup()->connect_compat("id_pressed", this, "_edit_option"); edit_menu->get_popup()->add_separator(); PopupMenu *convert_case = memnew(PopupMenu); @@ -1867,7 +1867,7 @@ ScriptTextEditor::ScriptTextEditor() { convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_uppercase", TTR("Uppercase"), KEY_MASK_SHIFT | KEY_F4), EDIT_TO_UPPERCASE); convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_lowercase", TTR("Lowercase"), KEY_MASK_SHIFT | KEY_F5), EDIT_TO_LOWERCASE); convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize"), KEY_MASK_SHIFT | KEY_F6), EDIT_CAPITALIZE); - convert_case->connect("id_pressed", this, "_edit_option"); + convert_case->connect_compat("id_pressed", this, "_edit_option"); highlighters[TTR("Standard")] = NULL; highlighter_menu = memnew(PopupMenu); @@ -1875,7 +1875,7 @@ ScriptTextEditor::ScriptTextEditor() { edit_menu->get_popup()->add_child(highlighter_menu); edit_menu->get_popup()->add_submenu_item(TTR("Syntax Highlighter"), "highlighter_menu"); highlighter_menu->add_radio_check_item(TTR("Standard")); - highlighter_menu->connect("id_pressed", this, "_change_syntax_highlighter"); + highlighter_menu->connect_compat("id_pressed", this, "_change_syntax_highlighter"); search_menu = memnew(MenuButton); edit_hb->add_child(search_menu); @@ -1891,7 +1891,7 @@ ScriptTextEditor::ScriptTextEditor() { search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/replace_in_files"), REPLACE_IN_FILES); search_menu->get_popup()->add_separator(); search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/contextual_help"), HELP_CONTEXTUAL); - search_menu->get_popup()->connect("id_pressed", this, "_edit_option"); + search_menu->get_popup()->connect_compat("id_pressed", this, "_edit_option"); edit_hb->add_child(edit_menu); @@ -1899,7 +1899,7 @@ ScriptTextEditor::ScriptTextEditor() { edit_hb->add_child(goto_menu); goto_menu->set_text(TTR("Go To")); goto_menu->set_switch_on_hover(true); - goto_menu->get_popup()->connect("id_pressed", this, "_edit_option"); + goto_menu->get_popup()->connect_compat("id_pressed", this, "_edit_option"); goto_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_function"), SEARCH_LOCATE_FUNCTION); goto_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_line"), SEARCH_GOTO_LINE); @@ -1910,20 +1910,20 @@ ScriptTextEditor::ScriptTextEditor() { goto_menu->get_popup()->add_child(bookmarks_menu); goto_menu->get_popup()->add_submenu_item(TTR("Bookmarks"), "Bookmarks"); _update_bookmark_list(); - bookmarks_menu->connect("about_to_show", this, "_update_bookmark_list"); - bookmarks_menu->connect("index_pressed", this, "_bookmark_item_pressed"); + bookmarks_menu->connect_compat("about_to_show", this, "_update_bookmark_list"); + bookmarks_menu->connect_compat("index_pressed", this, "_bookmark_item_pressed"); breakpoints_menu = memnew(PopupMenu); breakpoints_menu->set_name("Breakpoints"); goto_menu->get_popup()->add_child(breakpoints_menu); goto_menu->get_popup()->add_submenu_item(TTR("Breakpoints"), "Breakpoints"); _update_breakpoint_list(); - breakpoints_menu->connect("about_to_show", this, "_update_breakpoint_list"); - breakpoints_menu->connect("index_pressed", this, "_breakpoint_item_pressed"); + breakpoints_menu->connect_compat("about_to_show", this, "_update_breakpoint_list"); + breakpoints_menu->connect_compat("index_pressed", this, "_breakpoint_item_pressed"); quick_open = memnew(ScriptEditorQuickOpen); add_child(quick_open); - quick_open->connect("goto_line", this, "_goto_line"); + quick_open->connect_compat("goto_line", this, "_goto_line"); goto_line_dialog = memnew(GotoLineDialog); add_child(goto_line_dialog); diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index a19f0b4975..6c20483cf6 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -607,8 +607,8 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) { shader_editor->add_constant_override("separation", 0); shader_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE); - shader_editor->connect("script_changed", this, "apply_shaders"); - EditorSettings::get_singleton()->connect("settings_changed", this, "_editor_settings_changed"); + shader_editor->connect_compat("script_changed", this, "apply_shaders"); + EditorSettings::get_singleton()->connect_compat("settings_changed", this, "_editor_settings_changed"); shader_editor->get_text_edit()->set_callhint_settings( EditorSettings::get_singleton()->get("text_editor/completion/put_callhint_tooltip_below_current_line"), @@ -616,13 +616,13 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) { shader_editor->get_text_edit()->set_select_identifiers_on_hover(true); shader_editor->get_text_edit()->set_context_menu_enabled(false); - shader_editor->get_text_edit()->connect("gui_input", this, "_text_edit_gui_input"); + shader_editor->get_text_edit()->connect_compat("gui_input", this, "_text_edit_gui_input"); shader_editor->update_editor_settings(); context_menu = memnew(PopupMenu); add_child(context_menu); - context_menu->connect("id_pressed", this, "_menu_option"); + context_menu->connect_compat("id_pressed", this, "_menu_option"); context_menu->set_hide_on_window_lose_focus(true); VBoxContainer *main_container = memnew(VBoxContainer); @@ -650,7 +650,7 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) { edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/clone_down"), EDIT_CLONE_DOWN); edit_menu->get_popup()->add_separator(); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/complete_symbol"), EDIT_COMPLETE); - edit_menu->get_popup()->connect("id_pressed", this, "_menu_option"); + edit_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option"); search_menu = memnew(MenuButton); search_menu->set_text(TTR("Search")); @@ -660,12 +660,12 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) { search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_next"), SEARCH_FIND_NEXT); search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_previous"), SEARCH_FIND_PREV); search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/replace"), SEARCH_REPLACE); - search_menu->get_popup()->connect("id_pressed", this, "_menu_option"); + search_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option"); MenuButton *goto_menu = memnew(MenuButton); goto_menu->set_text(TTR("Go To")); goto_menu->set_switch_on_hover(true); - goto_menu->get_popup()->connect("id_pressed", this, "_menu_option"); + goto_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option"); goto_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_line"), SEARCH_GOTO_LINE); goto_menu->get_popup()->add_separator(); @@ -675,14 +675,14 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) { goto_menu->get_popup()->add_child(bookmarks_menu); goto_menu->get_popup()->add_submenu_item(TTR("Bookmarks"), "Bookmarks"); _update_bookmark_list(); - bookmarks_menu->connect("about_to_show", this, "_update_bookmark_list"); - bookmarks_menu->connect("index_pressed", this, "_bookmark_item_pressed"); + bookmarks_menu->connect_compat("about_to_show", this, "_update_bookmark_list"); + bookmarks_menu->connect_compat("index_pressed", this, "_bookmark_item_pressed"); help_menu = memnew(MenuButton); help_menu->set_text(TTR("Help")); help_menu->set_switch_on_hover(true); help_menu->get_popup()->add_icon_item(p_node->get_gui_base()->get_icon("Instance", "EditorIcons"), TTR("Online Docs"), HELP_DOCS); - help_menu->get_popup()->connect("id_pressed", this, "_menu_option"); + help_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option"); add_child(main_container); main_container->add_child(hbc); @@ -705,11 +705,11 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) { dl->set_text(TTR("This shader has been modified on on disk.\nWhat action should be taken?")); vbc->add_child(dl); - disk_changed->connect("confirmed", this, "_reload_shader_from_disk"); + disk_changed->connect_compat("confirmed", this, "_reload_shader_from_disk"); disk_changed->get_ok()->set_text(TTR("Reload")); disk_changed->add_button(TTR("Resave"), !OS::get_singleton()->get_swap_ok_cancel(), "resave"); - disk_changed->connect("custom_action", this, "save_external_data"); + disk_changed->connect_compat("custom_action", this, "save_external_data"); add_child(disk_changed); diff --git a/editor/plugins/skeleton_2d_editor_plugin.cpp b/editor/plugins/skeleton_2d_editor_plugin.cpp index dbe64f202d..d83a8ddf2d 100644 --- a/editor/plugins/skeleton_2d_editor_plugin.cpp +++ b/editor/plugins/skeleton_2d_editor_plugin.cpp @@ -110,7 +110,7 @@ Skeleton2DEditor::Skeleton2DEditor() { options->get_popup()->add_item(TTR("Set Bones to Rest Pose"), MENU_OPTION_SET_REST); options->set_switch_on_hover(true); - options->get_popup()->connect("id_pressed", this, "_menu_option"); + options->get_popup()->connect_compat("id_pressed", this, "_menu_option"); err_dialog = memnew(AcceptDialog); add_child(err_dialog); diff --git a/editor/plugins/skeleton_editor_plugin.cpp b/editor/plugins/skeleton_editor_plugin.cpp index 9101c64eab..43ba99317e 100644 --- a/editor/plugins/skeleton_editor_plugin.cpp +++ b/editor/plugins/skeleton_editor_plugin.cpp @@ -137,7 +137,7 @@ void SkeletonEditor::edit(Skeleton *p_node) { void SkeletonEditor::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - get_tree()->connect("node_removed", this, "_node_removed"); + get_tree()->connect_compat("node_removed", this, "_node_removed"); } } @@ -164,7 +164,7 @@ SkeletonEditor::SkeletonEditor() { options->get_popup()->add_item(TTR("Create physical skeleton"), MENU_OPTION_CREATE_PHYSICAL_SKELETON); - options->get_popup()->connect("id_pressed", this, "_on_click_option"); + options->get_popup()->connect_compat("id_pressed", this, "_on_click_option"); options->hide(); } diff --git a/editor/plugins/skeleton_ik_editor_plugin.cpp b/editor/plugins/skeleton_ik_editor_plugin.cpp index eb6ad9498d..a09dcca279 100644 --- a/editor/plugins/skeleton_ik_editor_plugin.cpp +++ b/editor/plugins/skeleton_ik_editor_plugin.cpp @@ -93,7 +93,7 @@ SkeletonIKEditorPlugin::SkeletonIKEditorPlugin(EditorNode *p_node) { play_btn->set_text(TTR("Play IK")); play_btn->set_toggle_mode(true); play_btn->hide(); - play_btn->connect("pressed", this, "_play"); + play_btn->connect_compat("pressed", this, "_play"); add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, play_btn); skeleton_ik = NULL; } diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index b890bc2fb8..45f2a5063c 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -2187,10 +2187,10 @@ void SpatialEditorViewport::_notification(int p_what) { if (cam != NULL && cam != previewing) { //then switch the viewport's camera to the scene's viewport camera if (previewing != NULL) { - previewing->disconnect("tree_exited", this, "_preview_exited_scene"); + previewing->disconnect_compat("tree_exited", this, "_preview_exited_scene"); } previewing = cam; - previewing->connect("tree_exited", this, "_preview_exited_scene"); + previewing->connect_compat("tree_exited", this, "_preview_exited_scene"); VS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), cam->get_camera()); surface->update(); } @@ -2331,12 +2331,12 @@ void SpatialEditorViewport::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - surface->connect("draw", this, "_draw"); - surface->connect("gui_input", this, "_sinput"); - surface->connect("mouse_entered", this, "_surface_mouse_enter"); - surface->connect("mouse_exited", this, "_surface_mouse_exit"); - surface->connect("focus_entered", this, "_surface_focus_enter"); - surface->connect("focus_exited", this, "_surface_focus_exit"); + surface->connect_compat("draw", this, "_draw"); + surface->connect_compat("gui_input", this, "_sinput"); + surface->connect_compat("mouse_entered", this, "_surface_mouse_enter"); + surface->connect_compat("mouse_exited", this, "_surface_mouse_exit"); + surface->connect_compat("focus_entered", this, "_surface_focus_enter"); + surface->connect_compat("focus_exited", this, "_surface_focus_exit"); _init_gizmo_instance(index); } @@ -2837,10 +2837,10 @@ void SpatialEditorViewport::_menu_option(int p_option) { void SpatialEditorViewport::_preview_exited_scene() { - preview_camera->disconnect("toggled", this, "_toggle_camera_preview"); + preview_camera->disconnect_compat("toggled", this, "_toggle_camera_preview"); preview_camera->set_pressed(false); _toggle_camera_preview(false); - preview_camera->connect("toggled", this, "_toggle_camera_preview"); + preview_camera->connect_compat("toggled", this, "_toggle_camera_preview"); view_menu->show(); } @@ -2903,7 +2903,7 @@ void SpatialEditorViewport::_toggle_camera_preview(bool p_activate) { if (!p_activate) { - previewing->disconnect("tree_exiting", this, "_preview_exited_scene"); + previewing->disconnect_compat("tree_exiting", this, "_preview_exited_scene"); previewing = NULL; VS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), camera->get_camera()); //restore if (!preview) @@ -2914,7 +2914,7 @@ void SpatialEditorViewport::_toggle_camera_preview(bool p_activate) { } else { previewing = preview; - previewing->connect("tree_exiting", this, "_preview_exited_scene"); + previewing->connect_compat("tree_exiting", this, "_preview_exited_scene"); VS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), preview->get_camera()); //replace view_menu->set_disabled(true); surface->update(); @@ -2925,7 +2925,7 @@ void SpatialEditorViewport::_toggle_cinema_preview(bool p_activate) { previewing_cinema = p_activate; if (!previewing_cinema) { if (previewing != NULL) - previewing->disconnect("tree_exited", this, "_preview_exited_scene"); + previewing->disconnect_compat("tree_exited", this, "_preview_exited_scene"); previewing = NULL; VS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), camera->get_camera()); //restore @@ -3110,14 +3110,14 @@ void SpatialEditorViewport::set_state(const Dictionary &p_state) { view_menu->get_popup()->set_item_checked(idx, previewing_cinema); } - if (preview_camera->is_connected("toggled", this, "_toggle_camera_preview")) { - preview_camera->disconnect("toggled", this, "_toggle_camera_preview"); + if (preview_camera->is_connected_compat("toggled", this, "_toggle_camera_preview")) { + preview_camera->disconnect_compat("toggled", this, "_toggle_camera_preview"); } if (p_state.has("previewing")) { Node *pv = EditorNode::get_singleton()->get_edited_scene()->get_node(p_state["previewing"]); if (Object::cast_to<Camera>(pv)) { previewing = Object::cast_to<Camera>(pv); - previewing->connect("tree_exiting", this, "_preview_exited_scene"); + previewing->connect_compat("tree_exiting", this, "_preview_exited_scene"); VS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), previewing->get_camera()); //replace view_menu->set_disabled(true); surface->update(); @@ -3125,7 +3125,7 @@ void SpatialEditorViewport::set_state(const Dictionary &p_state) { preview_camera->show(); } } - preview_camera->connect("toggled", this, "_toggle_camera_preview"); + preview_camera->connect_compat("toggled", this, "_toggle_camera_preview"); } Dictionary SpatialEditorViewport::get_state() const { @@ -3684,8 +3684,8 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/focus_selection"), VIEW_CENTER_TO_SELECTION); view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/align_transform_with_view"), VIEW_ALIGN_TRANSFORM_WITH_VIEW); view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/align_rotation_with_view"), VIEW_ALIGN_ROTATION_WITH_VIEW); - view_menu->get_popup()->connect("id_pressed", this, "_menu_option"); - display_submenu->connect("id_pressed", this, "_menu_option"); + view_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option"); + display_submenu->connect_compat("id_pressed", this, "_menu_option"); view_menu->set_disable_shortcuts(true); if (OS::get_singleton()->get_current_video_driver() == OS::VIDEO_DRIVER_GLES2) { @@ -3720,7 +3720,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed vbox->add_child(preview_camera); preview_camera->set_h_size_flags(0); preview_camera->hide(); - preview_camera->connect("toggled", this, "_toggle_camera_preview"); + preview_camera->connect_compat("toggled", this, "_toggle_camera_preview"); previewing = NULL; gizmo_scale = 1.0; @@ -3773,8 +3773,8 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed selection_menu = memnew(PopupMenu); add_child(selection_menu); selection_menu->set_custom_minimum_size(Size2(100, 0) * EDSCALE); - selection_menu->connect("id_pressed", this, "_selection_result_pressed"); - selection_menu->connect("popup_hide", this, "_selection_menu_hide"); + selection_menu->connect_compat("id_pressed", this, "_selection_result_pressed"); + selection_menu->connect_compat("popup_hide", this, "_selection_menu_hide"); if (p_index == 0) { view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(VIEW_AUDIO_LISTENER), true); @@ -3784,7 +3784,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed name = ""; _update_name(); - EditorSettings::get_singleton()->connect("settings_changed", this, "update_transform_gizmo_view"); + EditorSettings::get_singleton()->connect_compat("settings_changed", this, "update_transform_gizmo_view"); } ////////////////////////////////////////////////////////////// @@ -5471,12 +5471,12 @@ void SpatialEditor::_notification(int p_what) { _refresh_menu_icons(); - get_tree()->connect("node_removed", this, "_node_removed"); - EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor()->connect("node_changed", this, "_refresh_menu_icons"); - editor_selection->connect("selection_changed", this, "_refresh_menu_icons"); + get_tree()->connect_compat("node_removed", this, "_node_removed"); + EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor()->connect_compat("node_changed", this, "_refresh_menu_icons"); + editor_selection->connect_compat("selection_changed", this, "_refresh_menu_icons"); - editor->connect("stop_pressed", this, "_update_camera_override_button", make_binds(false)); - editor->connect("play_pressed", this, "_update_camera_override_button", make_binds(true)); + editor->connect_compat("stop_pressed", this, "_update_camera_override_button", make_binds(false)); + editor->connect_compat("play_pressed", this, "_update_camera_override_button", make_binds(true)); } else if (p_what == NOTIFICATION_ENTER_TREE) { _register_all_gizmos(); @@ -5732,7 +5732,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { tool_button[TOOL_MODE_SELECT]->set_flat(true); tool_button[TOOL_MODE_SELECT]->set_pressed(true); button_binds.write[0] = MENU_TOOL_SELECT; - tool_button[TOOL_MODE_SELECT]->connect("pressed", this, "_menu_item_pressed", button_binds); + tool_button[TOOL_MODE_SELECT]->connect_compat("pressed", this, "_menu_item_pressed", button_binds); tool_button[TOOL_MODE_SELECT]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_select", TTR("Select Mode"), KEY_Q)); tool_button[TOOL_MODE_SELECT]->set_tooltip(keycode_get_string(KEY_MASK_CMD) + TTR("Drag: Rotate\nAlt+Drag: Move\nAlt+RMB: Depth list selection")); @@ -5743,7 +5743,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { tool_button[TOOL_MODE_MOVE]->set_toggle_mode(true); tool_button[TOOL_MODE_MOVE]->set_flat(true); button_binds.write[0] = MENU_TOOL_MOVE; - tool_button[TOOL_MODE_MOVE]->connect("pressed", this, "_menu_item_pressed", button_binds); + tool_button[TOOL_MODE_MOVE]->connect_compat("pressed", this, "_menu_item_pressed", button_binds); tool_button[TOOL_MODE_MOVE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_move", TTR("Move Mode"), KEY_W)); tool_button[TOOL_MODE_ROTATE] = memnew(ToolButton); @@ -5751,7 +5751,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { tool_button[TOOL_MODE_ROTATE]->set_toggle_mode(true); tool_button[TOOL_MODE_ROTATE]->set_flat(true); button_binds.write[0] = MENU_TOOL_ROTATE; - tool_button[TOOL_MODE_ROTATE]->connect("pressed", this, "_menu_item_pressed", button_binds); + tool_button[TOOL_MODE_ROTATE]->connect_compat("pressed", this, "_menu_item_pressed", button_binds); tool_button[TOOL_MODE_ROTATE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_rotate", TTR("Rotate Mode"), KEY_E)); tool_button[TOOL_MODE_SCALE] = memnew(ToolButton); @@ -5759,7 +5759,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { tool_button[TOOL_MODE_SCALE]->set_toggle_mode(true); tool_button[TOOL_MODE_SCALE]->set_flat(true); button_binds.write[0] = MENU_TOOL_SCALE; - tool_button[TOOL_MODE_SCALE]->connect("pressed", this, "_menu_item_pressed", button_binds); + tool_button[TOOL_MODE_SCALE]->connect_compat("pressed", this, "_menu_item_pressed", button_binds); tool_button[TOOL_MODE_SCALE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_scale", TTR("Scale Mode"), KEY_R)); hbc_menu->add_child(memnew(VSeparator)); @@ -5769,31 +5769,31 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { tool_button[TOOL_MODE_LIST_SELECT]->set_toggle_mode(true); tool_button[TOOL_MODE_LIST_SELECT]->set_flat(true); button_binds.write[0] = MENU_TOOL_LIST_SELECT; - tool_button[TOOL_MODE_LIST_SELECT]->connect("pressed", this, "_menu_item_pressed", button_binds); + tool_button[TOOL_MODE_LIST_SELECT]->connect_compat("pressed", this, "_menu_item_pressed", button_binds); tool_button[TOOL_MODE_LIST_SELECT]->set_tooltip(TTR("Show a list of all objects at the position clicked\n(same as Alt+RMB in select mode).")); tool_button[TOOL_LOCK_SELECTED] = memnew(ToolButton); hbc_menu->add_child(tool_button[TOOL_LOCK_SELECTED]); button_binds.write[0] = MENU_LOCK_SELECTED; - tool_button[TOOL_LOCK_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds); + tool_button[TOOL_LOCK_SELECTED]->connect_compat("pressed", this, "_menu_item_pressed", button_binds); tool_button[TOOL_LOCK_SELECTED]->set_tooltip(TTR("Lock the selected object in place (can't be moved).")); tool_button[TOOL_UNLOCK_SELECTED] = memnew(ToolButton); hbc_menu->add_child(tool_button[TOOL_UNLOCK_SELECTED]); button_binds.write[0] = MENU_UNLOCK_SELECTED; - tool_button[TOOL_UNLOCK_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds); + tool_button[TOOL_UNLOCK_SELECTED]->connect_compat("pressed", this, "_menu_item_pressed", button_binds); tool_button[TOOL_UNLOCK_SELECTED]->set_tooltip(TTR("Unlock the selected object (can be moved).")); tool_button[TOOL_GROUP_SELECTED] = memnew(ToolButton); hbc_menu->add_child(tool_button[TOOL_GROUP_SELECTED]); button_binds.write[0] = MENU_GROUP_SELECTED; - tool_button[TOOL_GROUP_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds); + tool_button[TOOL_GROUP_SELECTED]->connect_compat("pressed", this, "_menu_item_pressed", button_binds); tool_button[TOOL_GROUP_SELECTED]->set_tooltip(TTR("Makes sure the object's children are not selectable.")); tool_button[TOOL_UNGROUP_SELECTED] = memnew(ToolButton); hbc_menu->add_child(tool_button[TOOL_UNGROUP_SELECTED]); button_binds.write[0] = MENU_UNGROUP_SELECTED; - tool_button[TOOL_UNGROUP_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds); + tool_button[TOOL_UNGROUP_SELECTED]->connect_compat("pressed", this, "_menu_item_pressed", button_binds); tool_button[TOOL_UNGROUP_SELECTED]->set_tooltip(TTR("Restores the object's children's ability to be selected.")); hbc_menu->add_child(memnew(VSeparator)); @@ -5803,7 +5803,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_toggle_mode(true); tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_flat(true); button_binds.write[0] = MENU_TOOL_LOCAL_COORDS; - tool_option_button[TOOL_OPT_LOCAL_COORDS]->connect("toggled", this, "_menu_item_toggled", button_binds); + tool_option_button[TOOL_OPT_LOCAL_COORDS]->connect_compat("toggled", this, "_menu_item_toggled", button_binds); tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_shortcut(ED_SHORTCUT("spatial_editor/local_coords", TTR("Use Local Space"), KEY_T)); tool_option_button[TOOL_OPT_USE_SNAP] = memnew(ToolButton); @@ -5811,7 +5811,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { tool_option_button[TOOL_OPT_USE_SNAP]->set_toggle_mode(true); tool_option_button[TOOL_OPT_USE_SNAP]->set_flat(true); button_binds.write[0] = MENU_TOOL_USE_SNAP; - tool_option_button[TOOL_OPT_USE_SNAP]->connect("toggled", this, "_menu_item_toggled", button_binds); + tool_option_button[TOOL_OPT_USE_SNAP]->connect_compat("toggled", this, "_menu_item_toggled", button_binds); tool_option_button[TOOL_OPT_USE_SNAP]->set_shortcut(ED_SHORTCUT("spatial_editor/snap", TTR("Use Snap"), KEY_Y)); hbc_menu->add_child(memnew(VSeparator)); @@ -5822,7 +5822,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_flat(true); tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_disabled(true); button_binds.write[0] = MENU_TOOL_OVERRIDE_CAMERA; - tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->connect("toggled", this, "_menu_item_toggled", button_binds); + tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->connect_compat("toggled", this, "_menu_item_toggled", button_binds); _update_camera_override_button(false); hbc_menu->add_child(memnew(VSeparator)); @@ -5859,7 +5859,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { p->add_separator(); p->add_shortcut(ED_SHORTCUT("spatial_editor/configure_snap", TTR("Configure Snap...")), MENU_TRANSFORM_CONFIGURE_SNAP); - p->connect("id_pressed", this, "_menu_item_pressed"); + p->connect_compat("id_pressed", this, "_menu_item_pressed"); view_menu = memnew(MenuButton); view_menu->set_text(TTR("View")); @@ -5891,13 +5891,13 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { p->set_item_checked(p->get_item_index(MENU_VIEW_ORIGIN), true); p->set_item_checked(p->get_item_index(MENU_VIEW_GRID), true); - p->connect("id_pressed", this, "_menu_item_pressed"); + p->connect_compat("id_pressed", this, "_menu_item_pressed"); gizmos_menu = memnew(PopupMenu); p->add_child(gizmos_menu); gizmos_menu->set_name("GizmosMenu"); gizmos_menu->set_hide_on_checkable_item_selection(false); - gizmos_menu->connect("id_pressed", this, "_menu_gizmo_toggled"); + gizmos_menu->connect_compat("id_pressed", this, "_menu_gizmo_toggled"); /* REST OF MENU */ @@ -5914,8 +5914,8 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) { viewports[i] = memnew(SpatialEditorViewport(this, editor, i)); - viewports[i]->connect("toggle_maximize_view", this, "_toggle_maximize_view"); - viewports[i]->connect("clicked", this, "_update_camera_override_viewport"); + viewports[i]->connect_compat("toggle_maximize_view", this, "_toggle_maximize_view"); + viewports[i]->connect_compat("clicked", this, "_update_camera_override_viewport"); viewports[i]->assign_pending_data_pointers(preview_node, &preview_bounds, accept); viewport_base->add_child(viewports[i]); } @@ -6030,7 +6030,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { xform_type->add_item(TTR("Post")); xform_vbc->add_child(xform_type); - xform_dialog->connect("confirmed", this, "_xform_dialog_action"); + xform_dialog->connect_compat("confirmed", this, "_xform_dialog_action"); scenario_debug = VisualServer::SCENARIO_DEBUG_DISABLED; @@ -6184,7 +6184,7 @@ SpatialEditorPlugin::SpatialEditorPlugin(EditorNode *p_node) { editor->get_viewport()->add_child(spatial_editor); spatial_editor->hide(); - spatial_editor->connect("transform_key_request", editor->get_inspector_dock(), "_transform_keyed"); + spatial_editor->connect_compat("transform_key_request", editor->get_inspector_dock(), "_transform_keyed"); } SpatialEditorPlugin::~SpatialEditorPlugin() { diff --git a/editor/plugins/sprite_editor_plugin.cpp b/editor/plugins/sprite_editor_plugin.cpp index e69440b5bb..92bdbdd733 100644 --- a/editor/plugins/sprite_editor_plugin.cpp +++ b/editor/plugins/sprite_editor_plugin.cpp @@ -526,7 +526,7 @@ SpriteEditor::SpriteEditor() { options->get_popup()->add_item(TTR("Create LightOccluder2D Sibling"), MENU_OPTION_CREATE_LIGHT_OCCLUDER_2D); options->set_switch_on_hover(true); - options->get_popup()->connect("id_pressed", this, "_menu_option"); + options->get_popup()->connect_compat("id_pressed", this, "_menu_option"); err_dialog = memnew(AcceptDialog); add_child(err_dialog); @@ -542,9 +542,9 @@ SpriteEditor::SpriteEditor() { scroll->set_enable_v_scroll(true); vb->add_margin_child(TTR("Preview:"), scroll, true); debug_uv = memnew(Control); - debug_uv->connect("draw", this, "_debug_uv_draw"); + debug_uv->connect_compat("draw", this, "_debug_uv_draw"); scroll->add_child(debug_uv); - debug_uv_dialog->connect("confirmed", this, "_create_node"); + debug_uv_dialog->connect_compat("confirmed", this, "_create_node"); HBoxContainer *hb = memnew(HBoxContainer); hb->add_child(memnew(Label(TTR("Simplification: ")))); @@ -573,7 +573,7 @@ SpriteEditor::SpriteEditor() { hb->add_spacer(); update_preview = memnew(Button); update_preview->set_text(TTR("Update Preview")); - update_preview->connect("pressed", this, "_update_mesh_data"); + update_preview->connect_compat("pressed", this, "_update_mesh_data"); hb->add_child(update_preview); vb->add_margin_child(TTR("Settings:"), hb); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 9e8ce7ac4a..81f2a222da 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -905,19 +905,19 @@ SpriteFramesEditor::SpriteFramesEditor() { new_anim = memnew(ToolButton); new_anim->set_tooltip(TTR("New Animation")); hbc_animlist->add_child(new_anim); - new_anim->connect("pressed", this, "_animation_add"); + new_anim->connect_compat("pressed", this, "_animation_add"); remove_anim = memnew(ToolButton); remove_anim->set_tooltip(TTR("Remove Animation")); hbc_animlist->add_child(remove_anim); - remove_anim->connect("pressed", this, "_animation_remove"); + remove_anim->connect_compat("pressed", this, "_animation_remove"); animations = memnew(Tree); sub_vb->add_child(animations); animations->set_v_size_flags(SIZE_EXPAND_FILL); animations->set_hide_root(true); - animations->connect("cell_selected", this, "_animation_select"); - animations->connect("item_edited", this, "_animation_name_edited"); + animations->connect_compat("cell_selected", this, "_animation_select"); + animations->connect_compat("item_edited", this, "_animation_name_edited"); animations->set_allow_reselect(true); anim_speed = memnew(SpinBox); @@ -925,12 +925,12 @@ SpriteFramesEditor::SpriteFramesEditor() { anim_speed->set_min(0); anim_speed->set_max(100); anim_speed->set_step(0.01); - anim_speed->connect("value_changed", this, "_animation_fps_changed"); + anim_speed->connect_compat("value_changed", this, "_animation_fps_changed"); anim_loop = memnew(CheckButton); anim_loop->set_text(TTR("Loop")); vbc_animlist->add_child(anim_loop); - anim_loop->connect("pressed", this, "_animation_loop_changed"); + anim_loop->connect_compat("pressed", this, "_animation_loop_changed"); VBoxContainer *vbc = memnew(VBoxContainer); add_child(vbc); @@ -1004,16 +1004,16 @@ SpriteFramesEditor::SpriteFramesEditor() { dialog = memnew(AcceptDialog); add_child(dialog); - load->connect("pressed", this, "_load_pressed"); - load_sheet->connect("pressed", this, "_open_sprite_sheet"); - _delete->connect("pressed", this, "_delete_pressed"); - copy->connect("pressed", this, "_copy_pressed"); - paste->connect("pressed", this, "_paste_pressed"); - empty->connect("pressed", this, "_empty_pressed"); - empty2->connect("pressed", this, "_empty2_pressed"); - move_up->connect("pressed", this, "_up_pressed"); - move_down->connect("pressed", this, "_down_pressed"); - file->connect("files_selected", this, "_file_load_request"); + load->connect_compat("pressed", this, "_load_pressed"); + load_sheet->connect_compat("pressed", this, "_open_sprite_sheet"); + _delete->connect_compat("pressed", this, "_delete_pressed"); + copy->connect_compat("pressed", this, "_copy_pressed"); + paste->connect_compat("pressed", this, "_paste_pressed"); + empty->connect_compat("pressed", this, "_empty_pressed"); + empty2->connect_compat("pressed", this, "_empty2_pressed"); + move_up->connect_compat("pressed", this, "_up_pressed"); + move_down->connect_compat("pressed", this, "_down_pressed"); + file->connect_compat("files_selected", this, "_file_load_request"); loading_scene = false; sel = -1; @@ -1023,14 +1023,14 @@ SpriteFramesEditor::SpriteFramesEditor() { delete_dialog = memnew(ConfirmationDialog); add_child(delete_dialog); - delete_dialog->connect("confirmed", this, "_animation_remove_confirmed"); + delete_dialog->connect_compat("confirmed", this, "_animation_remove_confirmed"); split_sheet_dialog = memnew(ConfirmationDialog); add_child(split_sheet_dialog); VBoxContainer *split_sheet_vb = memnew(VBoxContainer); split_sheet_dialog->add_child(split_sheet_vb); split_sheet_dialog->set_title(TTR("Select Frames")); - split_sheet_dialog->connect("confirmed", this, "_sheet_add_frames"); + split_sheet_dialog->connect_compat("confirmed", this, "_sheet_add_frames"); HBoxContainer *split_sheet_hb = memnew(HBoxContainer); @@ -1041,7 +1041,7 @@ SpriteFramesEditor::SpriteFramesEditor() { split_sheet_h->set_max(128); split_sheet_h->set_step(1); split_sheet_hb->add_child(split_sheet_h); - split_sheet_h->connect("value_changed", this, "_sheet_spin_changed"); + split_sheet_h->connect_compat("value_changed", this, "_sheet_spin_changed"); ss_label = memnew(Label(TTR("Vertical:"))); split_sheet_hb->add_child(ss_label); @@ -1050,13 +1050,13 @@ SpriteFramesEditor::SpriteFramesEditor() { split_sheet_v->set_max(128); split_sheet_v->set_step(1); split_sheet_hb->add_child(split_sheet_v); - split_sheet_v->connect("value_changed", this, "_sheet_spin_changed"); + split_sheet_v->connect_compat("value_changed", this, "_sheet_spin_changed"); split_sheet_hb->add_spacer(); Button *select_clear_all = memnew(Button); select_clear_all->set_text(TTR("Select/Clear All Frames")); - select_clear_all->connect("pressed", this, "_sheet_select_clear_all_frames"); + select_clear_all->connect_compat("pressed", this, "_sheet_select_clear_all_frames"); split_sheet_hb->add_child(select_clear_all); split_sheet_vb->add_child(split_sheet_hb); @@ -1064,8 +1064,8 @@ SpriteFramesEditor::SpriteFramesEditor() { split_sheet_preview = memnew(TextureRect); split_sheet_preview->set_expand(false); split_sheet_preview->set_mouse_filter(MOUSE_FILTER_PASS); - split_sheet_preview->connect("draw", this, "_sheet_preview_draw"); - split_sheet_preview->connect("gui_input", this, "_sheet_preview_input"); + split_sheet_preview->connect_compat("draw", this, "_sheet_preview_draw"); + split_sheet_preview->connect_compat("gui_input", this, "_sheet_preview_input"); splite_sheet_scroll = memnew(ScrollContainer); splite_sheet_scroll->set_enable_h_scroll(true); @@ -1083,7 +1083,7 @@ SpriteFramesEditor::SpriteFramesEditor() { file_split_sheet->set_title(TTR("Create Frames from Sprite Sheet")); file_split_sheet->set_mode(EditorFileDialog::MODE_OPEN_FILE); add_child(file_split_sheet); - file_split_sheet->connect("file_selected", this, "_prepare_sprite_sheet"); + file_split_sheet->connect_compat("file_selected", this, "_prepare_sprite_sheet"); } void SpriteFramesEditorPlugin::edit(Object *p_object) { diff --git a/editor/plugins/style_box_editor_plugin.cpp b/editor/plugins/style_box_editor_plugin.cpp index eebcd567a4..a9936658c3 100644 --- a/editor/plugins/style_box_editor_plugin.cpp +++ b/editor/plugins/style_box_editor_plugin.cpp @@ -54,11 +54,11 @@ void EditorInspectorPluginStyleBox::parse_end() { void StyleBoxPreview::edit(const Ref<StyleBox> &p_stylebox) { if (stylebox.is_valid()) - stylebox->disconnect("changed", this, "_sb_changed"); + stylebox->disconnect_compat("changed", this, "_sb_changed"); stylebox = p_stylebox; if (p_stylebox.is_valid()) { preview->add_style_override("panel", stylebox); - stylebox->connect("changed", this, "_sb_changed"); + stylebox->connect_compat("changed", this, "_sb_changed"); } _sb_changed(); } @@ -91,7 +91,7 @@ StyleBoxPreview::StyleBoxPreview() { preview = memnew(Control); preview->set_custom_minimum_size(Size2(0, 150 * EDSCALE)); preview->set_clip_contents(true); - preview->connect("draw", this, "_redraw"); + preview->connect_compat("draw", this, "_redraw"); add_margin_child(TTR("Preview:"), preview); } diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index 357af5ecd8..a8b6d74c1f 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -633,19 +633,19 @@ TextEditor::TextEditor() { code_editor = memnew(CodeTextEditor); add_child(code_editor); code_editor->add_constant_override("separation", 0); - code_editor->connect("load_theme_settings", this, "_load_theme_settings"); - code_editor->connect("validate_script", this, "_validate_script"); + code_editor->connect_compat("load_theme_settings", this, "_load_theme_settings"); + code_editor->connect_compat("validate_script", this, "_validate_script"); code_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE); code_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); update_settings(); code_editor->get_text_edit()->set_context_menu_enabled(false); - code_editor->get_text_edit()->connect("gui_input", this, "_text_edit_gui_input"); + code_editor->get_text_edit()->connect_compat("gui_input", this, "_text_edit_gui_input"); context_menu = memnew(PopupMenu); add_child(context_menu); - context_menu->connect("id_pressed", this, "_edit_option"); + context_menu->connect_compat("id_pressed", this, "_edit_option"); edit_hb = memnew(HBoxContainer); @@ -653,7 +653,7 @@ TextEditor::TextEditor() { edit_hb->add_child(search_menu); search_menu->set_text(TTR("Search")); search_menu->set_switch_on_hover(true); - search_menu->get_popup()->connect("id_pressed", this, "_edit_option"); + search_menu->get_popup()->connect_compat("id_pressed", this, "_edit_option"); search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find"), SEARCH_FIND); search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_next"), SEARCH_FIND_NEXT); @@ -667,7 +667,7 @@ TextEditor::TextEditor() { edit_hb->add_child(edit_menu); edit_menu->set_text(TTR("Edit")); edit_menu->set_switch_on_hover(true); - edit_menu->get_popup()->connect("id_pressed", this, "_edit_option"); + edit_menu->get_popup()->connect_compat("id_pressed", this, "_edit_option"); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/undo"), EDIT_UNDO); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/redo"), EDIT_REDO); @@ -700,7 +700,7 @@ TextEditor::TextEditor() { convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_uppercase", TTR("Uppercase")), EDIT_TO_UPPERCASE); convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_lowercase", TTR("Lowercase")), EDIT_TO_LOWERCASE); convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize")), EDIT_CAPITALIZE); - convert_case->connect("id_pressed", this, "_edit_option"); + convert_case->connect_compat("id_pressed", this, "_edit_option"); highlighters["Standard"] = NULL; highlighter_menu = memnew(PopupMenu); @@ -708,13 +708,13 @@ TextEditor::TextEditor() { edit_menu->get_popup()->add_child(highlighter_menu); edit_menu->get_popup()->add_submenu_item(TTR("Syntax Highlighter"), "highlighter_menu"); highlighter_menu->add_radio_check_item(TTR("Standard")); - highlighter_menu->connect("id_pressed", this, "_change_syntax_highlighter"); + highlighter_menu->connect_compat("id_pressed", this, "_change_syntax_highlighter"); MenuButton *goto_menu = memnew(MenuButton); edit_hb->add_child(goto_menu); goto_menu->set_text(TTR("Go To")); goto_menu->set_switch_on_hover(true); - goto_menu->get_popup()->connect("id_pressed", this, "_edit_option"); + goto_menu->get_popup()->connect_compat("id_pressed", this, "_edit_option"); goto_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_line"), SEARCH_GOTO_LINE); goto_menu->get_popup()->add_separator(); @@ -724,8 +724,8 @@ TextEditor::TextEditor() { goto_menu->get_popup()->add_child(bookmarks_menu); goto_menu->get_popup()->add_submenu_item(TTR("Bookmarks"), "Bookmarks"); _update_bookmark_list(); - bookmarks_menu->connect("about_to_show", this, "_update_bookmark_list"); - bookmarks_menu->connect("index_pressed", this, "_bookmark_item_pressed"); + bookmarks_menu->connect_compat("about_to_show", this, "_update_bookmark_list"); + bookmarks_menu->connect_compat("index_pressed", this, "_bookmark_item_pressed"); goto_line_dialog = memnew(GotoLineDialog); add_child(goto_line_dialog); diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 2350c20cb7..065833fd2b 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -935,7 +935,7 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { snap_mode_button->add_item(TTR("Grid Snap"), 2); snap_mode_button->add_item(TTR("Auto Slice"), 3); snap_mode_button->select(0); - snap_mode_button->connect("item_selected", this, "_set_snap_mode"); + snap_mode_button->connect_compat("item_selected", this, "_set_snap_mode"); hb_grid = memnew(HBoxContainer); hb_tools->add_child(hb_grid); @@ -949,7 +949,7 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { sb_off_x->set_step(1); sb_off_x->set_value(snap_offset.x); sb_off_x->set_suffix("px"); - sb_off_x->connect("value_changed", this, "_set_snap_off_x"); + sb_off_x->connect_compat("value_changed", this, "_set_snap_off_x"); hb_grid->add_child(sb_off_x); sb_off_y = memnew(SpinBox); @@ -958,7 +958,7 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { sb_off_y->set_step(1); sb_off_y->set_value(snap_offset.y); sb_off_y->set_suffix("px"); - sb_off_y->connect("value_changed", this, "_set_snap_off_y"); + sb_off_y->connect_compat("value_changed", this, "_set_snap_off_y"); hb_grid->add_child(sb_off_y); hb_grid->add_child(memnew(VSeparator)); @@ -970,7 +970,7 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { sb_step_x->set_step(1); sb_step_x->set_value(snap_step.x); sb_step_x->set_suffix("px"); - sb_step_x->connect("value_changed", this, "_set_snap_step_x"); + sb_step_x->connect_compat("value_changed", this, "_set_snap_step_x"); hb_grid->add_child(sb_step_x); sb_step_y = memnew(SpinBox); @@ -979,7 +979,7 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { sb_step_y->set_step(1); sb_step_y->set_value(snap_step.y); sb_step_y->set_suffix("px"); - sb_step_y->connect("value_changed", this, "_set_snap_step_y"); + sb_step_y->connect_compat("value_changed", this, "_set_snap_step_y"); hb_grid->add_child(sb_step_y); hb_grid->add_child(memnew(VSeparator)); @@ -991,7 +991,7 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { sb_sep_x->set_step(1); sb_sep_x->set_value(snap_separation.x); sb_sep_x->set_suffix("px"); - sb_sep_x->connect("value_changed", this, "_set_snap_sep_x"); + sb_sep_x->connect_compat("value_changed", this, "_set_snap_sep_x"); hb_grid->add_child(sb_sep_x); sb_sep_y = memnew(SpinBox); @@ -1000,7 +1000,7 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { sb_sep_y->set_step(1); sb_sep_y->set_value(snap_separation.y); sb_sep_y->set_suffix("px"); - sb_sep_y->connect("value_changed", this, "_set_snap_sep_y"); + sb_sep_y->connect_compat("value_changed", this, "_set_snap_sep_y"); hb_grid->add_child(sb_sep_y); hb_grid->hide(); @@ -1008,8 +1008,8 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { edit_draw = memnew(Panel); add_child(edit_draw); edit_draw->set_v_size_flags(SIZE_EXPAND_FILL); - edit_draw->connect("draw", this, "_region_draw"); - edit_draw->connect("gui_input", this, "_region_input"); + edit_draw->connect_compat("draw", this, "_region_draw"); + edit_draw->connect_compat("gui_input", this, "_region_input"); draw_zoom = 1.0; edit_draw->set_clip_contents(true); @@ -1020,27 +1020,27 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { zoom_out = memnew(ToolButton); zoom_out->set_tooltip(TTR("Zoom Out")); - zoom_out->connect("pressed", this, "_zoom_out"); + zoom_out->connect_compat("pressed", this, "_zoom_out"); zoom_hb->add_child(zoom_out); zoom_reset = memnew(ToolButton); zoom_reset->set_tooltip(TTR("Zoom Reset")); - zoom_reset->connect("pressed", this, "_zoom_reset"); + zoom_reset->connect_compat("pressed", this, "_zoom_reset"); zoom_hb->add_child(zoom_reset); zoom_in = memnew(ToolButton); zoom_in->set_tooltip(TTR("Zoom In")); - zoom_in->connect("pressed", this, "_zoom_in"); + zoom_in->connect_compat("pressed", this, "_zoom_in"); zoom_hb->add_child(zoom_in); vscroll = memnew(VScrollBar); vscroll->set_step(0.001); edit_draw->add_child(vscroll); - vscroll->connect("value_changed", this, "_scroll_changed"); + vscroll->connect_compat("value_changed", this, "_scroll_changed"); hscroll = memnew(HScrollBar); hscroll->set_step(0.001); edit_draw->add_child(hscroll); - hscroll->connect("value_changed", this, "_scroll_changed"); + hscroll->connect_compat("value_changed", this, "_scroll_changed"); updating_scroll = false; } @@ -1125,7 +1125,7 @@ TextureRegionEditorPlugin::TextureRegionEditorPlugin(EditorNode *p_node) { region_editor = memnew(TextureRegionEditor(p_node)); region_editor->set_custom_minimum_size(Size2(0, 200) * EDSCALE); region_editor->hide(); - region_editor->connect("visibility_changed", this, "_editor_visiblity_changed"); + region_editor->connect_compat("visibility_changed", this, "_editor_visiblity_changed"); texture_region_button = p_node->add_bottom_panel_item(TTR("TextureRegion"), region_editor); texture_region_button->hide(); diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index 48d80a0017..717c9adad3 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -629,7 +629,7 @@ ThemeEditor::ThemeEditor() { theme_menu->get_popup()->add_item(TTR("Create Empty Editor Template"), POPUP_CREATE_EDITOR_EMPTY); theme_menu->get_popup()->add_item(TTR("Create From Current Editor Theme"), POPUP_IMPORT_EDITOR_THEME); top_menu->add_child(theme_menu); - theme_menu->get_popup()->connect("id_pressed", this, "_theme_menu_cbk"); + theme_menu->get_popup()->connect_compat("id_pressed", this, "_theme_menu_cbk"); ScrollContainer *scroll = memnew(ScrollContainer); add_child(scroll); @@ -835,7 +835,7 @@ ThemeEditor::ThemeEditor() { type_menu->set_text(".."); type_hbc->add_child(type_menu); - type_menu->get_popup()->connect("id_pressed", this, "_type_menu_cbk"); + type_menu->get_popup()->connect_compat("id_pressed", this, "_type_menu_cbk"); l = memnew(Label); l->set_text(TTR("Name:")); @@ -853,8 +853,8 @@ ThemeEditor::ThemeEditor() { name_menu->set_text(".."); name_hbc->add_child(name_menu); - name_menu->get_popup()->connect("about_to_show", this, "_name_menu_about_to_show"); - name_menu->get_popup()->connect("id_pressed", this, "_name_menu_cbk"); + name_menu->get_popup()->connect_compat("about_to_show", this, "_name_menu_about_to_show"); + name_menu->get_popup()->connect_compat("id_pressed", this, "_name_menu_cbk"); type_select_label = memnew(Label); type_select_label->set_text(TTR("Data Type:")); @@ -869,12 +869,12 @@ ThemeEditor::ThemeEditor() { dialog_vbc->add_child(type_select); - add_del_dialog->get_ok()->connect("pressed", this, "_dialog_cbk"); + add_del_dialog->get_ok()->connect_compat("pressed", this, "_dialog_cbk"); file_dialog = memnew(EditorFileDialog); file_dialog->add_filter("*.theme ; " + TTR("Theme File")); add_child(file_dialog); - file_dialog->connect("file_selected", this, "_save_template_cbk"); + file_dialog->connect_compat("file_selected", this, "_save_template_cbk"); } void ThemeEditorPlugin::edit(Object *p_node) { diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 145263a5ab..a7115fc9a2 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -1761,30 +1761,30 @@ void TileMapEditor::edit(Node *p_tile_map) { } if (node) - node->disconnect("settings_changed", this, "_tileset_settings_changed"); + node->disconnect_compat("settings_changed", this, "_tileset_settings_changed"); if (p_tile_map) { node = Object::cast_to<TileMap>(p_tile_map); - if (!canvas_item_editor_viewport->is_connected("mouse_entered", this, "_canvas_mouse_enter")) - canvas_item_editor_viewport->connect("mouse_entered", this, "_canvas_mouse_enter"); - if (!canvas_item_editor_viewport->is_connected("mouse_exited", this, "_canvas_mouse_exit")) - canvas_item_editor_viewport->connect("mouse_exited", this, "_canvas_mouse_exit"); + if (!canvas_item_editor_viewport->is_connected_compat("mouse_entered", this, "_canvas_mouse_enter")) + canvas_item_editor_viewport->connect_compat("mouse_entered", this, "_canvas_mouse_enter"); + if (!canvas_item_editor_viewport->is_connected_compat("mouse_exited", this, "_canvas_mouse_exit")) + canvas_item_editor_viewport->connect_compat("mouse_exited", this, "_canvas_mouse_exit"); _update_palette(); } else { node = NULL; - if (canvas_item_editor_viewport->is_connected("mouse_entered", this, "_canvas_mouse_enter")) - canvas_item_editor_viewport->disconnect("mouse_entered", this, "_canvas_mouse_enter"); - if (canvas_item_editor_viewport->is_connected("mouse_exited", this, "_canvas_mouse_exit")) - canvas_item_editor_viewport->disconnect("mouse_exited", this, "_canvas_mouse_exit"); + if (canvas_item_editor_viewport->is_connected_compat("mouse_entered", this, "_canvas_mouse_enter")) + canvas_item_editor_viewport->disconnect_compat("mouse_entered", this, "_canvas_mouse_enter"); + if (canvas_item_editor_viewport->is_connected_compat("mouse_exited", this, "_canvas_mouse_exit")) + canvas_item_editor_viewport->disconnect_compat("mouse_exited", this, "_canvas_mouse_exit"); _update_palette(); } if (node) - node->connect("settings_changed", this, "_tileset_settings_changed"); + node->connect_compat("settings_changed", this, "_tileset_settings_changed"); _clear_bucket_cache(); } @@ -1939,20 +1939,20 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { manual_button = memnew(CheckBox); manual_button->set_text(TTR("Disable Autotile")); - manual_button->connect("toggled", this, "_manual_toggled"); + manual_button->connect_compat("toggled", this, "_manual_toggled"); add_child(manual_button); priority_button = memnew(CheckBox); priority_button->set_text(TTR("Enable Priority")); - priority_button->connect("toggled", this, "_priority_toggled"); + priority_button->connect_compat("toggled", this, "_priority_toggled"); add_child(priority_button); search_box = memnew(LineEdit); search_box->set_placeholder(TTR("Filter tiles")); search_box->set_h_size_flags(SIZE_EXPAND_FILL); - search_box->connect("text_entered", this, "_text_entered"); - search_box->connect("text_changed", this, "_text_changed"); - search_box->connect("gui_input", this, "_sbox_input"); + search_box->connect_compat("text_entered", this, "_text_entered"); + search_box->connect_compat("text_changed", this, "_text_changed"); + search_box->connect_compat("gui_input", this, "_sbox_input"); add_child(search_box); size_slider = memnew(HSlider); @@ -1961,7 +1961,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { size_slider->set_max(4.0f); size_slider->set_step(0.1f); size_slider->set_value(1.0f); - size_slider->connect("value_changed", this, "_icon_size_changed"); + size_slider->connect_compat("value_changed", this, "_icon_size_changed"); add_child(size_slider); int mw = EDITOR_DEF("editors/tile_map/palette_min_width", 80); @@ -1980,8 +1980,8 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { palette->set_max_text_lines(2); palette->set_select_mode(ItemList::SELECT_MULTI); palette->add_constant_override("vseparation", 8 * EDSCALE); - palette->connect("item_selected", this, "_palette_selected"); - palette->connect("multi_selected", this, "_palette_multi_selected"); + palette->connect_compat("item_selected", this, "_palette_selected"); + palette->connect_compat("multi_selected", this, "_palette_multi_selected"); palette_container->add_child(palette); // Add message for when no texture is selected. @@ -2015,25 +2015,25 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { paint_button = memnew(ToolButton); paint_button->set_shortcut(ED_SHORTCUT("tile_map_editor/paint_tile", TTR("Paint Tile"), KEY_P)); paint_button->set_tooltip(TTR("Shift+LMB: Line Draw\nShift+Ctrl+LMB: Rectangle Paint")); - paint_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_NONE)); + paint_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_NONE)); paint_button->set_toggle_mode(true); toolbar->add_child(paint_button); bucket_fill_button = memnew(ToolButton); bucket_fill_button->set_shortcut(ED_SHORTCUT("tile_map_editor/bucket_fill", TTR("Bucket Fill"), KEY_G)); - bucket_fill_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_BUCKET)); + bucket_fill_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_BUCKET)); bucket_fill_button->set_toggle_mode(true); toolbar->add_child(bucket_fill_button); picker_button = memnew(ToolButton); picker_button->set_shortcut(ED_SHORTCUT("tile_map_editor/pick_tile", TTR("Pick Tile"), KEY_I)); - picker_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_PICKING)); + picker_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_PICKING)); picker_button->set_toggle_mode(true); toolbar->add_child(picker_button); select_button = memnew(ToolButton); select_button->set_shortcut(ED_SHORTCUT("tile_map_editor/select", TTR("Select"), KEY_M)); - select_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_SELECTING)); + select_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_SELECTING)); select_button->set_toggle_mode(true); toolbar->add_child(select_button); @@ -2068,40 +2068,40 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { p->add_shortcut(ED_GET_SHORTCUT("tile_map_editor/erase_selection"), OPTION_ERASE_SELECTION); p->add_separator(); p->add_item(TTR("Fix Invalid Tiles"), OPTION_FIX_INVALID); - p->connect("id_pressed", this, "_menu_option"); + p->connect_compat("id_pressed", this, "_menu_option"); rotate_left_button = memnew(ToolButton); rotate_left_button->set_tooltip(TTR("Rotate Left")); rotate_left_button->set_focus_mode(FOCUS_NONE); - rotate_left_button->connect("pressed", this, "_rotate", varray(-1)); + rotate_left_button->connect_compat("pressed", this, "_rotate", varray(-1)); rotate_left_button->set_shortcut(ED_SHORTCUT("tile_map_editor/rotate_left", TTR("Rotate Left"), KEY_A)); tool_hb->add_child(rotate_left_button); rotate_right_button = memnew(ToolButton); rotate_right_button->set_tooltip(TTR("Rotate Right")); rotate_right_button->set_focus_mode(FOCUS_NONE); - rotate_right_button->connect("pressed", this, "_rotate", varray(1)); + rotate_right_button->connect_compat("pressed", this, "_rotate", varray(1)); rotate_right_button->set_shortcut(ED_SHORTCUT("tile_map_editor/rotate_right", TTR("Rotate Right"), KEY_S)); tool_hb->add_child(rotate_right_button); flip_horizontal_button = memnew(ToolButton); flip_horizontal_button->set_tooltip(TTR("Flip Horizontally")); flip_horizontal_button->set_focus_mode(FOCUS_NONE); - flip_horizontal_button->connect("pressed", this, "_flip_horizontal"); + flip_horizontal_button->connect_compat("pressed", this, "_flip_horizontal"); flip_horizontal_button->set_shortcut(ED_SHORTCUT("tile_map_editor/flip_horizontal", TTR("Flip Horizontally"), KEY_X)); tool_hb->add_child(flip_horizontal_button); flip_vertical_button = memnew(ToolButton); flip_vertical_button->set_tooltip(TTR("Flip Vertically")); flip_vertical_button->set_focus_mode(FOCUS_NONE); - flip_vertical_button->connect("pressed", this, "_flip_vertical"); + flip_vertical_button->connect_compat("pressed", this, "_flip_vertical"); flip_vertical_button->set_shortcut(ED_SHORTCUT("tile_map_editor/flip_vertical", TTR("Flip Vertically"), KEY_Z)); tool_hb->add_child(flip_vertical_button); clear_transform_button = memnew(ToolButton); clear_transform_button->set_tooltip(TTR("Clear Transform")); clear_transform_button->set_focus_mode(FOCUS_NONE); - clear_transform_button->connect("pressed", this, "_clear_transform"); + clear_transform_button->connect_compat("pressed", this, "_clear_transform"); clear_transform_button->set_shortcut(ED_SHORTCUT("tile_map_editor/clear_transform", TTR("Clear Transform"), KEY_W)); tool_hb->add_child(clear_transform_button); diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index 4fea504f7d..02c3709766 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -358,19 +358,19 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { left_container->add_child(texture_list); texture_list->set_v_size_flags(SIZE_EXPAND_FILL); texture_list->set_custom_minimum_size(Size2(200, 0)); - texture_list->connect("item_selected", this, "_on_texture_list_selected"); + texture_list->connect_compat("item_selected", this, "_on_texture_list_selected"); texture_list->set_drag_forwarding(this); HBoxContainer *tileset_toolbar_container = memnew(HBoxContainer); left_container->add_child(tileset_toolbar_container); tileset_toolbar_buttons[TOOL_TILESET_ADD_TEXTURE] = memnew(ToolButton); - tileset_toolbar_buttons[TOOL_TILESET_ADD_TEXTURE]->connect("pressed", this, "_on_tileset_toolbar_button_pressed", varray(TOOL_TILESET_ADD_TEXTURE)); + tileset_toolbar_buttons[TOOL_TILESET_ADD_TEXTURE]->connect_compat("pressed", this, "_on_tileset_toolbar_button_pressed", varray(TOOL_TILESET_ADD_TEXTURE)); tileset_toolbar_container->add_child(tileset_toolbar_buttons[TOOL_TILESET_ADD_TEXTURE]); tileset_toolbar_buttons[TOOL_TILESET_ADD_TEXTURE]->set_tooltip(TTR("Add Texture(s) to TileSet.")); tileset_toolbar_buttons[TOOL_TILESET_REMOVE_TEXTURE] = memnew(ToolButton); - tileset_toolbar_buttons[TOOL_TILESET_REMOVE_TEXTURE]->connect("pressed", this, "_on_tileset_toolbar_button_pressed", varray(TOOL_TILESET_REMOVE_TEXTURE)); + tileset_toolbar_buttons[TOOL_TILESET_REMOVE_TEXTURE]->connect_compat("pressed", this, "_on_tileset_toolbar_button_pressed", varray(TOOL_TILESET_REMOVE_TEXTURE)); tileset_toolbar_container->add_child(tileset_toolbar_buttons[TOOL_TILESET_REMOVE_TEXTURE]); tileset_toolbar_buttons[TOOL_TILESET_REMOVE_TEXTURE]->set_tooltip(TTR("Remove selected Texture from TileSet.")); @@ -383,7 +383,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { tileset_toolbar_tools->get_popup()->add_item(TTR("Create from Scene"), TOOL_TILESET_CREATE_SCENE); tileset_toolbar_tools->get_popup()->add_item(TTR("Merge from Scene"), TOOL_TILESET_MERGE_SCENE); - tileset_toolbar_tools->get_popup()->connect("id_pressed", this, "_on_tileset_toolbar_button_pressed"); + tileset_toolbar_tools->get_popup()->connect_compat("id_pressed", this, "_on_tileset_toolbar_button_pressed"); tileset_toolbar_container->add_child(tileset_toolbar_tools); //--------------- @@ -416,7 +416,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { tool_workspacemode[i]->set_text(workspace_label[i]); tool_workspacemode[i]->set_toggle_mode(true); tool_workspacemode[i]->set_button_group(g); - tool_workspacemode[i]->connect("pressed", this, "_on_workspace_mode_changed", varray(i)); + tool_workspacemode[i]->connect_compat("pressed", this, "_on_workspace_mode_changed", varray(i)); tool_hb->add_child(tool_workspacemode[i]); } @@ -429,14 +429,14 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { tool_hb->add_child(tools[SELECT_NEXT]); tool_hb->move_child(tools[SELECT_NEXT], WORKSPACE_CREATE_SINGLE); tools[SELECT_NEXT]->set_shortcut(ED_SHORTCUT("tileset_editor/next_shape", TTR("Next Coordinate"), KEY_PAGEDOWN)); - tools[SELECT_NEXT]->connect("pressed", this, "_on_tool_clicked", varray(SELECT_NEXT)); + tools[SELECT_NEXT]->connect_compat("pressed", this, "_on_tool_clicked", varray(SELECT_NEXT)); tools[SELECT_NEXT]->set_tooltip(TTR("Select the next shape, subtile, or Tile.")); tools[SELECT_PREVIOUS] = memnew(ToolButton); tool_hb->add_child(tools[SELECT_PREVIOUS]); tool_hb->move_child(tools[SELECT_PREVIOUS], WORKSPACE_CREATE_SINGLE); tools[SELECT_PREVIOUS]->set_shortcut(ED_SHORTCUT("tileset_editor/previous_shape", TTR("Previous Coordinate"), KEY_PAGEUP)); tools[SELECT_PREVIOUS]->set_tooltip(TTR("Select the previous shape, subtile, or Tile.")); - tools[SELECT_PREVIOUS]->connect("pressed", this, "_on_tool_clicked", varray(SELECT_PREVIOUS)); + tools[SELECT_PREVIOUS]->connect_compat("pressed", this, "_on_tool_clicked", varray(SELECT_PREVIOUS)); VSeparator *separator_shape_selection = memnew(VSeparator); tool_hb->add_child(separator_shape_selection); @@ -466,7 +466,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { tool_editmode[i]->set_text(label[i]); tool_editmode[i]->set_toggle_mode(true); tool_editmode[i]->set_button_group(g); - tool_editmode[i]->connect("pressed", this, "_on_edit_mode_changed", varray(i)); + tool_editmode[i]->connect_compat("pressed", this, "_on_edit_mode_changed", varray(i)); tool_hb->add_child(tool_editmode[i]); } tool_editmode[EDITMODE_COLLISION]->set_pressed(true); @@ -493,21 +493,21 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { tools[TOOL_SELECT]->set_toggle_mode(true); tools[TOOL_SELECT]->set_button_group(tg); tools[TOOL_SELECT]->set_pressed(true); - tools[TOOL_SELECT]->connect("pressed", this, "_on_tool_clicked", varray(TOOL_SELECT)); + tools[TOOL_SELECT]->connect_compat("pressed", this, "_on_tool_clicked", varray(TOOL_SELECT)); separator_bitmask = memnew(VSeparator); toolbar->add_child(separator_bitmask); tools[BITMASK_COPY] = memnew(ToolButton); tools[BITMASK_COPY]->set_tooltip(TTR("Copy bitmask.")); - tools[BITMASK_COPY]->connect("pressed", this, "_on_tool_clicked", varray(BITMASK_COPY)); + tools[BITMASK_COPY]->connect_compat("pressed", this, "_on_tool_clicked", varray(BITMASK_COPY)); toolbar->add_child(tools[BITMASK_COPY]); tools[BITMASK_PASTE] = memnew(ToolButton); tools[BITMASK_PASTE]->set_tooltip(TTR("Paste bitmask.")); - tools[BITMASK_PASTE]->connect("pressed", this, "_on_tool_clicked", varray(BITMASK_PASTE)); + tools[BITMASK_PASTE]->connect_compat("pressed", this, "_on_tool_clicked", varray(BITMASK_PASTE)); toolbar->add_child(tools[BITMASK_PASTE]); tools[BITMASK_CLEAR] = memnew(ToolButton); tools[BITMASK_CLEAR]->set_tooltip(TTR("Erase bitmask.")); - tools[BITMASK_CLEAR]->connect("pressed", this, "_on_tool_clicked", varray(BITMASK_CLEAR)); + tools[BITMASK_CLEAR]->connect_compat("pressed", this, "_on_tool_clicked", varray(BITMASK_CLEAR)); toolbar->add_child(tools[BITMASK_CLEAR]); tools[SHAPE_NEW_RECTANGLE] = memnew(ToolButton); @@ -525,13 +525,13 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { separator_shape_toggle = memnew(VSeparator); toolbar->add_child(separator_shape_toggle); tools[SHAPE_TOGGLE_TYPE] = memnew(ToolButton); - tools[SHAPE_TOGGLE_TYPE]->connect("pressed", this, "_on_tool_clicked", varray(SHAPE_TOGGLE_TYPE)); + tools[SHAPE_TOGGLE_TYPE]->connect_compat("pressed", this, "_on_tool_clicked", varray(SHAPE_TOGGLE_TYPE)); toolbar->add_child(tools[SHAPE_TOGGLE_TYPE]); separator_delete = memnew(VSeparator); toolbar->add_child(separator_delete); tools[SHAPE_DELETE] = memnew(ToolButton); - tools[SHAPE_DELETE]->connect("pressed", this, "_on_tool_clicked", varray(SHAPE_DELETE)); + tools[SHAPE_DELETE]->connect_compat("pressed", this, "_on_tool_clicked", varray(SHAPE_DELETE)); toolbar->add_child(tools[SHAPE_DELETE]); spin_priority = memnew(SpinBox); @@ -539,7 +539,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { spin_priority->set_max(255); spin_priority->set_step(1); spin_priority->set_custom_minimum_size(Size2(100, 0)); - spin_priority->connect("value_changed", this, "_on_priority_changed"); + spin_priority->connect_compat("value_changed", this, "_on_priority_changed"); spin_priority->hide(); toolbar->add_child(spin_priority); @@ -548,7 +548,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { spin_z_index->set_max(VS::CANVAS_ITEM_Z_MAX); spin_z_index->set_step(1); spin_z_index->set_custom_minimum_size(Size2(100, 0)); - spin_z_index->connect("value_changed", this, "_on_z_index_changed"); + spin_z_index->connect_compat("value_changed", this, "_on_z_index_changed"); spin_z_index->hide(); toolbar->add_child(spin_z_index); @@ -562,7 +562,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { tools[TOOL_GRID_SNAP] = memnew(ToolButton); tools[TOOL_GRID_SNAP]->set_toggle_mode(true); tools[TOOL_GRID_SNAP]->set_tooltip(TTR("Enable snap and show grid (configurable via the Inspector).")); - tools[TOOL_GRID_SNAP]->connect("toggled", this, "_on_grid_snap_toggled"); + tools[TOOL_GRID_SNAP]->connect_compat("toggled", this, "_on_grid_snap_toggled"); toolbar->add_child(tools[TOOL_GRID_SNAP]); Control *separator = memnew(Control); @@ -570,15 +570,15 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { toolbar->add_child(separator); tools[ZOOM_OUT] = memnew(ToolButton); - tools[ZOOM_OUT]->connect("pressed", this, "_zoom_out"); + tools[ZOOM_OUT]->connect_compat("pressed", this, "_zoom_out"); toolbar->add_child(tools[ZOOM_OUT]); tools[ZOOM_OUT]->set_tooltip(TTR("Zoom Out")); tools[ZOOM_1] = memnew(ToolButton); - tools[ZOOM_1]->connect("pressed", this, "_zoom_reset"); + tools[ZOOM_1]->connect_compat("pressed", this, "_zoom_reset"); toolbar->add_child(tools[ZOOM_1]); tools[ZOOM_1]->set_tooltip(TTR("Zoom Reset")); tools[ZOOM_IN] = memnew(ToolButton); - tools[ZOOM_IN]->connect("pressed", this, "_zoom_in"); + tools[ZOOM_IN]->connect_compat("pressed", this, "_zoom_in"); toolbar->add_child(tools[ZOOM_IN]); tools[ZOOM_IN]->set_tooltip(TTR("Zoom In")); @@ -607,13 +607,13 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { scroll->add_child(workspace_container); workspace_overlay = memnew(Control); - workspace_overlay->connect("draw", this, "_on_workspace_overlay_draw"); + workspace_overlay->connect_compat("draw", this, "_on_workspace_overlay_draw"); workspace_container->add_child(workspace_overlay); workspace = memnew(Control); workspace->set_focus_mode(FOCUS_ALL); - workspace->connect("draw", this, "_on_workspace_draw"); - workspace->connect("gui_input", this, "_on_workspace_input"); + workspace->connect_compat("draw", this, "_on_workspace_draw"); + workspace->connect_compat("gui_input", this, "_on_workspace_input"); workspace->set_draw_behind_parent(true); workspace_overlay->add_child(workspace); @@ -626,7 +626,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { //--------------- cd = memnew(ConfirmationDialog); add_child(cd); - cd->connect("confirmed", this, "_on_tileset_toolbar_confirm"); + cd->connect_compat("confirmed", this, "_on_tileset_toolbar_confirm"); //--------------- err_dialog = memnew(AcceptDialog); @@ -645,7 +645,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { texture_dialog->add_filter("*." + E->get() + " ; " + E->get().to_upper()); } add_child(texture_dialog); - texture_dialog->connect("files_selected", this, "_on_textures_added"); + texture_dialog->connect_compat("files_selected", this, "_on_textures_added"); //--------------- helper = memnew(TilesetEditorContext(this)); @@ -3548,11 +3548,11 @@ void TileSetEditorPlugin::make_visible(bool p_visible) { if (p_visible) { tileset_editor_button->show(); editor->make_bottom_panel_item_visible(tileset_editor); - get_tree()->connect("idle_frame", tileset_editor, "_on_workspace_process"); + get_tree()->connect_compat("idle_frame", tileset_editor, "_on_workspace_process"); } else { editor->hide_bottom_panel(); tileset_editor_button->hide(); - get_tree()->disconnect("idle_frame", tileset_editor, "_on_workspace_process"); + get_tree()->disconnect_compat("idle_frame", tileset_editor, "_on_workspace_process"); } } diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index e17e6a9d16..cfa10488ab 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -127,7 +127,7 @@ void VersionControlEditorPlugin::_initialize_vcs() { vcs_interface->set_script_and_instance(script, addon_script_instance); EditorVCSInterface::set_singleton(vcs_interface); - EditorFileSystem::get_singleton()->connect("filesystem_changed", this, "_refresh_stage_area"); + EditorFileSystem::get_singleton()->connect_compat("filesystem_changed", this, "_refresh_stage_area"); String res_dir = OS::get_singleton()->get_resource_dir(); @@ -388,8 +388,8 @@ void VersionControlEditorPlugin::clear_stage_area() { void VersionControlEditorPlugin::shut_down() { if (EditorVCSInterface::get_singleton()) { - if (EditorFileSystem::get_singleton()->is_connected("filesystem_changed", this, "_refresh_stage_area")) { - EditorFileSystem::get_singleton()->disconnect("filesystem_changed", this, "_refresh_stage_area"); + if (EditorFileSystem::get_singleton()->is_connected_compat("filesystem_changed", this, "_refresh_stage_area")) { + EditorFileSystem::get_singleton()->disconnect_compat("filesystem_changed", this, "_refresh_stage_area"); } EditorVCSInterface::get_singleton()->shut_down(); memdelete(EditorVCSInterface::get_singleton()); @@ -444,14 +444,14 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { set_up_choice = memnew(OptionButton); set_up_choice->set_h_size_flags(HBoxContainer::SIZE_EXPAND_FILL); - set_up_choice->connect("item_selected", this, "_selected_a_vcs"); + set_up_choice->connect_compat("item_selected", this, "_selected_a_vcs"); set_up_hbc->add_child(set_up_choice); set_up_init_settings = NULL; set_up_init_button = memnew(Button); set_up_init_button->set_text(TTR("Initialize")); - set_up_init_button->connect("pressed", this, "_initialize_vcs"); + set_up_init_button->connect_compat("pressed", this, "_initialize_vcs"); set_up_vbc->add_child(set_up_init_button); version_control_actions->set_v_size_flags(PopupMenu::SIZE_EXPAND_FILL); @@ -479,7 +479,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { refresh_button->set_tooltip(TTR("Detect new changes")); refresh_button->set_text(TTR("Refresh")); refresh_button->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Reload", "EditorIcons")); - refresh_button->connect("pressed", this, "_refresh_stage_area"); + refresh_button->connect_compat("pressed", this, "_refresh_stage_area"); stage_tools->add_child(refresh_button); stage_files = memnew(Tree); @@ -492,7 +492,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { stage_files->set_allow_rmb_select(true); stage_files->set_select_mode(Tree::SelectMode::SELECT_MULTI); stage_files->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true); - stage_files->connect("cell_selected", this, "_view_file_diff"); + stage_files->connect_compat("cell_selected", this, "_view_file_diff"); stage_files->create_item(); stage_files->set_hide_root(true); commit_box_vbc->add_child(stage_files); @@ -516,12 +516,12 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { stage_selected_button = memnew(Button); stage_selected_button->set_h_size_flags(Button::SIZE_EXPAND_FILL); stage_selected_button->set_text(TTR("Stage Selected")); - stage_selected_button->connect("pressed", this, "_stage_selected"); + stage_selected_button->connect_compat("pressed", this, "_stage_selected"); stage_buttons->add_child(stage_selected_button); stage_all_button = memnew(Button); stage_all_button->set_text(TTR("Stage All")); - stage_all_button->connect("pressed", this, "_stage_all"); + stage_all_button->connect_compat("pressed", this, "_stage_all"); stage_buttons->add_child(stage_all_button); commit_box_vbc->add_child(memnew(HSeparator)); @@ -537,7 +537,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { commit_button = memnew(Button); commit_button->set_text(TTR("Commit Changes")); - commit_button->connect("pressed", this, "_send_commit_msg"); + commit_button->connect_compat("pressed", this, "_send_commit_msg"); commit_box_vbc->add_child(commit_button); commit_status = memnew(Label); @@ -571,7 +571,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { diff_refresh_button = memnew(Button); diff_refresh_button->set_tooltip(TTR("Detect changes in file diff")); diff_refresh_button->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Reload", "EditorIcons")); - diff_refresh_button->connect("pressed", this, "_refresh_file_diff"); + diff_refresh_button->connect_compat("pressed", this, "_refresh_file_diff"); diff_hbc->add_child(diff_refresh_button); diff = memnew(RichTextLabel); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 6c8c1b44dc..826af88571 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -72,14 +72,14 @@ void VisualShaderEditor::edit(VisualShader *p_visual_shader) { } } visual_shader = Ref<VisualShader>(p_visual_shader); - if (!visual_shader->is_connected("changed", this, "_update_preview")) { - visual_shader->connect("changed", this, "_update_preview"); + if (!visual_shader->is_connected_compat("changed", this, "_update_preview")) { + visual_shader->connect_compat("changed", this, "_update_preview"); } visual_shader->set_graph_offset(graph->get_scroll_ofs() / EDSCALE); } else { if (visual_shader.is_valid()) { - if (visual_shader->is_connected("changed", this, "")) { - visual_shader->disconnect("changed", this, "_update_preview"); + if (visual_shader->is_connected_compat("changed", this, "")) { + visual_shader->disconnect_compat("changed", this, "_update_preview"); } } visual_shader.unref(); @@ -529,7 +529,7 @@ void VisualShaderEditor::_update_graph() { size = group_node->get_size(); node->set_resizable(true); - node->connect("resize_request", this, "_node_resized", varray((int)type, nodes[n_i])); + node->connect_compat("resize_request", this, "_node_resized", varray((int)type, nodes[n_i])); } if (is_expression) { expression = expression_node->get_expression(); @@ -546,10 +546,10 @@ void VisualShaderEditor::_update_graph() { if (nodes[n_i] >= 2) { node->set_show_close_button(true); - node->connect("close_request", this, "_delete_request", varray(nodes[n_i]), CONNECT_DEFERRED); + node->connect_compat("close_request", this, "_delete_request", varray(nodes[n_i]), CONNECT_DEFERRED); } - node->connect("dragged", this, "_node_dragged", varray(nodes[n_i])); + node->connect_compat("dragged", this, "_node_dragged", varray(nodes[n_i])); Control *custom_editor = NULL; int port_offset = 0; @@ -567,8 +567,8 @@ void VisualShaderEditor::_update_graph() { LineEdit *uniform_name = memnew(LineEdit); uniform_name->set_text(uniform->get_uniform_name()); node->add_child(uniform_name); - uniform_name->connect("text_entered", this, "_line_edit_changed", varray(uniform_name, nodes[n_i])); - uniform_name->connect("focus_exited", this, "_line_edit_focus_out", varray(uniform_name, nodes[n_i])); + uniform_name->connect_compat("text_entered", this, "_line_edit_changed", varray(uniform_name, nodes[n_i])); + uniform_name->connect_compat("focus_exited", this, "_line_edit_focus_out", varray(uniform_name, nodes[n_i])); if (vsnode->get_input_port_count() == 0 && vsnode->get_output_port_count() == 1 && vsnode->get_output_port_name(0) == "") { //shortcut @@ -612,14 +612,14 @@ void VisualShaderEditor::_update_graph() { Button *add_input_btn = memnew(Button); add_input_btn->set_text(TTR("Add Input")); - add_input_btn->connect("pressed", this, "_add_input_port", varray(nodes[n_i], group_node->get_free_input_port_id(), VisualShaderNode::PORT_TYPE_VECTOR, "input" + itos(group_node->get_free_input_port_id())), CONNECT_DEFERRED); + add_input_btn->connect_compat("pressed", this, "_add_input_port", varray(nodes[n_i], group_node->get_free_input_port_id(), VisualShaderNode::PORT_TYPE_VECTOR, "input" + itos(group_node->get_free_input_port_id())), CONNECT_DEFERRED); hb2->add_child(add_input_btn); hb2->add_spacer(); Button *add_output_btn = memnew(Button); add_output_btn->set_text(TTR("Add Output")); - add_output_btn->connect("pressed", this, "_add_output_port", varray(nodes[n_i], group_node->get_free_output_port_id(), VisualShaderNode::PORT_TYPE_VECTOR, "output" + itos(group_node->get_free_output_port_id())), CONNECT_DEFERRED); + add_output_btn->connect_compat("pressed", this, "_add_output_port", varray(nodes[n_i], group_node->get_free_output_port_id(), VisualShaderNode::PORT_TYPE_VECTOR, "output" + itos(group_node->get_free_output_port_id())), CONNECT_DEFERRED); hb2->add_child(add_output_btn); node->add_child(hb2); @@ -667,13 +667,13 @@ void VisualShaderEditor::_update_graph() { if (default_value.get_type() != Variant::NIL) { // only a label Button *button = memnew(Button); hb->add_child(button); - button->connect("pressed", this, "_edit_port_default_input", varray(button, nodes[n_i], i)); + button->connect_compat("pressed", this, "_edit_port_default_input", varray(button, nodes[n_i], i)); switch (default_value.get_type()) { case Variant::COLOR: { button->set_custom_minimum_size(Size2(30, 0) * EDSCALE); - button->connect("draw", this, "_draw_color_over_button", varray(button, default_value)); + button->connect_compat("draw", this, "_draw_color_over_button", varray(button, default_value)); } break; case Variant::BOOL: { button->set_text(((bool)default_value) ? "true" : "false"); @@ -708,20 +708,20 @@ void VisualShaderEditor::_update_graph() { type_box->add_item(TTR("Sampler")); type_box->select(group_node->get_input_port_type(i)); type_box->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); - type_box->connect("item_selected", this, "_change_input_port_type", varray(nodes[n_i], i), CONNECT_DEFERRED); + type_box->connect_compat("item_selected", this, "_change_input_port_type", varray(nodes[n_i], i), CONNECT_DEFERRED); LineEdit *name_box = memnew(LineEdit); hb->add_child(name_box); name_box->set_custom_minimum_size(Size2(65 * EDSCALE, 0)); name_box->set_h_size_flags(SIZE_EXPAND_FILL); name_box->set_text(name_left); - name_box->connect("text_entered", this, "_change_input_port_name", varray(name_box, nodes[n_i], i)); - name_box->connect("focus_exited", this, "_port_name_focus_out", varray(name_box, nodes[n_i], i, false)); + name_box->connect_compat("text_entered", this, "_change_input_port_name", varray(name_box, nodes[n_i], i)); + name_box->connect_compat("focus_exited", this, "_port_name_focus_out", varray(name_box, nodes[n_i], i, false)); Button *remove_btn = memnew(Button); remove_btn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons")); remove_btn->set_tooltip(TTR("Remove") + " " + name_left); - remove_btn->connect("pressed", this, "_remove_input_port", varray(nodes[n_i], i), CONNECT_DEFERRED); + remove_btn->connect_compat("pressed", this, "_remove_input_port", varray(nodes[n_i], i), CONNECT_DEFERRED); hb->add_child(remove_btn); } else { @@ -750,7 +750,7 @@ void VisualShaderEditor::_update_graph() { Button *remove_btn = memnew(Button); remove_btn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons")); remove_btn->set_tooltip(TTR("Remove") + " " + name_left); - remove_btn->connect("pressed", this, "_remove_output_port", varray(nodes[n_i], i), CONNECT_DEFERRED); + remove_btn->connect_compat("pressed", this, "_remove_output_port", varray(nodes[n_i], i), CONNECT_DEFERRED); hb->add_child(remove_btn); LineEdit *name_box = memnew(LineEdit); @@ -758,8 +758,8 @@ void VisualShaderEditor::_update_graph() { name_box->set_custom_minimum_size(Size2(65 * EDSCALE, 0)); name_box->set_h_size_flags(SIZE_EXPAND_FILL); name_box->set_text(name_right); - name_box->connect("text_entered", this, "_change_output_port_name", varray(name_box, nodes[n_i], i)); - name_box->connect("focus_exited", this, "_port_name_focus_out", varray(name_box, nodes[n_i], i, true)); + name_box->connect_compat("text_entered", this, "_change_output_port_name", varray(name_box, nodes[n_i], i)); + name_box->connect_compat("focus_exited", this, "_port_name_focus_out", varray(name_box, nodes[n_i], i, true)); OptionButton *type_box = memnew(OptionButton); hb->add_child(type_box); @@ -769,7 +769,7 @@ void VisualShaderEditor::_update_graph() { type_box->add_item(TTR("Transform")); type_box->select(group_node->get_output_port_type(i)); type_box->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); - type_box->connect("item_selected", this, "_change_output_port_type", varray(nodes[n_i], i), CONNECT_DEFERRED); + type_box->connect_compat("item_selected", this, "_change_output_port_type", varray(nodes[n_i], i), CONNECT_DEFERRED); } else { Label *label = memnew(Label); label->set_text(name_right); @@ -790,7 +790,7 @@ void VisualShaderEditor::_update_graph() { preview->set_pressed(true); } - preview->connect("pressed", this, "_preview_select_port", varray(nodes[n_i], i), CONNECT_DEFERRED); + preview->connect_compat("pressed", this, "_preview_select_port", varray(nodes[n_i], i), CONNECT_DEFERRED); hb->add_child(preview); } @@ -863,7 +863,7 @@ void VisualShaderEditor::_update_graph() { expression_box->set_context_menu_enabled(false); expression_box->set_show_line_numbers(true); - expression_box->connect("focus_exited", this, "_expression_focus_out", varray(expression_box, nodes[n_i])); + expression_box->connect_compat("focus_exited", this, "_expression_focus_out", varray(expression_box, nodes[n_i])); } if (!uniform.is_valid()) { @@ -2327,17 +2327,17 @@ VisualShaderEditor::VisualShaderEditor() { graph->add_valid_right_disconnect_type(VisualShaderNode::PORT_TYPE_SAMPLER); //graph->add_valid_left_disconnect_type(0); graph->set_v_size_flags(SIZE_EXPAND_FILL); - graph->connect("connection_request", this, "_connection_request", varray(), CONNECT_DEFERRED); - graph->connect("disconnection_request", this, "_disconnection_request", varray(), CONNECT_DEFERRED); - graph->connect("node_selected", this, "_node_selected"); - graph->connect("scroll_offset_changed", this, "_scroll_changed"); - graph->connect("duplicate_nodes_request", this, "_duplicate_nodes"); - graph->connect("copy_nodes_request", this, "_copy_nodes"); - graph->connect("paste_nodes_request", this, "_paste_nodes"); - graph->connect("delete_nodes_request", this, "_on_nodes_delete"); - graph->connect("gui_input", this, "_graph_gui_input"); - graph->connect("connection_to_empty", this, "_connection_to_empty"); - graph->connect("connection_from_empty", this, "_connection_from_empty"); + graph->connect_compat("connection_request", this, "_connection_request", varray(), CONNECT_DEFERRED); + graph->connect_compat("disconnection_request", this, "_disconnection_request", varray(), CONNECT_DEFERRED); + graph->connect_compat("node_selected", this, "_node_selected"); + graph->connect_compat("scroll_offset_changed", this, "_scroll_changed"); + graph->connect_compat("duplicate_nodes_request", this, "_duplicate_nodes"); + graph->connect_compat("copy_nodes_request", this, "_copy_nodes"); + graph->connect_compat("paste_nodes_request", this, "_paste_nodes"); + graph->connect_compat("delete_nodes_request", this, "_on_nodes_delete"); + graph->connect_compat("gui_input", this, "_graph_gui_input"); + graph->connect_compat("connection_to_empty", this, "_connection_to_empty"); + graph->connect_compat("connection_from_empty", this, "_connection_from_empty"); graph->add_valid_connection_type(VisualShaderNode::PORT_TYPE_SCALAR, VisualShaderNode::PORT_TYPE_SCALAR); graph->add_valid_connection_type(VisualShaderNode::PORT_TYPE_SCALAR, VisualShaderNode::PORT_TYPE_VECTOR); graph->add_valid_connection_type(VisualShaderNode::PORT_TYPE_SCALAR, VisualShaderNode::PORT_TYPE_BOOLEAN); @@ -2359,7 +2359,7 @@ VisualShaderEditor::VisualShaderEditor() { edit_type->add_item(TTR("Fragment")); edit_type->add_item(TTR("Light")); edit_type->select(1); - edit_type->connect("item_selected", this, "_mode_selected"); + edit_type->connect_compat("item_selected", this, "_mode_selected"); graph->get_zoom_hbox()->add_child(edit_type); graph->get_zoom_hbox()->move_child(edit_type, 0); @@ -2367,13 +2367,13 @@ VisualShaderEditor::VisualShaderEditor() { graph->get_zoom_hbox()->add_child(add_node); add_node->set_text(TTR("Add Node...")); graph->get_zoom_hbox()->move_child(add_node, 0); - add_node->connect("pressed", this, "_show_members_dialog", varray(false)); + add_node->connect_compat("pressed", this, "_show_members_dialog", varray(false)); preview_shader = memnew(ToolButton); preview_shader->set_toggle_mode(true); preview_shader->set_tooltip(TTR("Show resulted shader code.")); graph->get_zoom_hbox()->add_child(preview_shader); - preview_shader->connect("pressed", this, "_show_preview_text"); + preview_shader->connect_compat("pressed", this, "_show_preview_text"); /////////////////////////////////////// // PREVIEW PANEL @@ -2407,15 +2407,15 @@ VisualShaderEditor::VisualShaderEditor() { node_filter = memnew(LineEdit); filter_hb->add_child(node_filter); - node_filter->connect("text_changed", this, "_member_filter_changed"); - node_filter->connect("gui_input", this, "_sbox_input"); + node_filter->connect_compat("text_changed", this, "_member_filter_changed"); + node_filter->connect_compat("gui_input", this, "_sbox_input"); node_filter->set_h_size_flags(SIZE_EXPAND_FILL); node_filter->set_placeholder(TTR("Search")); tools = memnew(MenuButton); filter_hb->add_child(tools); tools->set_tooltip(TTR("Options")); - tools->get_popup()->connect("id_pressed", this, "_tools_menu_option"); + tools->get_popup()->connect_compat("id_pressed", this, "_tools_menu_option"); tools->get_popup()->add_item(TTR("Expand All"), EXPAND_ALL); tools->get_popup()->add_item(TTR("Collapse All"), COLLAPSE_ALL); @@ -2428,9 +2428,9 @@ VisualShaderEditor::VisualShaderEditor() { members->set_allow_reselect(true); members->set_hide_folding(false); members->set_custom_minimum_size(Size2(180 * EDSCALE, 200 * EDSCALE)); - members->connect("item_activated", this, "_member_create"); - members->connect("item_selected", this, "_member_selected"); - members->connect("nothing_selected", this, "_member_unselected"); + members->connect_compat("item_activated", this, "_member_create"); + members->connect_compat("item_selected", this, "_member_selected"); + members->connect_compat("nothing_selected", this, "_member_unselected"); HBoxContainer *desc_hbox = memnew(HBoxContainer); members_vb->add_child(desc_hbox); @@ -2458,11 +2458,11 @@ VisualShaderEditor::VisualShaderEditor() { members_dialog->set_title(TTR("Create Shader Node")); members_dialog->add_child(members_vb); members_dialog->get_ok()->set_text(TTR("Create")); - members_dialog->get_ok()->connect("pressed", this, "_member_create"); + members_dialog->get_ok()->connect_compat("pressed", this, "_member_create"); members_dialog->get_ok()->set_disabled(true); members_dialog->set_resizable(true); members_dialog->set_as_minsize(); - members_dialog->connect("hide", this, "_member_cancel"); + members_dialog->connect_compat("hide", this, "_member_cancel"); add_child(members_dialog); alert = memnew(AcceptDialog); @@ -2841,7 +2841,7 @@ VisualShaderEditor::VisualShaderEditor() { property_editor = memnew(CustomPropertyEditor); add_child(property_editor); - property_editor->connect("variant_changed", this, "_port_edited"); + property_editor->connect_compat("variant_changed", this, "_port_edited"); } void VisualShaderEditorPlugin::edit(Object *p_object) { @@ -2902,7 +2902,7 @@ protected: public: void _notification(int p_what) { if (p_what == NOTIFICATION_READY) { - connect("item_selected", this, "_item_selected"); + connect_compat("item_selected", this, "_item_selected"); } } @@ -3031,16 +3031,16 @@ public: bool res_prop = Object::cast_to<EditorPropertyResource>(p_properties[i]); if (res_prop) { - p_properties[i]->connect("resource_selected", this, "_resource_selected"); + p_properties[i]->connect_compat("resource_selected", this, "_resource_selected"); } - properties[i]->connect("property_changed", this, "_property_changed"); + properties[i]->connect_compat("property_changed", this, "_property_changed"); properties[i]->set_object_and_property(node.ptr(), p_names[i]); properties[i]->update_property(); properties[i]->set_name_split_ratio(0); } - node->connect("changed", this, "_node_changed"); - node->connect("editor_refresh_request", this, "_refresh_request", varray(), CONNECT_DEFERRED); + node->connect_compat("changed", this, "_node_changed"); + node->connect_compat("editor_refresh_request", this, "_refresh_request", varray(), CONNECT_DEFERRED); } static void _bind_methods() { @@ -3206,7 +3206,7 @@ EditorPropertyShaderMode::EditorPropertyShaderMode() { options->set_clip_text(true); add_child(options); add_focusable(options); - options->connect("item_selected", this, "_option_selected"); + options->connect_compat("item_selected", this, "_option_selected"); } bool EditorInspectorShaderModePlugin::can_handle(Object *p_object) { @@ -3279,7 +3279,7 @@ void VisualShaderNodePortPreview::_shader_changed() { void VisualShaderNodePortPreview::setup(const Ref<VisualShader> &p_shader, VisualShader::Type p_type, int p_node, int p_port) { shader = p_shader; - shader->connect("changed", this, "_shader_changed"); + shader->connect_compat("changed", this, "_shader_changed"); type = p_type; port = p_port; node = p_node; diff --git a/editor/progress_dialog.cpp b/editor/progress_dialog.cpp index 0665b1d013..59db531581 100644 --- a/editor/progress_dialog.cpp +++ b/editor/progress_dialog.cpp @@ -264,5 +264,5 @@ ProgressDialog::ProgressDialog() { cancel_hb->add_child(cancel); cancel->set_text(TTR("Cancel")); cancel_hb->add_spacer(); - cancel->connect("pressed", this, "_cancel_pressed"); + cancel->connect_compat("pressed", this, "_cancel_pressed"); } diff --git a/editor/project_export.cpp b/editor/project_export.cpp index 3c8fef6233..753125eb03 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -53,7 +53,7 @@ void ProjectExportDialog::_notification(int p_what) { case NOTIFICATION_READY: { duplicate_preset->set_icon(get_icon("Duplicate", "EditorIcons")); delete_preset->set_icon(get_icon("Remove", "EditorIcons")); - connect("confirmed", this, "_export_pck_zip"); + connect_compat("confirmed", this, "_export_pck_zip"); custom_feature_display->get_parent_control()->add_style_override("panel", get_stylebox("bg", "Tree")); } break; case NOTIFICATION_POPUP_HIDE: { @@ -913,10 +913,10 @@ void ProjectExportDialog::_validate_export_path(const String &p_path) { if (invalid_path) { export_project->get_ok()->set_disabled(true); - export_project->get_line_edit()->disconnect("text_entered", export_project, "_file_entered"); + export_project->get_line_edit()->disconnect_compat("text_entered", export_project, "_file_entered"); } else { export_project->get_ok()->set_disabled(false); - export_project->get_line_edit()->connect("text_entered", export_project, "_file_entered"); + export_project->get_line_edit()->connect_compat("text_entered", export_project, "_file_entered"); } } @@ -946,9 +946,9 @@ void ProjectExportDialog::_export_project() { } // Ensure that signal is connected if previous attempt left it disconnected with _validate_export_path - if (!export_project->get_line_edit()->is_connected("text_entered", export_project, "_file_entered")) { + if (!export_project->get_line_edit()->is_connected_compat("text_entered", export_project, "_file_entered")) { export_project->get_ok()->set_disabled(false); - export_project->get_line_edit()->connect("text_entered", export_project, "_file_entered"); + export_project->get_line_edit()->connect_compat("text_entered", export_project, "_file_entered"); } export_project->set_mode(EditorFileDialog::MODE_SAVE_FILE); @@ -1085,7 +1085,7 @@ ProjectExportDialog::ProjectExportDialog() { add_preset = memnew(MenuButton); add_preset->set_text(TTR("Add...")); - add_preset->get_popup()->connect("index_pressed", this, "_add_preset"); + add_preset->get_popup()->connect_compat("index_pressed", this, "_add_preset"); preset_hb->add_child(add_preset); MarginContainer *mc = memnew(MarginContainer); preset_vb->add_child(mc); @@ -1093,13 +1093,13 @@ ProjectExportDialog::ProjectExportDialog() { presets = memnew(ItemList); presets->set_drag_forwarding(this); mc->add_child(presets); - presets->connect("item_selected", this, "_edit_preset"); + presets->connect_compat("item_selected", this, "_edit_preset"); duplicate_preset = memnew(ToolButton); preset_hb->add_child(duplicate_preset); - duplicate_preset->connect("pressed", this, "_duplicate_preset"); + duplicate_preset->connect_compat("pressed", this, "_duplicate_preset"); delete_preset = memnew(ToolButton); preset_hb->add_child(delete_preset); - delete_preset->connect("pressed", this, "_delete_preset"); + delete_preset->connect_compat("pressed", this, "_delete_preset"); // Preset settings. @@ -1109,11 +1109,11 @@ ProjectExportDialog::ProjectExportDialog() { name = memnew(LineEdit); settings_vb->add_margin_child(TTR("Name:"), name); - name->connect("text_changed", this, "_name_changed"); + name->connect_compat("text_changed", this, "_name_changed"); runnable = memnew(CheckButton); runnable->set_text(TTR("Runnable")); runnable->set_tooltip(TTR("If checked, the preset will be available for use in one-click deploy.\nOnly one preset per platform may be marked as runnable.")); - runnable->connect("pressed", this, "_runnable_pressed"); + runnable->connect_compat("pressed", this, "_runnable_pressed"); settings_vb->add_child(runnable); export_path = memnew(EditorPropertyPath); @@ -1121,7 +1121,7 @@ ProjectExportDialog::ProjectExportDialog() { export_path->set_label(TTR("Export Path")); export_path->set_object_and_property(this, "export_path"); export_path->set_save_mode(); - export_path->connect("property_changed", this, "_export_path_changed"); + export_path->connect_compat("property_changed", this, "_export_path_changed"); // Subsections. @@ -1137,7 +1137,7 @@ ProjectExportDialog::ProjectExportDialog() { sections->add_child(parameters); parameters->set_name(TTR("Options")); parameters->set_v_size_flags(SIZE_EXPAND_FILL); - parameters->connect("property_edited", this, "_update_parameters"); + parameters->connect_compat("property_edited", this, "_update_parameters"); // Resources export parameters. @@ -1150,7 +1150,7 @@ ProjectExportDialog::ProjectExportDialog() { export_filter->add_item(TTR("Export selected scenes (and dependencies)")); export_filter->add_item(TTR("Export selected resources (and dependencies)")); resources_vb->add_margin_child(TTR("Export Mode:"), export_filter); - export_filter->connect("item_selected", this, "_export_type_changed"); + export_filter->connect_compat("item_selected", this, "_export_type_changed"); include_label = memnew(Label); include_label->set_text(TTR("Resources to export:")); @@ -1161,19 +1161,19 @@ ProjectExportDialog::ProjectExportDialog() { include_files = memnew(Tree); include_margin->add_child(include_files); - include_files->connect("item_edited", this, "_tree_changed"); + include_files->connect_compat("item_edited", this, "_tree_changed"); include_filters = memnew(LineEdit); resources_vb->add_margin_child( TTR("Filters to export non-resource files/folders\n(comma-separated, e.g: *.json, *.txt, docs/*)"), include_filters); - include_filters->connect("text_changed", this, "_filter_changed"); + include_filters->connect_compat("text_changed", this, "_filter_changed"); exclude_filters = memnew(LineEdit); resources_vb->add_margin_child( TTR("Filters to exclude files/folders from project\n(comma-separated, e.g: *.json, *.txt, docs/*)"), exclude_filters); - exclude_filters->connect("text_changed", this, "_filter_changed"); + exclude_filters->connect_compat("text_changed", this, "_filter_changed"); // Patch packages. @@ -1190,8 +1190,8 @@ ProjectExportDialog::ProjectExportDialog() { patch_vb->add_child(patches); patches->set_v_size_flags(SIZE_EXPAND_FILL); patches->set_hide_root(true); - patches->connect("button_pressed", this, "_patch_button_pressed"); - patches->connect("item_edited", this, "_patch_edited"); + patches->connect_compat("button_pressed", this, "_patch_button_pressed"); + patches->connect_compat("item_edited", this, "_patch_edited"); patches->set_drag_forwarding(this); patches->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true); @@ -1206,12 +1206,12 @@ ProjectExportDialog::ProjectExportDialog() { patch_dialog = memnew(EditorFileDialog); patch_dialog->add_filter("*.pck ; " + TTR("Pack File")); patch_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE); - patch_dialog->connect("file_selected", this, "_patch_selected"); + patch_dialog->connect_compat("file_selected", this, "_patch_selected"); add_child(patch_dialog); patch_erase = memnew(ConfirmationDialog); patch_erase->get_ok()->set_text(TTR("Delete")); - patch_erase->connect("confirmed", this, "_patch_deleted"); + patch_erase->connect_compat("confirmed", this, "_patch_deleted"); add_child(patch_erase); // Feature tags. @@ -1219,7 +1219,7 @@ ProjectExportDialog::ProjectExportDialog() { VBoxContainer *feature_vb = memnew(VBoxContainer); feature_vb->set_name(TTR("Features")); custom_features = memnew(LineEdit); - custom_features->connect("text_changed", this, "_custom_features_changed"); + custom_features->connect_compat("text_changed", this, "_custom_features_changed"); feature_vb->add_margin_child(TTR("Custom (comma-separated):"), custom_features); Panel *features_panel = memnew(Panel); custom_feature_display = memnew(RichTextLabel); @@ -1240,9 +1240,9 @@ ProjectExportDialog::ProjectExportDialog() { script_mode->add_item(TTR("Text"), (int)EditorExportPreset::MODE_SCRIPT_TEXT); script_mode->add_item(TTR("Compiled"), (int)EditorExportPreset::MODE_SCRIPT_COMPILED); script_mode->add_item(TTR("Encrypted (Provide Key Below)"), (int)EditorExportPreset::MODE_SCRIPT_ENCRYPTED); - script_mode->connect("item_selected", this, "_script_export_mode_changed"); + script_mode->connect_compat("item_selected", this, "_script_export_mode_changed"); script_key = memnew(LineEdit); - script_key->connect("text_changed", this, "_script_encryption_key_changed"); + script_key->connect_compat("text_changed", this, "_script_encryption_key_changed"); script_key_error = memnew(Label); script_key_error->set_text("- " + TTR("Invalid Encryption Key (must be 64 characters long)")); script_key_error->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor")); @@ -1250,7 +1250,7 @@ ProjectExportDialog::ProjectExportDialog() { script_vb->add_child(script_key_error); sections->add_child(script_vb); - sections->connect("tab_changed", this, "_tab_changed"); + sections->connect_compat("tab_changed", this, "_tab_changed"); // Disable by default. name->set_editable(false); @@ -1267,7 +1267,7 @@ ProjectExportDialog::ProjectExportDialog() { delete_confirm = memnew(ConfirmationDialog); add_child(delete_confirm); delete_confirm->get_ok()->set_text(TTR("Delete")); - delete_confirm->connect("confirmed", this, "_delete_preset_confirm"); + delete_confirm->connect_compat("confirmed", this, "_delete_preset_confirm"); // Export buttons, dialogs and errors. @@ -1276,7 +1276,7 @@ ProjectExportDialog::ProjectExportDialog() { get_cancel()->set_text(TTR("Close")); get_ok()->set_text(TTR("Export PCK/Zip")); export_button = add_button(TTR("Export Project"), !OS::get_singleton()->get_swap_ok_cancel(), "export"); - export_button->connect("pressed", this, "_export_project"); + export_button->connect_compat("pressed", this, "_export_project"); // Disable initially before we select a valid preset export_button->set_disabled(true); get_ok()->set_disabled(true); @@ -1288,10 +1288,10 @@ ProjectExportDialog::ProjectExportDialog() { export_all_dialog->get_ok()->hide(); export_all_dialog->add_button(TTR("Debug"), true, "debug"); export_all_dialog->add_button(TTR("Release"), true, "release"); - export_all_dialog->connect("custom_action", this, "_export_all_dialog_action"); + export_all_dialog->connect_compat("custom_action", this, "_export_all_dialog_action"); export_all_button = add_button(TTR("Export All"), !OS::get_singleton()->get_swap_ok_cancel(), "export"); - export_all_button->connect("pressed", this, "_export_all_dialog"); + export_all_button->connect_compat("pressed", this, "_export_all_dialog"); export_all_button->set_disabled(true); export_pck_zip = memnew(EditorFileDialog); @@ -1300,7 +1300,7 @@ ProjectExportDialog::ProjectExportDialog() { export_pck_zip->set_access(EditorFileDialog::ACCESS_FILESYSTEM); export_pck_zip->set_mode(EditorFileDialog::MODE_SAVE_FILE); add_child(export_pck_zip); - export_pck_zip->connect("file_selected", this, "_export_pck_zip_selected"); + export_pck_zip->connect_compat("file_selected", this, "_export_pck_zip_selected"); export_error = memnew(Label); main_vb->add_child(export_error); @@ -1326,13 +1326,13 @@ ProjectExportDialog::ProjectExportDialog() { download_templates->set_text(TTR("Manage Export Templates")); download_templates->set_v_size_flags(SIZE_SHRINK_CENTER); export_templates_error->add_child(download_templates); - download_templates->connect("pressed", this, "_open_export_template_manager"); + download_templates->connect_compat("pressed", this, "_open_export_template_manager"); export_project = memnew(EditorFileDialog); export_project->set_access(EditorFileDialog::ACCESS_FILESYSTEM); add_child(export_project); - export_project->connect("file_selected", this, "_export_project_to_path"); - export_project->get_line_edit()->connect("text_changed", this, "_validate_export_path"); + export_project->connect_compat("file_selected", this, "_export_project_to_path"); + export_project->get_line_edit()->connect_compat("text_changed", this, "_validate_export_path"); export_debug = memnew(CheckBox); export_debug->set_text(TTR("Export With Debug")); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 1dbd7f46d7..23a7628eeb 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -811,7 +811,7 @@ public: create_dir = memnew(Button); pnhb->add_child(create_dir); create_dir->set_text(TTR("Create Folder")); - create_dir->connect("pressed", this, "_create_folder"); + create_dir->connect_compat("pressed", this, "_create_folder"); path_container = memnew(VBoxContainer); vb->add_child(path_container); @@ -848,7 +848,7 @@ public: browse = memnew(Button); browse->set_text(TTR("Browse")); - browse->connect("pressed", this, "_browse_path"); + browse->connect_compat("pressed", this, "_browse_path"); pphb->add_child(browse); // install status icon @@ -858,7 +858,7 @@ public: install_browse = memnew(Button); install_browse->set_text(TTR("Browse")); - install_browse->connect("pressed", this, "_browse_install_path"); + install_browse->connect_compat("pressed", this, "_browse_install_path"); iphb->add_child(install_browse); msg = memnew(Label); @@ -928,13 +928,13 @@ public: fdialog_install->set_access(FileDialog::ACCESS_FILESYSTEM); add_child(fdialog); add_child(fdialog_install); - project_name->connect("text_changed", this, "_text_changed"); - project_path->connect("text_changed", this, "_path_text_changed"); - install_path->connect("text_changed", this, "_path_text_changed"); - fdialog->connect("dir_selected", this, "_path_selected"); - fdialog->connect("file_selected", this, "_file_selected"); - fdialog_install->connect("dir_selected", this, "_install_path_selected"); - fdialog_install->connect("file_selected", this, "_install_path_selected"); + project_name->connect_compat("text_changed", this, "_text_changed"); + project_path->connect_compat("text_changed", this, "_path_text_changed"); + install_path->connect_compat("text_changed", this, "_path_text_changed"); + fdialog->connect_compat("dir_selected", this, "_path_selected"); + fdialog->connect_compat("file_selected", this, "_file_selected"); + fdialog_install->connect_compat("dir_selected", this, "_install_path_selected"); + fdialog_install->connect_compat("file_selected", this, "_install_path_selected"); set_hide_on_ok(false); mode = MODE_NEW; @@ -1320,8 +1320,8 @@ void ProjectList::create_project_item_control(int p_index) { Color font_color = get_color("font_color", "Tree"); ProjectListItemControl *hb = memnew(ProjectListItemControl); - hb->connect("draw", this, "_panel_draw", varray(hb)); - hb->connect("gui_input", this, "_panel_input", varray(hb)); + hb->connect_compat("draw", this, "_panel_draw", varray(hb)); + hb->connect_compat("gui_input", this, "_panel_input", varray(hb)); hb->add_constant_override("separation", 10 * EDSCALE); hb->set_tooltip(item.description); @@ -1332,7 +1332,7 @@ void ProjectList::create_project_item_control(int p_index) { favorite->set_normal_texture(favorite_icon); // This makes the project's "hover" style display correctly when hovering the favorite icon favorite->set_mouse_filter(MOUSE_FILTER_PASS); - favorite->connect("pressed", this, "_favorite_pressed", varray(hb)); + favorite->connect_compat("pressed", this, "_favorite_pressed", varray(hb)); favorite_box->add_child(favorite); favorite_box->set_alignment(BoxContainer::ALIGN_CENTER); hb->add_child(favorite_box); @@ -1380,7 +1380,7 @@ void ProjectList::create_project_item_control(int p_index) { path_hb->add_child(show); if (!item.missing) { - show->connect("pressed", this, "_show_project", varray(item.path)); + show->connect_compat("pressed", this, "_show_project", varray(item.path)); show->set_tooltip(TTR("Show in File Manager")); } else { show->set_tooltip(TTR("Error: Project is missing on the filesystem.")); @@ -2358,8 +2358,8 @@ void ProjectManager::_files_dropped(PackedStringArray p_files, int p_screen) { memdelete(dir); } if (confirm) { - multi_scan_ask->get_ok()->disconnect("pressed", this, "_scan_multiple_folders"); - multi_scan_ask->get_ok()->connect("pressed", this, "_scan_multiple_folders", varray(folders)); + multi_scan_ask->get_ok()->disconnect_compat("pressed", this, "_scan_multiple_folders"); + multi_scan_ask->get_ok()->connect_compat("pressed", this, "_scan_multiple_folders", varray(folders)); multi_scan_ask->set_text( vformat(TTR("Are you sure to scan %s folders for existing Godot projects?\nThis could take a while."), folders.size())); multi_scan_ask->popup_centered_minsize(); @@ -2524,7 +2524,7 @@ ProjectManager::ProjectManager() { project_order_filter->_setup_filters(sort_filter_titles); project_order_filter->set_filter_size(150); sort_filters->add_child(project_order_filter); - project_order_filter->connect("filter_changed", this, "_on_order_option_changed"); + project_order_filter->connect_compat("filter_changed", this, "_on_order_option_changed"); project_order_filter->set_custom_minimum_size(Size2(180, 10) * EDSCALE); int projects_sorting_order = (int)EditorSettings::get_singleton()->get("project_manager/sorting_order"); @@ -2534,7 +2534,7 @@ ProjectManager::ProjectManager() { project_filter = memnew(ProjectListFilter); project_filter->add_search_box(); - project_filter->connect("filter_changed", this, "_on_filter_option_changed"); + project_filter->connect_compat("filter_changed", this, "_on_filter_option_changed"); project_filter->set_custom_minimum_size(Size2(280, 10) * EDSCALE); sort_filters->add_child(project_filter); @@ -2546,8 +2546,8 @@ ProjectManager::ProjectManager() { pc->set_v_size_flags(SIZE_EXPAND_FILL); _project_list = memnew(ProjectList); - _project_list->connect(ProjectList::SIGNAL_SELECTION_CHANGED, this, "_update_project_buttons"); - _project_list->connect(ProjectList::SIGNAL_PROJECT_ASK_OPEN, this, "_open_selected_projects_ask"); + _project_list->connect_compat(ProjectList::SIGNAL_SELECTION_CHANGED, this, "_update_project_buttons"); + _project_list->connect_compat(ProjectList::SIGNAL_PROJECT_ASK_OPEN, this, "_open_selected_projects_ask"); pc->add_child(_project_list); _project_list->set_enable_h_scroll(false); @@ -2557,13 +2557,13 @@ ProjectManager::ProjectManager() { Button *open = memnew(Button); open->set_text(TTR("Edit")); tree_vb->add_child(open); - open->connect("pressed", this, "_open_selected_projects_ask"); + open->connect_compat("pressed", this, "_open_selected_projects_ask"); open_btn = open; Button *run = memnew(Button); run->set_text(TTR("Run")); tree_vb->add_child(run); - run->connect("pressed", this, "_run_project"); + run->connect_compat("pressed", this, "_run_project"); run_btn = run; tree_vb->add_child(memnew(HSeparator)); @@ -2571,7 +2571,7 @@ ProjectManager::ProjectManager() { Button *scan = memnew(Button); scan->set_text(TTR("Scan")); tree_vb->add_child(scan); - scan->connect("pressed", this, "_scan_projects"); + scan->connect_compat("pressed", this, "_scan_projects"); tree_vb->add_child(memnew(HSeparator)); @@ -2581,34 +2581,34 @@ ProjectManager::ProjectManager() { scan_dir->set_title(TTR("Select a Folder to Scan")); // must be after mode or it's overridden scan_dir->set_current_dir(EditorSettings::get_singleton()->get("filesystem/directories/default_project_path")); gui_base->add_child(scan_dir); - scan_dir->connect("dir_selected", this, "_scan_begin"); + scan_dir->connect_compat("dir_selected", this, "_scan_begin"); Button *create = memnew(Button); create->set_text(TTR("New Project")); tree_vb->add_child(create); - create->connect("pressed", this, "_new_project"); + create->connect_compat("pressed", this, "_new_project"); Button *import = memnew(Button); import->set_text(TTR("Import")); tree_vb->add_child(import); - import->connect("pressed", this, "_import_project"); + import->connect_compat("pressed", this, "_import_project"); Button *rename = memnew(Button); rename->set_text(TTR("Rename")); tree_vb->add_child(rename); - rename->connect("pressed", this, "_rename_project"); + rename->connect_compat("pressed", this, "_rename_project"); rename_btn = rename; Button *erase = memnew(Button); erase->set_text(TTR("Remove")); tree_vb->add_child(erase); - erase->connect("pressed", this, "_erase_project"); + erase->connect_compat("pressed", this, "_erase_project"); erase_btn = erase; Button *erase_missing = memnew(Button); erase_missing->set_text(TTR("Remove Missing")); tree_vb->add_child(erase_missing); - erase_missing->connect("pressed", this, "_erase_missing_projects"); + erase_missing->connect_compat("pressed", this, "_erase_missing_projects"); erase_missing_btn = erase_missing; tree_vb->add_spacer(); @@ -2617,7 +2617,7 @@ ProjectManager::ProjectManager() { asset_library = memnew(EditorAssetLibrary(true)); asset_library->set_name(TTR("Templates")); tabs->add_child(asset_library); - asset_library->connect("install_asset", this, "_install_project"); + asset_library->connect_compat("install_asset", this, "_install_project"); } else { WARN_PRINT("Asset Library not available, as it requires SSL to work."); } @@ -2664,7 +2664,7 @@ ProjectManager::ProjectManager() { language_btn->set_icon(get_icon("Environment", "EditorIcons")); settings_hb->add_child(language_btn); - language_btn->connect("item_selected", this, "_language_selected"); + language_btn->connect_compat("item_selected", this, "_language_selected"); center_box->add_child(settings_hb); settings_hb->set_anchors_and_margins_preset(Control::PRESET_TOP_RIGHT); @@ -2673,28 +2673,28 @@ ProjectManager::ProjectManager() { language_restart_ask = memnew(ConfirmationDialog); language_restart_ask->get_ok()->set_text(TTR("Restart Now")); - language_restart_ask->get_ok()->connect("pressed", this, "_restart_confirm"); + language_restart_ask->get_ok()->connect_compat("pressed", this, "_restart_confirm"); language_restart_ask->get_cancel()->set_text(TTR("Continue")); gui_base->add_child(language_restart_ask); erase_missing_ask = memnew(ConfirmationDialog); erase_missing_ask->get_ok()->set_text(TTR("Remove All")); - erase_missing_ask->get_ok()->connect("pressed", this, "_erase_missing_projects_confirm"); + erase_missing_ask->get_ok()->connect_compat("pressed", this, "_erase_missing_projects_confirm"); gui_base->add_child(erase_missing_ask); erase_ask = memnew(ConfirmationDialog); erase_ask->get_ok()->set_text(TTR("Remove")); - erase_ask->get_ok()->connect("pressed", this, "_erase_project_confirm"); + erase_ask->get_ok()->connect_compat("pressed", this, "_erase_project_confirm"); gui_base->add_child(erase_ask); multi_open_ask = memnew(ConfirmationDialog); multi_open_ask->get_ok()->set_text(TTR("Edit")); - multi_open_ask->get_ok()->connect("pressed", this, "_open_selected_projects"); + multi_open_ask->get_ok()->connect_compat("pressed", this, "_open_selected_projects"); gui_base->add_child(multi_open_ask); multi_run_ask = memnew(ConfirmationDialog); multi_run_ask->get_ok()->set_text(TTR("Run")); - multi_run_ask->get_ok()->connect("pressed", this, "_run_project_confirm"); + multi_run_ask->get_ok()->connect_compat("pressed", this, "_run_project_confirm"); gui_base->add_child(multi_run_ask); multi_scan_ask = memnew(ConfirmationDialog); @@ -2702,7 +2702,7 @@ ProjectManager::ProjectManager() { gui_base->add_child(multi_scan_ask); ask_update_settings = memnew(ConfirmationDialog); - ask_update_settings->get_ok()->connect("pressed", this, "_confirm_update_settings"); + ask_update_settings->get_ok()->connect_compat("pressed", this, "_confirm_update_settings"); gui_base->add_child(ask_update_settings); OS::get_singleton()->set_low_processor_usage_mode(true); @@ -2710,8 +2710,8 @@ ProjectManager::ProjectManager() { npdialog = memnew(ProjectDialog); gui_base->add_child(npdialog); - npdialog->connect("projects_updated", this, "_on_projects_updated"); - npdialog->connect("project_created", this, "_on_project_created"); + npdialog->connect_compat("projects_updated", this, "_on_projects_updated"); + npdialog->connect_compat("project_created", this, "_on_project_created"); _load_recent_projects(); @@ -2719,8 +2719,8 @@ ProjectManager::ProjectManager() { _scan_begin(EditorSettings::get_singleton()->get("filesystem/directories/autoscan_project_path")); } - SceneTree::get_singleton()->connect("files_dropped", this, "_files_dropped"); - SceneTree::get_singleton()->connect("global_menu_action", this, "_global_menu_action"); + SceneTree::get_singleton()->connect_compat("files_dropped", this, "_files_dropped"); + SceneTree::get_singleton()->connect_compat("global_menu_action", this, "_global_menu_action"); run_error_diag = memnew(AcceptDialog); gui_base->add_child(run_error_diag); @@ -2732,7 +2732,7 @@ ProjectManager::ProjectManager() { open_templates = memnew(ConfirmationDialog); open_templates->set_text(TTR("You currently don't have any projects.\nWould you like to explore official example projects in the Asset Library?")); open_templates->get_ok()->set_text(TTR("Open Asset Library")); - open_templates->connect("confirmed", this, "_open_asset_library"); + open_templates->connect_compat("confirmed", this, "_open_asset_library"); add_child(open_templates); } @@ -2793,14 +2793,14 @@ void ProjectListFilter::_bind_methods() { void ProjectListFilter::add_filter_option() { filter_option = memnew(OptionButton); filter_option->set_clip_text(true); - filter_option->connect("item_selected", this, "_filter_option_selected"); + filter_option->connect_compat("item_selected", this, "_filter_option_selected"); add_child(filter_option); } void ProjectListFilter::add_search_box() { search_box = memnew(LineEdit); search_box->set_placeholder(TTR("Search")); - search_box->connect("text_changed", this, "_search_text_changed"); + search_box->connect_compat("text_changed", this, "_search_text_changed"); search_box->set_h_size_flags(SIZE_EXPAND_FILL); add_child(search_box); diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 83593477c7..9bee84b482 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -108,7 +108,7 @@ void ProjectSettingsEditor::_notification(int p_what) { action_add_error->add_color_override("font_color", get_color("error_color", "Editor")); - translation_list->connect("button_pressed", this, "_translation_delete"); + translation_list->connect_compat("button_pressed", this, "_translation_delete"); _update_actions(); popup_add->add_icon_item(get_icon("Keyboard", "EditorIcons"), TTR("Key "), INPUT_KEY); //"Key " - because the word 'key' has already been used as a key animation popup_add->add_icon_item(get_icon("JoyButton", "EditorIcons"), TTR("Joy Button"), INPUT_JOY_BUTTON); @@ -847,7 +847,7 @@ void ProjectSettingsEditor::_item_add() { // Initialize the property with the default value for the given type. // The type list starts at 1 (as we exclude Nil), so add 1 to the selected value. - Variant::CallError ce; + Callable::CallError ce; const Variant value = Variant::construct(Variant::Type(type->get_selected() + 1), NULL, 0, ce); String catname = category->get_text().strip_edges(); @@ -1805,7 +1805,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { search_button->set_pressed(false); search_button->set_text(TTR("Search")); hbc->add_child(search_button); - search_button->connect("toggled", this, "_toggle_search_bar"); + search_button->connect_compat("toggled", this, "_toggle_search_bar"); hbc->add_child(memnew(VSeparator)); @@ -1820,7 +1820,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { category = memnew(LineEdit); category->set_h_size_flags(Control::SIZE_EXPAND_FILL); add_prop_bar->add_child(category); - category->connect("text_entered", this, "_item_adds"); + category->connect_compat("text_entered", this, "_item_adds"); l = memnew(Label); add_prop_bar->add_child(l); @@ -1829,7 +1829,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { property = memnew(LineEdit); property->set_h_size_flags(Control::SIZE_EXPAND_FILL); add_prop_bar->add_child(property); - property->connect("text_entered", this, "_item_adds"); + property->connect_compat("text_entered", this, "_item_adds"); l = memnew(Label); add_prop_bar->add_child(l); @@ -1847,7 +1847,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { Button *add = memnew(Button); add_prop_bar->add_child(add); add->set_text(TTR("Add")); - add->connect("pressed", this, "_item_add"); + add->connect_compat("pressed", this, "_item_add"); search_bar = memnew(HBoxContainer); search_bar->set_h_size_flags(Control::SIZE_EXPAND_FILL); @@ -1863,14 +1863,14 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { globals_editor->get_inspector()->set_undo_redo(EditorNode::get_singleton()->get_undo_redo()); globals_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); globals_editor->register_search_box(search_box); - globals_editor->get_inspector()->connect("property_selected", this, "_item_selected"); - globals_editor->get_inspector()->connect("property_edited", this, "_settings_prop_edited"); - globals_editor->get_inspector()->connect("restart_requested", this, "_editor_restart_request"); + globals_editor->get_inspector()->connect_compat("property_selected", this, "_item_selected"); + globals_editor->get_inspector()->connect_compat("property_edited", this, "_settings_prop_edited"); + globals_editor->get_inspector()->connect_compat("restart_requested", this, "_editor_restart_request"); Button *del = memnew(Button); hbc->add_child(del); del->set_text(TTR("Delete")); - del->connect("pressed", this, "_item_del"); + del->connect_compat("pressed", this, "_item_del"); add_prop_bar->add_child(memnew(VSeparator)); @@ -1879,8 +1879,8 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { popup_copy_to_feature->set_disabled(true); add_prop_bar->add_child(popup_copy_to_feature); - popup_copy_to_feature->get_popup()->connect("id_pressed", this, "_copy_to_platform"); - popup_copy_to_feature->get_popup()->connect("about_to_show", this, "_copy_to_platform_about_to_show"); + popup_copy_to_feature->get_popup()->connect_compat("id_pressed", this, "_copy_to_platform"); + popup_copy_to_feature->get_popup()->connect_compat("about_to_show", this, "_copy_to_platform_about_to_show"); get_ok()->set_text(TTR("Close")); set_hide_on_ok(true); @@ -1897,11 +1897,11 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { restart_hb->add_child(restart_label); restart_hb->add_spacer(); Button *restart_button = memnew(Button); - restart_button->connect("pressed", this, "_editor_restart"); + restart_button->connect_compat("pressed", this, "_editor_restart"); restart_hb->add_child(restart_button); restart_button->set_text(TTR("Save & Restart")); restart_close_button = memnew(ToolButton); - restart_close_button->connect("pressed", this, "_editor_restart_close"); + restart_close_button->connect_compat("pressed", this, "_editor_restart_close"); restart_hb->add_child(restart_close_button); restart_container->hide(); @@ -1929,8 +1929,8 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { action_name = memnew(LineEdit); action_name->set_h_size_flags(SIZE_EXPAND_FILL); hbc->add_child(action_name); - action_name->connect("text_entered", this, "_action_adds"); - action_name->connect("text_changed", this, "_action_check"); + action_name->connect_compat("text_entered", this, "_action_adds"); + action_name->connect_compat("text_changed", this, "_action_check"); action_add_error = memnew(Label); hbc->add_child(action_add_error); @@ -1940,7 +1940,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { hbc->add_child(add); add->set_text(TTR("Add")); add->set_disabled(true); - add->connect("pressed", this, "_action_add"); + add->connect_compat("pressed", this, "_action_add"); action_add = add; input_editor = memnew(Tree); @@ -1954,15 +1954,15 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { input_editor->set_column_min_width(1, 80 * EDSCALE); input_editor->set_column_expand(2, false); input_editor->set_column_min_width(2, 50 * EDSCALE); - input_editor->connect("item_edited", this, "_action_edited"); - input_editor->connect("item_activated", this, "_action_activated"); - input_editor->connect("cell_selected", this, "_action_selected"); - input_editor->connect("button_pressed", this, "_action_button_pressed"); + input_editor->connect_compat("item_edited", this, "_action_edited"); + input_editor->connect_compat("item_activated", this, "_action_activated"); + input_editor->connect_compat("cell_selected", this, "_action_selected"); + input_editor->connect_compat("button_pressed", this, "_action_button_pressed"); input_editor->set_drag_forwarding(this); popup_add = memnew(PopupMenu); add_child(popup_add); - popup_add->connect("id_pressed", this, "_add_item"); + popup_add->connect_compat("id_pressed", this, "_add_item"); press_a_key = memnew(ConfirmationDialog); press_a_key->set_focus_mode(FOCUS_ALL); @@ -1977,13 +1977,13 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { press_a_key->get_ok()->set_disabled(true); press_a_key_label = l; press_a_key->add_child(l); - press_a_key->connect("gui_input", this, "_wait_for_key"); - press_a_key->connect("confirmed", this, "_press_a_key_confirm"); + press_a_key->connect_compat("gui_input", this, "_wait_for_key"); + press_a_key->connect_compat("confirmed", this, "_press_a_key_confirm"); device_input = memnew(ConfirmationDialog); add_child(device_input); device_input->get_ok()->set_text(TTR("Add")); - device_input->connect("confirmed", this, "_device_input_add"); + device_input->connect_compat("confirmed", this, "_device_input_add"); hbc = memnew(HBoxContainer); device_input->add_child(hbc); @@ -2034,7 +2034,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { thb->add_child(memnew(Label(TTR("Translations:")))); thb->add_spacer(); Button *addtr = memnew(Button(TTR("Add..."))); - addtr->connect("pressed", this, "_translation_file_open"); + addtr->connect_compat("pressed", this, "_translation_file_open"); thb->add_child(addtr); VBoxContainer *tmc = memnew(VBoxContainer); tvb->add_child(tmc); @@ -2046,7 +2046,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { translation_file_open = memnew(EditorFileDialog); add_child(translation_file_open); translation_file_open->set_mode(EditorFileDialog::MODE_OPEN_FILE); - translation_file_open->connect("file_selected", this, "_translation_add"); + translation_file_open->connect_compat("file_selected", this, "_translation_add"); } { @@ -2058,28 +2058,28 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { thb->add_child(memnew(Label(TTR("Resources:")))); thb->add_spacer(); Button *addtr = memnew(Button(TTR("Add..."))); - addtr->connect("pressed", this, "_translation_res_file_open"); + addtr->connect_compat("pressed", this, "_translation_res_file_open"); thb->add_child(addtr); VBoxContainer *tmc = memnew(VBoxContainer); tvb->add_child(tmc); tmc->set_v_size_flags(SIZE_EXPAND_FILL); translation_remap = memnew(Tree); translation_remap->set_v_size_flags(SIZE_EXPAND_FILL); - translation_remap->connect("cell_selected", this, "_translation_res_select"); + translation_remap->connect_compat("cell_selected", this, "_translation_res_select"); tmc->add_child(translation_remap); - translation_remap->connect("button_pressed", this, "_translation_res_delete"); + translation_remap->connect_compat("button_pressed", this, "_translation_res_delete"); translation_res_file_open = memnew(EditorFileDialog); add_child(translation_res_file_open); translation_res_file_open->set_mode(EditorFileDialog::MODE_OPEN_FILE); - translation_res_file_open->connect("file_selected", this, "_translation_res_add"); + translation_res_file_open->connect_compat("file_selected", this, "_translation_res_add"); thb = memnew(HBoxContainer); tvb->add_child(thb); thb->add_child(memnew(Label(TTR("Remaps by Locale:")))); thb->add_spacer(); addtr = memnew(Button(TTR("Add..."))); - addtr->connect("pressed", this, "_translation_res_option_file_open"); + addtr->connect_compat("pressed", this, "_translation_res_option_file_open"); translation_res_option_add_button = addtr; thb->add_child(addtr); tmc = memnew(VBoxContainer); @@ -2096,13 +2096,13 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { translation_remap_options->set_column_expand(0, true); translation_remap_options->set_column_expand(1, false); translation_remap_options->set_column_min_width(1, 200); - translation_remap_options->connect("item_edited", this, "_translation_res_option_changed"); - translation_remap_options->connect("button_pressed", this, "_translation_res_option_delete"); + translation_remap_options->connect_compat("item_edited", this, "_translation_res_option_changed"); + translation_remap_options->connect_compat("button_pressed", this, "_translation_res_option_delete"); translation_res_option_file_open = memnew(EditorFileDialog); add_child(translation_res_option_file_open); translation_res_option_file_open->set_mode(EditorFileDialog::MODE_OPEN_FILE); - translation_res_option_file_open->connect("file_selected", this, "_translation_res_option_add"); + translation_res_option_file_open->connect_compat("file_selected", this, "_translation_res_option_add"); } { @@ -2118,20 +2118,20 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { translation_locale_filter_mode->add_item(TTR("Show Selected Locales Only"), SHOW_ONLY_SELECTED_LOCALES); translation_locale_filter_mode->select(0); tmc->add_margin_child(TTR("Filter mode:"), translation_locale_filter_mode); - translation_locale_filter_mode->connect("item_selected", this, "_translation_filter_mode_changed"); + translation_locale_filter_mode->connect_compat("item_selected", this, "_translation_filter_mode_changed"); translation_filter = memnew(Tree); translation_filter->set_v_size_flags(SIZE_EXPAND_FILL); translation_filter->set_columns(1); tmc->add_child(memnew(Label(TTR("Locales:")))); tmc->add_child(translation_filter); - translation_filter->connect("item_edited", this, "_translation_filter_option_changed"); + translation_filter->connect_compat("item_edited", this, "_translation_filter_option_changed"); } autoload_settings = memnew(EditorAutoloadSettings); autoload_settings->set_name(TTR("AutoLoad")); tab_container->add_child(autoload_settings); - autoload_settings->connect("autoload_changed", this, "_settings_changed"); + autoload_settings->connect_compat("autoload_changed", this, "_settings_changed"); plugin_settings = memnew(EditorPluginSettings); plugin_settings->set_name(TTR("Plugins")); @@ -2139,7 +2139,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { timer = memnew(Timer); timer->set_wait_time(1.5); - timer->connect("timeout", ProjectSettings::get_singleton(), "save"); + timer->connect_compat("timeout", ProjectSettings::get_singleton(), "save"); timer->set_one_shot(true); add_child(timer); diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index cf4b83922d..72b2eb2885 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -589,7 +589,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: if (!create_dialog) { create_dialog = memnew(CreateDialog); - create_dialog->connect("create", this, "_create_dialog_callback"); + create_dialog->connect_compat("create", this, "_create_dialog_callback"); add_child(create_dialog); } @@ -605,12 +605,12 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: return false; } else if (hint == PROPERTY_HINT_METHOD_OF_VARIANT_TYPE) { -#define MAKE_PROPSELECT \ - if (!property_select) { \ - property_select = memnew(PropertySelector); \ - property_select->connect("selected", this, "_create_selected_property"); \ - add_child(property_select); \ - } \ +#define MAKE_PROPSELECT \ + if (!property_select) { \ + property_select = memnew(PropertySelector); \ + property_select->connect_compat("selected", this, "_create_selected_property"); \ + add_child(property_select); \ + } \ hide(); MAKE_PROPSELECT; @@ -865,7 +865,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: color_picker->set_deferred_mode(true); add_child(color_picker); color_picker->hide(); - color_picker->connect("color_changed", this, "_color_changed"); + color_picker->connect_compat("color_changed", this, "_color_changed"); // get default color picker mode from editor settings int default_color_mode = EDITOR_GET("interface/inspector/default_color_picker_mode"); @@ -1902,9 +1902,9 @@ CustomPropertyEditor::CustomPropertyEditor() { add_child(value_label[i]); value_editor[i]->hide(); value_label[i]->hide(); - value_editor[i]->connect("text_entered", this, "_modified"); - value_editor[i]->connect("focus_entered", this, "_focus_enter"); - value_editor[i]->connect("focus_exited", this, "_focus_exit"); + value_editor[i]->connect_compat("text_entered", this, "_modified"); + value_editor[i]->connect_compat("focus_entered", this, "_focus_enter"); + value_editor[i]->connect_compat("focus_exited", this, "_focus_exit"); } focused_value_editor = -1; @@ -1934,7 +1934,7 @@ CustomPropertyEditor::CustomPropertyEditor() { checks20[i]->set_focus_mode(FOCUS_NONE); checks20gc->add_child(checks20[i]); checks20[i]->hide(); - checks20[i]->connect("pressed", this, "_action_pressed", make_binds(i)); + checks20[i]->connect_compat("pressed", this, "_action_pressed", make_binds(i)); checks20[i]->set_tooltip(vformat(TTR("Bit %d, val %d."), i, 1 << i)); } @@ -1944,7 +1944,7 @@ CustomPropertyEditor::CustomPropertyEditor() { text_edit->set_margin(MARGIN_BOTTOM, -30); text_edit->hide(); - text_edit->connect("text_changed", this, "_text_edit_changed"); + text_edit->connect_compat("text_changed", this, "_text_edit_changed"); for (int i = 0; i < MAX_ACTION_BUTTONS; i++) { @@ -1953,7 +1953,7 @@ CustomPropertyEditor::CustomPropertyEditor() { add_child(action_buttons[i]); Vector<Variant> binds; binds.push_back(i); - action_buttons[i]->connect("pressed", this, "_action_pressed", binds); + action_buttons[i]->connect_compat("pressed", this, "_action_pressed", binds); action_buttons[i]->set_flat(true); } @@ -1964,8 +1964,8 @@ CustomPropertyEditor::CustomPropertyEditor() { add_child(file); file->hide(); - file->connect("file_selected", this, "_file_selected"); - file->connect("dir_selected", this, "_file_selected"); + file->connect_compat("file_selected", this, "_file_selected"); + file->connect_compat("dir_selected", this, "_file_selected"); error = memnew(ConfirmationDialog); error->set_title(TTR("Error!")); @@ -1973,7 +1973,7 @@ CustomPropertyEditor::CustomPropertyEditor() { scene_tree = memnew(SceneTreeDialog); add_child(scene_tree); - scene_tree->connect("selected", this, "_node_path_selected"); + scene_tree->connect_compat("selected", this, "_node_path_selected"); scene_tree->get_scene_tree()->set_show_enabled_subscene(true); texture_preview = memnew(TextureRect); @@ -1983,31 +1983,31 @@ CustomPropertyEditor::CustomPropertyEditor() { easing_draw = memnew(Control); add_child(easing_draw); easing_draw->hide(); - easing_draw->connect("draw", this, "_draw_easing"); - easing_draw->connect("gui_input", this, "_drag_easing"); + easing_draw->connect_compat("draw", this, "_draw_easing"); + easing_draw->connect_compat("gui_input", this, "_drag_easing"); easing_draw->set_default_cursor_shape(Control::CURSOR_MOVE); type_button = memnew(MenuButton); add_child(type_button); type_button->hide(); - type_button->get_popup()->connect("id_pressed", this, "_type_create_selected"); + type_button->get_popup()->connect_compat("id_pressed", this, "_type_create_selected"); menu = memnew(PopupMenu); menu->set_pass_on_modal_close_click(false); add_child(menu); - menu->connect("id_pressed", this, "_menu_option"); + menu->connect_compat("id_pressed", this, "_menu_option"); evaluator = NULL; spinbox = memnew(SpinBox); add_child(spinbox); spinbox->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 5); - spinbox->connect("value_changed", this, "_range_modified"); + spinbox->connect_compat("value_changed", this, "_range_modified"); slider = memnew(HSlider); add_child(slider); slider->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 5); - slider->connect("value_changed", this, "_range_modified"); + slider->connect_compat("value_changed", this, "_range_modified"); create_dialog = NULL; property_select = NULL; diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp index 8cc1448b7a..3c61e40b58 100644 --- a/editor/property_selector.cpp +++ b/editor/property_selector.cpp @@ -95,7 +95,7 @@ void PropertySelector::_update_search() { instance->get_property_list(&props, true); } else if (type != Variant::NIL) { Variant v; - Variant::CallError ce; + Callable::CallError ce; v = Variant::construct(type, NULL, 0, ce); v.get_property_list(&props); @@ -200,7 +200,7 @@ void PropertySelector::_update_search() { if (type != Variant::NIL) { Variant v; - Variant::CallError ce; + Callable::CallError ce; v = Variant::construct(type, NULL, 0, ce); v.get_method_list(&methods); } else { @@ -393,9 +393,9 @@ void PropertySelector::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - connect("confirmed", this, "_confirmed"); + connect_compat("confirmed", this, "_confirmed"); } else if (p_what == NOTIFICATION_EXIT_TREE) { - disconnect("confirmed", this, "_confirmed"); + disconnect_compat("confirmed", this, "_confirmed"); } } @@ -557,21 +557,21 @@ PropertySelector::PropertySelector() { //set_child_rect(vbc); search_box = memnew(LineEdit); vbc->add_margin_child(TTR("Search:"), search_box); - search_box->connect("text_changed", this, "_text_changed"); - search_box->connect("gui_input", this, "_sbox_input"); + search_box->connect_compat("text_changed", this, "_text_changed"); + search_box->connect_compat("gui_input", this, "_sbox_input"); search_options = memnew(Tree); vbc->add_margin_child(TTR("Matches:"), search_options, true); get_ok()->set_text(TTR("Open")); get_ok()->set_disabled(true); register_text_enter(search_box); set_hide_on_ok(false); - search_options->connect("item_activated", this, "_confirmed"); - search_options->connect("cell_selected", this, "_item_selected"); + search_options->connect_compat("item_activated", this, "_confirmed"); + search_options->connect_compat("cell_selected", this, "_item_selected"); search_options->set_hide_root(true); search_options->set_hide_folding(true); virtuals_only = false; help_bit = memnew(EditorHelpBit); vbc->add_margin_child(TTR("Description:"), help_bit); - help_bit->connect("request_hide", this, "_closed"); + help_bit->connect_compat("request_hide", this, "_closed"); } diff --git a/editor/quick_open.cpp b/editor/quick_open.cpp index ea92e6407c..965c9abe75 100644 --- a/editor/quick_open.cpp +++ b/editor/quick_open.cpp @@ -257,7 +257,7 @@ void EditorQuickOpen::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - connect("confirmed", this, "_confirmed"); + connect_compat("confirmed", this, "_confirmed"); search_box->set_clear_button_enabled(true); FALLTHROUGH; @@ -266,7 +266,7 @@ void EditorQuickOpen::_notification(int p_what) { search_box->set_right_icon(get_icon("Search", "EditorIcons")); } break; case NOTIFICATION_EXIT_TREE: { - disconnect("confirmed", this, "_confirmed"); + disconnect_compat("confirmed", this, "_confirmed"); } break; } } @@ -291,15 +291,15 @@ EditorQuickOpen::EditorQuickOpen() { add_child(vbc); search_box = memnew(LineEdit); vbc->add_margin_child(TTR("Search:"), search_box); - search_box->connect("text_changed", this, "_text_changed"); - search_box->connect("gui_input", this, "_sbox_input"); + search_box->connect_compat("text_changed", this, "_text_changed"); + search_box->connect_compat("gui_input", this, "_sbox_input"); search_options = memnew(Tree); vbc->add_margin_child(TTR("Matches:"), search_options, true); get_ok()->set_text(TTR("Open")); get_ok()->set_disabled(true); register_text_enter(search_box); set_hide_on_ok(false); - search_options->connect("item_activated", this, "_confirmed"); + search_options->connect_compat("item_activated", this, "_confirmed"); search_options->set_hide_root(true); search_options->set_hide_folding(true); search_options->add_constant_override("draw_guides", 1); diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp index 317be309a3..aa8352aa25 100644 --- a/editor/rename_dialog.cpp +++ b/editor/rename_dialog.cpp @@ -144,7 +144,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und but_insert_name->set_text("NAME"); but_insert_name->set_tooltip(String("${NAME}\n") + TTR("Node name")); but_insert_name->set_focus_mode(FOCUS_NONE); - but_insert_name->connect("pressed", this, "_insert_text", make_binds("${NAME}")); + but_insert_name->connect_compat("pressed", this, "_insert_text", make_binds("${NAME}")); but_insert_name->set_h_size_flags(SIZE_EXPAND_FILL); grd_substitute->add_child(but_insert_name); @@ -154,7 +154,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und but_insert_parent->set_text("PARENT"); but_insert_parent->set_tooltip(String("${PARENT}\n") + TTR("Node's parent name, if available")); but_insert_parent->set_focus_mode(FOCUS_NONE); - but_insert_parent->connect("pressed", this, "_insert_text", make_binds("${PARENT}")); + but_insert_parent->connect_compat("pressed", this, "_insert_text", make_binds("${PARENT}")); but_insert_parent->set_h_size_flags(SIZE_EXPAND_FILL); grd_substitute->add_child(but_insert_parent); @@ -164,7 +164,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und but_insert_type->set_text("TYPE"); but_insert_type->set_tooltip(String("${TYPE}\n") + TTR("Node type")); but_insert_type->set_focus_mode(FOCUS_NONE); - but_insert_type->connect("pressed", this, "_insert_text", make_binds("${TYPE}")); + but_insert_type->connect_compat("pressed", this, "_insert_text", make_binds("${TYPE}")); but_insert_type->set_h_size_flags(SIZE_EXPAND_FILL); grd_substitute->add_child(but_insert_type); @@ -174,7 +174,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und but_insert_scene->set_text("SCENE"); but_insert_scene->set_tooltip(String("${SCENE}\n") + TTR("Current scene name")); but_insert_scene->set_focus_mode(FOCUS_NONE); - but_insert_scene->connect("pressed", this, "_insert_text", make_binds("${SCENE}")); + but_insert_scene->connect_compat("pressed", this, "_insert_text", make_binds("${SCENE}")); but_insert_scene->set_h_size_flags(SIZE_EXPAND_FILL); grd_substitute->add_child(but_insert_scene); @@ -184,7 +184,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und but_insert_root->set_text("ROOT"); but_insert_root->set_tooltip(String("${ROOT}\n") + TTR("Root node name")); but_insert_root->set_focus_mode(FOCUS_NONE); - but_insert_root->connect("pressed", this, "_insert_text", make_binds("${ROOT}")); + but_insert_root->connect_compat("pressed", this, "_insert_text", make_binds("${ROOT}")); but_insert_root->set_h_size_flags(SIZE_EXPAND_FILL); grd_substitute->add_child(but_insert_root); @@ -194,7 +194,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und but_insert_count->set_text("COUNTER"); but_insert_count->set_tooltip(String("${COUNTER}\n") + TTR("Sequential integer counter.\nCompare counter options.")); but_insert_count->set_focus_mode(FOCUS_NONE); - but_insert_count->connect("pressed", this, "_insert_text", make_binds("${COUNTER}")); + but_insert_count->connect_compat("pressed", this, "_insert_text", make_binds("${COUNTER}")); but_insert_count->set_h_size_flags(SIZE_EXPAND_FILL); grd_substitute->add_child(but_insert_count); @@ -306,35 +306,35 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und // ---- Connections - cbut_collapse_features->connect("toggled", this, "_features_toggled"); + cbut_collapse_features->connect_compat("toggled", this, "_features_toggled"); // Substitite Buttons - lne_search->connect("focus_entered", this, "_update_substitute"); - lne_search->connect("focus_exited", this, "_update_substitute"); - lne_replace->connect("focus_entered", this, "_update_substitute"); - lne_replace->connect("focus_exited", this, "_update_substitute"); - lne_prefix->connect("focus_entered", this, "_update_substitute"); - lne_prefix->connect("focus_exited", this, "_update_substitute"); - lne_suffix->connect("focus_entered", this, "_update_substitute"); - lne_suffix->connect("focus_exited", this, "_update_substitute"); + lne_search->connect_compat("focus_entered", this, "_update_substitute"); + lne_search->connect_compat("focus_exited", this, "_update_substitute"); + lne_replace->connect_compat("focus_entered", this, "_update_substitute"); + lne_replace->connect_compat("focus_exited", this, "_update_substitute"); + lne_prefix->connect_compat("focus_entered", this, "_update_substitute"); + lne_prefix->connect_compat("focus_exited", this, "_update_substitute"); + lne_suffix->connect_compat("focus_entered", this, "_update_substitute"); + lne_suffix->connect_compat("focus_exited", this, "_update_substitute"); // Preview - lne_prefix->connect("text_changed", this, "_update_preview"); - lne_suffix->connect("text_changed", this, "_update_preview"); - lne_search->connect("text_changed", this, "_update_preview"); - lne_replace->connect("text_changed", this, "_update_preview"); - spn_count_start->connect("value_changed", this, "_update_preview_int"); - spn_count_step->connect("value_changed", this, "_update_preview_int"); - spn_count_padding->connect("value_changed", this, "_update_preview_int"); - opt_style->connect("item_selected", this, "_update_preview_int"); - opt_case->connect("item_selected", this, "_update_preview_int"); - cbut_substitute->connect("pressed", this, "_update_preview", varray("")); - cbut_regex->connect("pressed", this, "_update_preview", varray("")); - cbut_process->connect("pressed", this, "_update_preview", varray("")); - - but_reset->connect("pressed", this, "reset"); + lne_prefix->connect_compat("text_changed", this, "_update_preview"); + lne_suffix->connect_compat("text_changed", this, "_update_preview"); + lne_search->connect_compat("text_changed", this, "_update_preview"); + lne_replace->connect_compat("text_changed", this, "_update_preview"); + spn_count_start->connect_compat("value_changed", this, "_update_preview_int"); + spn_count_step->connect_compat("value_changed", this, "_update_preview_int"); + spn_count_padding->connect_compat("value_changed", this, "_update_preview_int"); + opt_style->connect_compat("item_selected", this, "_update_preview_int"); + opt_case->connect_compat("item_selected", this, "_update_preview_int"); + cbut_substitute->connect_compat("pressed", this, "_update_preview", varray("")); + cbut_regex->connect_compat("pressed", this, "_update_preview", varray("")); + cbut_process->connect_compat("pressed", this, "_update_preview", varray("")); + + but_reset->connect_compat("pressed", this, "reset"); reset(); _features_toggled(false); diff --git a/editor/reparent_dialog.cpp b/editor/reparent_dialog.cpp index dd35f41b7a..7c99f5d520 100644 --- a/editor/reparent_dialog.cpp +++ b/editor/reparent_dialog.cpp @@ -38,12 +38,12 @@ void ReparentDialog::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - connect("confirmed", this, "_reparent"); + connect_compat("confirmed", this, "_reparent"); } if (p_what == NOTIFICATION_EXIT_TREE) { - disconnect("confirmed", this, "_reparent"); + disconnect_compat("confirmed", this, "_reparent"); } if (p_what == NOTIFICATION_DRAW) { @@ -93,7 +93,7 @@ ReparentDialog::ReparentDialog() { vbc->add_margin_child(TTR("Reparent Location (Select new Parent):"), tree, true); - tree->get_scene_tree()->connect("item_activated", this, "_reparent"); + tree->get_scene_tree()->connect_compat("item_activated", this, "_reparent"); //Label *label = memnew( Label ); //label->set_position( Point2( 15,8) ); diff --git a/editor/run_settings_dialog.cpp b/editor/run_settings_dialog.cpp index 3a8d17b54e..0c7ee8d807 100644 --- a/editor/run_settings_dialog.cpp +++ b/editor/run_settings_dialog.cpp @@ -81,7 +81,7 @@ RunSettingsDialog::RunSettingsDialog() { vbc->add_margin_child(TTR("Run Mode:"), run_mode); run_mode->add_item(TTR("Current Scene")); run_mode->add_item(TTR("Main Scene")); - run_mode->connect("item_selected", this, "_run_mode_changed"); + run_mode->connect_compat("item_selected", this, "_run_mode_changed"); arguments = memnew(LineEdit); vbc->add_margin_child(TTR("Main Scene Arguments:"), arguments); arguments->set_editable(false); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 4b91f6178e..beba7f0ed6 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1046,18 +1046,18 @@ void SceneTreeDock::_notification(int p_what) { break; first_enter = false; - EditorFeatureProfileManager::get_singleton()->connect("current_feature_profile_changed", this, "_feature_profile_changed"); + EditorFeatureProfileManager::get_singleton()->connect_compat("current_feature_profile_changed", this, "_feature_profile_changed"); CanvasItemEditorPlugin *canvas_item_plugin = Object::cast_to<CanvasItemEditorPlugin>(editor_data->get_editor("2D")); if (canvas_item_plugin) { - canvas_item_plugin->get_canvas_item_editor()->connect("item_lock_status_changed", scene_tree, "_update_tree"); - canvas_item_plugin->get_canvas_item_editor()->connect("item_group_status_changed", scene_tree, "_update_tree"); - scene_tree->connect("node_changed", canvas_item_plugin->get_canvas_item_editor()->get_viewport_control(), "update"); + canvas_item_plugin->get_canvas_item_editor()->connect_compat("item_lock_status_changed", scene_tree, "_update_tree"); + canvas_item_plugin->get_canvas_item_editor()->connect_compat("item_group_status_changed", scene_tree, "_update_tree"); + scene_tree->connect_compat("node_changed", canvas_item_plugin->get_canvas_item_editor()->get_viewport_control(), "update"); } SpatialEditorPlugin *spatial_editor_plugin = Object::cast_to<SpatialEditorPlugin>(editor_data->get_editor("3D")); - spatial_editor_plugin->get_spatial_editor()->connect("item_lock_status_changed", scene_tree, "_update_tree"); - spatial_editor_plugin->get_spatial_editor()->connect("item_group_status_changed", scene_tree, "_update_tree"); + spatial_editor_plugin->get_spatial_editor()->connect_compat("item_lock_status_changed", scene_tree, "_update_tree"); + spatial_editor_plugin->get_spatial_editor()->connect_compat("item_group_status_changed", scene_tree, "_update_tree"); button_add->set_icon(get_icon("Add", "EditorIcons")); button_instance->set_icon(get_icon("Instance", "EditorIcons")); @@ -1067,8 +1067,8 @@ void SceneTreeDock::_notification(int p_what) { filter->set_right_icon(get_icon("Search", "EditorIcons")); filter->set_clear_button_enabled(true); - EditorNode::get_singleton()->get_editor_selection()->connect("selection_changed", this, "_selection_changed"); - scene_tree->get_scene_tree()->connect("item_collapsed", this, "_node_collapsed"); + EditorNode::get_singleton()->get_editor_selection()->connect_compat("selection_changed", this, "_selection_changed"); + scene_tree->get_scene_tree()->connect_compat("item_collapsed", this, "_node_collapsed"); // create_root_dialog HBoxContainer *top_row = memnew(HBoxContainer); @@ -1083,7 +1083,7 @@ void SceneTreeDock::_notification(int p_what) { node_shortcuts_toggle->set_toggle_mode(true); node_shortcuts_toggle->set_pressed(EDITOR_GET("_use_favorites_root_selection")); node_shortcuts_toggle->set_anchors_and_margins_preset(Control::PRESET_CENTER_RIGHT); - node_shortcuts_toggle->connect("pressed", this, "_update_create_root_dialog"); + node_shortcuts_toggle->connect_compat("pressed", this, "_update_create_root_dialog"); top_row->add_child(node_shortcuts_toggle); create_root_dialog->add_child(top_row); @@ -1099,18 +1099,18 @@ void SceneTreeDock::_notification(int p_what) { beginner_node_shortcuts->add_child(button_2d); button_2d->set_text(TTR("2D Scene")); button_2d->set_icon(get_icon("Node2D", "EditorIcons")); - button_2d->connect("pressed", this, "_tool_selected", make_binds(TOOL_CREATE_2D_SCENE, false)); + button_2d->connect_compat("pressed", this, "_tool_selected", make_binds(TOOL_CREATE_2D_SCENE, false)); button_3d = memnew(Button); beginner_node_shortcuts->add_child(button_3d); button_3d->set_text(TTR("3D Scene")); button_3d->set_icon(get_icon("Spatial", "EditorIcons")); - button_3d->connect("pressed", this, "_tool_selected", make_binds(TOOL_CREATE_3D_SCENE, false)); + button_3d->connect_compat("pressed", this, "_tool_selected", make_binds(TOOL_CREATE_3D_SCENE, false)); Button *button_ui = memnew(Button); beginner_node_shortcuts->add_child(button_ui); button_ui->set_text(TTR("User Interface")); button_ui->set_icon(get_icon("Control", "EditorIcons")); - button_ui->connect("pressed", this, "_tool_selected", make_binds(TOOL_CREATE_USER_INTERFACE, false)); + button_ui->connect_compat("pressed", this, "_tool_selected", make_binds(TOOL_CREATE_USER_INTERFACE, false)); VBoxContainer *favorite_node_shortcuts = memnew(VBoxContainer); favorite_node_shortcuts->set_name("FavoriteNodeShortcuts"); @@ -1120,7 +1120,7 @@ void SceneTreeDock::_notification(int p_what) { node_shortcuts->add_child(button_custom); button_custom->set_text(TTR("Other Node")); button_custom->set_icon(get_icon("Add", "EditorIcons")); - button_custom->connect("pressed", this, "_tool_selected", make_binds(TOOL_NEW, false)); + button_custom->connect_compat("pressed", this, "_tool_selected", make_binds(TOOL_NEW, false)); node_shortcuts->add_spacer(); create_root_dialog->add_child(node_shortcuts); @@ -1128,11 +1128,11 @@ void SceneTreeDock::_notification(int p_what) { } break; case NOTIFICATION_ENTER_TREE: { - clear_inherit_confirm->connect("confirmed", this, "_tool_selected", varray(TOOL_SCENE_CLEAR_INHERITANCE_CONFIRM)); + clear_inherit_confirm->connect_compat("confirmed", this, "_tool_selected", varray(TOOL_SCENE_CLEAR_INHERITANCE_CONFIRM)); } break; case NOTIFICATION_EXIT_TREE: { - clear_inherit_confirm->disconnect("confirmed", this, "_tool_selected"); + clear_inherit_confirm->disconnect_compat("confirmed", this, "_tool_selected"); } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { button_add->set_icon(get_icon("Add", "EditorIcons")); @@ -1738,7 +1738,7 @@ void SceneTreeDock::_script_created(Ref<Script> p_script) { } void SceneTreeDock::_script_creation_closed() { - script_create_dialog->disconnect("script_created", this, "_script_created"); + script_create_dialog->disconnect_compat("script_created", this, "_script_created"); } void SceneTreeDock::_toggle_editable_children_from_selection() { @@ -2113,7 +2113,7 @@ void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node, bool p_keep_prop Object::Connection &c = F->get(); if (!(c.flags & Object::CONNECT_PERSIST)) continue; - newnode->connect(c.signal, c.target, c.method, c.binds, Object::CONNECT_PERSIST); + newnode->connect_compat(c.signal.get_name(), c.callable.get_object(), c.callable.get_method(), c.binds, Object::CONNECT_PERSIST); } } @@ -2616,8 +2616,8 @@ void SceneTreeDock::attach_script_to_selected(bool p_extend) { } } - script_create_dialog->connect("script_created", this, "_script_created"); - script_create_dialog->connect("popup_hide", this, "_script_creation_closed", varray(), CONNECT_ONESHOT); + script_create_dialog->connect_compat("script_created", this, "_script_created"); + script_create_dialog->connect_compat("popup_hide", this, "_script_creation_closed", varray(), CONNECT_ONESHOT); script_create_dialog->set_inheritance_base_type("Node"); script_create_dialog->config(inherits, path); script_create_dialog->popup_centered(); @@ -2719,7 +2719,7 @@ void SceneTreeDock::_update_create_root_dialog() { if (ScriptServer::is_global_class(name)) name = ScriptServer::get_global_class_native_base(name); button->set_icon(EditorNode::get_singleton()->get_class_icon(name)); - button->connect("pressed", this, "_favorite_root_selected", make_binds(l)); + button->connect_compat("pressed", this, "_favorite_root_selected", make_binds(l)); } } @@ -2850,13 +2850,13 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel ED_SHORTCUT("scene_tree/delete", TTR("Delete"), KEY_DELETE); button_add = memnew(ToolButton); - button_add->connect("pressed", this, "_tool_selected", make_binds(TOOL_NEW, false)); + button_add->connect_compat("pressed", this, "_tool_selected", make_binds(TOOL_NEW, false)); button_add->set_tooltip(TTR("Add/Create a New Node.")); button_add->set_shortcut(ED_GET_SHORTCUT("scene_tree/add_child_node")); filter_hbc->add_child(button_add); button_instance = memnew(ToolButton); - button_instance->connect("pressed", this, "_tool_selected", make_binds(TOOL_INSTANCE, false)); + button_instance->connect_compat("pressed", this, "_tool_selected", make_binds(TOOL_INSTANCE, false)); button_instance->set_tooltip(TTR("Instance a scene file as a Node. Creates an inherited scene if no root node exists.")); button_instance->set_shortcut(ED_GET_SHORTCUT("scene_tree/instance_scene")); filter_hbc->add_child(button_instance); @@ -2867,17 +2867,17 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel filter->set_placeholder(TTR("Filter nodes")); filter_hbc->add_child(filter); filter->add_constant_override("minimum_spaces", 0); - filter->connect("text_changed", this, "_filter_changed"); + filter->connect_compat("text_changed", this, "_filter_changed"); button_create_script = memnew(ToolButton); - button_create_script->connect("pressed", this, "_tool_selected", make_binds(TOOL_ATTACH_SCRIPT, false)); + button_create_script->connect_compat("pressed", this, "_tool_selected", make_binds(TOOL_ATTACH_SCRIPT, false)); button_create_script->set_tooltip(TTR("Attach a new or existing script for the selected node.")); button_create_script->set_shortcut(ED_GET_SHORTCUT("scene_tree/attach_script")); filter_hbc->add_child(button_create_script); button_create_script->hide(); button_clear_script = memnew(ToolButton); - button_clear_script->connect("pressed", this, "_tool_selected", make_binds(TOOL_CLEAR_SCRIPT, false)); + button_clear_script->connect_compat("pressed", this, "_tool_selected", make_binds(TOOL_CLEAR_SCRIPT, false)); button_clear_script->set_tooltip(TTR("Clear a script for the selected node.")); button_clear_script->set_shortcut(ED_GET_SHORTCUT("scene_tree/clear_script")); filter_hbc->add_child(button_clear_script); @@ -2891,14 +2891,14 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel edit_remote->set_h_size_flags(SIZE_EXPAND_FILL); edit_remote->set_text(TTR("Remote")); edit_remote->set_toggle_mode(true); - edit_remote->connect("pressed", this, "_remote_tree_selected"); + edit_remote->connect_compat("pressed", this, "_remote_tree_selected"); edit_local = memnew(ToolButton); button_hb->add_child(edit_local); edit_local->set_h_size_flags(SIZE_EXPAND_FILL); edit_local->set_text(TTR("Local")); edit_local->set_toggle_mode(true); - edit_local->connect("pressed", this, "_local_tree_selected"); + edit_local->connect_compat("pressed", this, "_local_tree_selected"); remote_tree = NULL; button_hb->hide(); @@ -2911,19 +2911,19 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel vbc->add_child(scene_tree); scene_tree->set_v_size_flags(SIZE_EXPAND | SIZE_FILL); - scene_tree->connect("rmb_pressed", this, "_tree_rmb"); + scene_tree->connect_compat("rmb_pressed", this, "_tree_rmb"); - scene_tree->connect("node_selected", this, "_node_selected", varray(), CONNECT_DEFERRED); - scene_tree->connect("node_renamed", this, "_node_renamed", varray(), CONNECT_DEFERRED); - scene_tree->connect("node_prerename", this, "_node_prerenamed"); - scene_tree->connect("open", this, "_load_request"); - scene_tree->connect("open_script", this, "_script_open_request"); - scene_tree->connect("nodes_rearranged", this, "_nodes_dragged"); - scene_tree->connect("files_dropped", this, "_files_dropped"); - scene_tree->connect("script_dropped", this, "_script_dropped"); - scene_tree->connect("nodes_dragged", this, "_nodes_drag_begin"); + scene_tree->connect_compat("node_selected", this, "_node_selected", varray(), CONNECT_DEFERRED); + scene_tree->connect_compat("node_renamed", this, "_node_renamed", varray(), CONNECT_DEFERRED); + scene_tree->connect_compat("node_prerename", this, "_node_prerenamed"); + scene_tree->connect_compat("open", this, "_load_request"); + scene_tree->connect_compat("open_script", this, "_script_open_request"); + scene_tree->connect_compat("nodes_rearranged", this, "_nodes_dragged"); + scene_tree->connect_compat("files_dropped", this, "_files_dropped"); + scene_tree->connect_compat("script_dropped", this, "_script_dropped"); + scene_tree->connect_compat("nodes_dragged", this, "_nodes_drag_begin"); - scene_tree->get_scene_tree()->connect("item_double_clicked", this, "_focus_node"); + scene_tree->get_scene_tree()->connect_compat("item_double_clicked", this, "_focus_node"); scene_tree->set_undo_redo(&editor_data->get_undo_redo()); scene_tree->set_editor_selection(editor_selection); @@ -2931,8 +2931,8 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel create_dialog = memnew(CreateDialog); create_dialog->set_base_type("Node"); add_child(create_dialog); - create_dialog->connect("create", this, "_create"); - create_dialog->connect("favorites_updated", this, "_update_create_root_dialog"); + create_dialog->connect_compat("create", this, "_create"); + create_dialog->connect_compat("favorites_updated", this, "_update_create_root_dialog"); rename_dialog = memnew(RenameDialog(scene_tree, &editor_data->get_undo_redo())); add_child(rename_dialog); @@ -2943,44 +2943,44 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel reparent_dialog = memnew(ReparentDialog); add_child(reparent_dialog); - reparent_dialog->connect("reparent", this, "_node_reparent"); + reparent_dialog->connect_compat("reparent", this, "_node_reparent"); accept = memnew(AcceptDialog); add_child(accept); quick_open = memnew(EditorQuickOpen); add_child(quick_open); - quick_open->connect("quick_open", this, "_quick_open"); + quick_open->connect_compat("quick_open", this, "_quick_open"); set_process_unhandled_key_input(true); delete_dialog = memnew(ConfirmationDialog); add_child(delete_dialog); - delete_dialog->connect("confirmed", this, "_delete_confirm"); + delete_dialog->connect_compat("confirmed", this, "_delete_confirm"); editable_instance_remove_dialog = memnew(ConfirmationDialog); add_child(editable_instance_remove_dialog); - editable_instance_remove_dialog->connect("confirmed", this, "_toggle_editable_children_from_selection"); + editable_instance_remove_dialog->connect_compat("confirmed", this, "_toggle_editable_children_from_selection"); placeholder_editable_instance_remove_dialog = memnew(ConfirmationDialog); add_child(placeholder_editable_instance_remove_dialog); - placeholder_editable_instance_remove_dialog->connect("confirmed", this, "_toggle_placeholder_from_selection"); + placeholder_editable_instance_remove_dialog->connect_compat("confirmed", this, "_toggle_placeholder_from_selection"); import_subscene_dialog = memnew(EditorSubScene); add_child(import_subscene_dialog); - import_subscene_dialog->connect("subscene_selected", this, "_import_subscene"); + import_subscene_dialog->connect_compat("subscene_selected", this, "_import_subscene"); new_scene_from_dialog = memnew(EditorFileDialog); new_scene_from_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); add_child(new_scene_from_dialog); - new_scene_from_dialog->connect("file_selected", this, "_new_scene_from"); + new_scene_from_dialog->connect_compat("file_selected", this, "_new_scene_from"); menu = memnew(PopupMenu); add_child(menu); - menu->connect("id_pressed", this, "_tool_selected"); + menu->connect_compat("id_pressed", this, "_tool_selected"); menu->set_hide_on_window_lose_focus(true); menu_subresources = memnew(PopupMenu); menu_subresources->set_name("Sub-Resources"); - menu_subresources->connect("id_pressed", this, "_tool_selected"); + menu_subresources->connect_compat("id_pressed", this, "_tool_selected"); menu->add_child(menu_subresources); first_enter = true; restore_script_editor_on_drag = false; diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index ecaef4fb0f..ff8eaa8897 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -323,8 +323,8 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { if (can_open_instance && undo_redo) { //Show buttons only when necessary(SceneTreeDock) to avoid crashes - if (!p_node->is_connected("script_changed", this, "_node_script_changed")) - p_node->connect("script_changed", this, "_node_script_changed", varray(p_node)); + if (!p_node->is_connected_compat("script_changed", this, "_node_script_changed")) + p_node->connect_compat("script_changed", this, "_node_script_changed", varray(p_node)); Ref<Script> script = p_node->get_script(); if (!script.is_null()) { @@ -350,8 +350,8 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { else item->add_button(0, get_icon("GuiVisibilityHidden", "EditorIcons"), BUTTON_VISIBILITY, false, TTR("Toggle Visibility")); - if (!p_node->is_connected("visibility_changed", this, "_node_visibility_changed")) - p_node->connect("visibility_changed", this, "_node_visibility_changed", varray(p_node)); + if (!p_node->is_connected_compat("visibility_changed", this, "_node_visibility_changed")) + p_node->connect_compat("visibility_changed", this, "_node_visibility_changed", varray(p_node)); _update_visibility_color(p_node, item); } else if (p_node->is_class("Spatial")) { @@ -370,8 +370,8 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { else item->add_button(0, get_icon("GuiVisibilityHidden", "EditorIcons"), BUTTON_VISIBILITY, false, TTR("Toggle Visibility")); - if (!p_node->is_connected("visibility_changed", this, "_node_visibility_changed")) - p_node->connect("visibility_changed", this, "_node_visibility_changed", varray(p_node)); + if (!p_node->is_connected_compat("visibility_changed", this, "_node_visibility_changed")) + p_node->connect_compat("visibility_changed", this, "_node_visibility_changed", varray(p_node)); _update_visibility_color(p_node, item); } else if (p_node->is_class("AnimationPlayer")) { @@ -495,12 +495,12 @@ void SceneTreeEditor::_node_removed(Node *p_node) { if (EditorNode::get_singleton()->is_exiting()) return; //speed up exit - if (p_node->is_connected("script_changed", this, "_node_script_changed")) - p_node->disconnect("script_changed", this, "_node_script_changed"); + if (p_node->is_connected_compat("script_changed", this, "_node_script_changed")) + p_node->disconnect_compat("script_changed", this, "_node_script_changed"); if (p_node->is_class("Spatial") || p_node->is_class("CanvasItem")) { - if (p_node->is_connected("visibility_changed", this, "_node_visibility_changed")) - p_node->disconnect("visibility_changed", this, "_node_visibility_changed"); + if (p_node->is_connected_compat("visibility_changed", this, "_node_visibility_changed")) + p_node->disconnect_compat("visibility_changed", this, "_node_visibility_changed"); } if (p_node == selected) { @@ -640,22 +640,22 @@ void SceneTreeEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - get_tree()->connect("tree_changed", this, "_tree_changed"); - get_tree()->connect("node_removed", this, "_node_removed"); - get_tree()->connect("node_renamed", this, "_node_renamed"); - get_tree()->connect("node_configuration_warning_changed", this, "_warning_changed"); + get_tree()->connect_compat("tree_changed", this, "_tree_changed"); + get_tree()->connect_compat("node_removed", this, "_node_removed"); + get_tree()->connect_compat("node_renamed", this, "_node_renamed"); + get_tree()->connect_compat("node_configuration_warning_changed", this, "_warning_changed"); - tree->connect("item_collapsed", this, "_cell_collapsed"); + tree->connect_compat("item_collapsed", this, "_cell_collapsed"); _update_tree(); } break; case NOTIFICATION_EXIT_TREE: { - get_tree()->disconnect("tree_changed", this, "_tree_changed"); - get_tree()->disconnect("node_removed", this, "_node_removed"); - get_tree()->disconnect("node_renamed", this, "_node_renamed"); - tree->disconnect("item_collapsed", this, "_cell_collapsed"); - get_tree()->disconnect("node_configuration_warning_changed", this, "_warning_changed"); + get_tree()->disconnect_compat("tree_changed", this, "_tree_changed"); + get_tree()->disconnect_compat("node_removed", this, "_node_removed"); + get_tree()->disconnect_compat("node_renamed", this, "_node_renamed"); + tree->disconnect_compat("item_collapsed", this, "_cell_collapsed"); + get_tree()->disconnect_compat("node_configuration_warning_changed", this, "_warning_changed"); } break; case NOTIFICATION_THEME_CHANGED: { @@ -836,7 +836,7 @@ void SceneTreeEditor::set_editor_selection(EditorSelection *p_selection) { editor_selection = p_selection; tree->set_select_mode(Tree::SELECT_MULTI); tree->set_cursor_can_exit_tree(false); - editor_selection->connect("selection_changed", this, "_selection_changed"); + editor_selection->connect_compat("selection_changed", this, "_selection_changed"); } void SceneTreeEditor::_update_selection(TreeItem *item) { @@ -1163,15 +1163,15 @@ SceneTreeEditor::SceneTreeEditor(bool p_label, bool p_can_rename, bool p_can_ope tree->set_drag_forwarding(this); if (p_can_rename) { tree->set_allow_rmb_select(true); - tree->connect("item_rmb_selected", this, "_rmb_select"); - tree->connect("empty_tree_rmb_selected", this, "_rmb_select"); + tree->connect_compat("item_rmb_selected", this, "_rmb_select"); + tree->connect_compat("empty_tree_rmb_selected", this, "_rmb_select"); } - tree->connect("cell_selected", this, "_selected_changed"); - tree->connect("item_edited", this, "_renamed", varray(), CONNECT_DEFERRED); - tree->connect("multi_selected", this, "_cell_multi_selected"); - tree->connect("button_pressed", this, "_cell_button_pressed"); - tree->connect("nothing_selected", this, "_deselect_items"); + tree->connect_compat("cell_selected", this, "_selected_changed"); + tree->connect_compat("item_edited", this, "_renamed", varray(), CONNECT_DEFERRED); + tree->connect_compat("multi_selected", this, "_cell_multi_selected"); + tree->connect_compat("button_pressed", this, "_cell_button_pressed"); + tree->connect_compat("nothing_selected", this, "_deselect_items"); //tree->connect("item_edited", this,"_renamed",Vector<Variant>(),true); error = memnew(AcceptDialog); @@ -1189,7 +1189,7 @@ SceneTreeEditor::SceneTreeEditor(bool p_label, bool p_can_rename, bool p_can_ope blocked = 0; update_timer = memnew(Timer); - update_timer->connect("timeout", this, "_update_tree"); + update_timer->connect_compat("timeout", this, "_update_tree"); update_timer->set_one_shot(true); update_timer->set_wait_time(0.5); add_child(update_timer); @@ -1209,12 +1209,12 @@ void SceneTreeDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - connect("confirmed", this, "_select"); + connect_compat("confirmed", this, "_select"); filter->set_right_icon(get_icon("Search", "EditorIcons")); filter->set_clear_button_enabled(true); } break; case NOTIFICATION_EXIT_TREE: { - disconnect("confirmed", this, "_select"); + disconnect_compat("confirmed", this, "_select"); } break; case NOTIFICATION_VISIBILITY_CHANGED: { if (is_visible_in_tree()) @@ -1259,12 +1259,12 @@ SceneTreeDialog::SceneTreeDialog() { filter->set_h_size_flags(SIZE_EXPAND_FILL); filter->set_placeholder(TTR("Filter nodes")); filter->add_constant_override("minimum_spaces", 0); - filter->connect("text_changed", this, "_filter_changed"); + filter->connect_compat("text_changed", this, "_filter_changed"); vbc->add_child(filter); tree = memnew(SceneTreeEditor(false, false, true)); tree->set_v_size_flags(SIZE_EXPAND_FILL); - tree->get_scene_tree()->connect("item_activated", this, "_select"); + tree->get_scene_tree()->connect_compat("item_activated", this, "_select"); vbc->add_child(tree); } diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index 959bb67e12..ca4baffe84 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -804,7 +804,7 @@ ScriptCreateDialog::ScriptCreateDialog() { language_menu->select(default_language); current_language = default_language; - language_menu->connect("item_selected", this, "_lang_changed"); + language_menu->connect_compat("item_selected", this, "_lang_changed"); /* Inherits */ @@ -813,16 +813,16 @@ ScriptCreateDialog::ScriptCreateDialog() { hb = memnew(HBoxContainer); hb->set_h_size_flags(SIZE_EXPAND_FILL); parent_name = memnew(LineEdit); - parent_name->connect("text_changed", this, "_parent_name_changed"); + parent_name->connect_compat("text_changed", this, "_parent_name_changed"); parent_name->set_h_size_flags(SIZE_EXPAND_FILL); hb->add_child(parent_name); parent_search_button = memnew(Button); parent_search_button->set_flat(true); - parent_search_button->connect("pressed", this, "_browse_class_in_tree"); + parent_search_button->connect_compat("pressed", this, "_browse_class_in_tree"); hb->add_child(parent_search_button); parent_browse_button = memnew(Button); parent_browse_button->set_flat(true); - parent_browse_button->connect("pressed", this, "_browse_path", varray(true, false)); + parent_browse_button->connect_compat("pressed", this, "_browse_path", varray(true, false)); hb->add_child(parent_browse_button); gc->add_child(memnew(Label(TTR("Inherits:")))); gc->add_child(hb); @@ -831,7 +831,7 @@ ScriptCreateDialog::ScriptCreateDialog() { /* Class Name */ class_name = memnew(LineEdit); - class_name->connect("text_changed", this, "_class_name_changed"); + class_name->connect_compat("text_changed", this, "_class_name_changed"); class_name->set_h_size_flags(SIZE_EXPAND_FILL); gc->add_child(memnew(Label(TTR("Class Name:")))); gc->add_child(class_name); @@ -841,28 +841,28 @@ ScriptCreateDialog::ScriptCreateDialog() { template_menu = memnew(OptionButton); gc->add_child(memnew(Label(TTR("Template:")))); gc->add_child(template_menu); - template_menu->connect("item_selected", this, "_template_changed"); + template_menu->connect_compat("item_selected", this, "_template_changed"); /* Built-in Script */ internal = memnew(CheckBox); internal->set_text(TTR("On")); - internal->connect("pressed", this, "_built_in_pressed"); + internal->connect_compat("pressed", this, "_built_in_pressed"); gc->add_child(memnew(Label(TTR("Built-in Script:")))); gc->add_child(internal); /* Path */ hb = memnew(HBoxContainer); - hb->connect("sort_children", this, "_path_hbox_sorted"); + hb->connect_compat("sort_children", this, "_path_hbox_sorted"); file_path = memnew(LineEdit); - file_path->connect("text_changed", this, "_path_changed"); - file_path->connect("text_entered", this, "_path_entered"); + file_path->connect_compat("text_changed", this, "_path_changed"); + file_path->connect_compat("text_entered", this, "_path_entered"); file_path->set_h_size_flags(SIZE_EXPAND_FILL); hb->add_child(file_path); path_button = memnew(Button); path_button->set_flat(true); - path_button->connect("pressed", this, "_browse_path", varray(false, true)); + path_button->connect_compat("pressed", this, "_browse_path", varray(false, true)); hb->add_child(path_button); gc->add_child(memnew(Label(TTR("Path:")))); gc->add_child(hb); @@ -871,11 +871,11 @@ ScriptCreateDialog::ScriptCreateDialog() { /* Dialog Setup */ select_class = memnew(CreateDialog); - select_class->connect("create", this, "_create"); + select_class->connect_compat("create", this, "_create"); add_child(select_class); file_browse = memnew(EditorFileDialog); - file_browse->connect("file_selected", this, "_file_selected"); + file_browse->connect_compat("file_selected", this, "_file_selected"); file_browse->set_mode(EditorFileDialog::MODE_OPEN_FILE); add_child(file_browse); get_ok()->set_text(TTR("Create")); diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index 3d30ca410a..cc8fc0a3b9 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -577,7 +577,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da debugObj->remote_object_id = id; debugObj->type_name = type; remote_objects[id] = debugObj; - debugObj->connect("value_edited", this, "_scene_tree_property_value_edited"); + debugObj->connect_compat("value_edited", this, "_scene_tree_property_value_edited"); } int old_prop_size = debugObj->prop_list.size(); @@ -1228,10 +1228,10 @@ void ScriptEditorDebugger::_notification(int p_what) { forward->set_icon(get_icon("Forward", "EditorIcons")); dobreak->set_icon(get_icon("Pause", "EditorIcons")); docontinue->set_icon(get_icon("DebugContinue", "EditorIcons")); - le_set->connect("pressed", this, "_live_edit_set"); - le_clear->connect("pressed", this, "_live_edit_clear"); - error_tree->connect("item_selected", this, "_error_selected"); - error_tree->connect("item_activated", this, "_error_activated"); + le_set->connect_compat("pressed", this, "_live_edit_set"); + le_clear->connect_compat("pressed", this, "_live_edit_clear"); + error_tree->connect_compat("item_selected", this, "_error_selected"); + error_tree->connect_compat("item_activated", this, "_error_activated"); vmem_refresh->set_icon(get_icon("Reload", "EditorIcons")); reason->add_color_override("font_color", get_color("error_color", "Editor")); @@ -2312,14 +2312,14 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { ppeer = Ref<PacketPeerStream>(memnew(PacketPeerStream)); ppeer->set_input_buffer_max_size((1024 * 1024 * 8) - 4); // 8 MiB should be enough, minus 4 bytes for separator. editor = p_editor; - editor->get_inspector()->connect("object_id_selected", this, "_scene_tree_property_select_object"); + editor->get_inspector()->connect_compat("object_id_selected", this, "_scene_tree_property_select_object"); tabs = memnew(TabContainer); tabs->set_tab_align(TabContainer::ALIGN_LEFT); tabs->add_style_override("panel", editor->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles")); tabs->add_style_override("tab_fg", editor->get_gui_base()->get_stylebox("DebuggerTabFG", "EditorStyles")); tabs->add_style_override("tab_bg", editor->get_gui_base()->get_stylebox("DebuggerTabBG", "EditorStyles")); - tabs->connect("tab_changed", this, "_tab_changed"); + tabs->connect_compat("tab_changed", this, "_tab_changed"); add_child(tabs); @@ -2344,14 +2344,14 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { skip_breakpoints = memnew(ToolButton); hbc->add_child(skip_breakpoints); skip_breakpoints->set_tooltip(TTR("Skip Breakpoints")); - skip_breakpoints->connect("pressed", this, "debug_skip_breakpoints"); + skip_breakpoints->connect_compat("pressed", this, "debug_skip_breakpoints"); hbc->add_child(memnew(VSeparator)); copy = memnew(ToolButton); hbc->add_child(copy); copy->set_tooltip(TTR("Copy Error")); - copy->connect("pressed", this, "debug_copy"); + copy->connect_compat("pressed", this, "debug_copy"); hbc->add_child(memnew(VSeparator)); @@ -2359,13 +2359,13 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { hbc->add_child(step); step->set_tooltip(TTR("Step Into")); step->set_shortcut(ED_GET_SHORTCUT("debugger/step_into")); - step->connect("pressed", this, "debug_step"); + step->connect_compat("pressed", this, "debug_step"); next = memnew(ToolButton); hbc->add_child(next); next->set_tooltip(TTR("Step Over")); next->set_shortcut(ED_GET_SHORTCUT("debugger/step_over")); - next->connect("pressed", this, "debug_next"); + next->connect_compat("pressed", this, "debug_next"); hbc->add_child(memnew(VSeparator)); @@ -2373,13 +2373,13 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { hbc->add_child(dobreak); dobreak->set_tooltip(TTR("Break")); dobreak->set_shortcut(ED_GET_SHORTCUT("debugger/break")); - dobreak->connect("pressed", this, "debug_break"); + dobreak->connect_compat("pressed", this, "debug_break"); docontinue = memnew(ToolButton); hbc->add_child(docontinue); docontinue->set_tooltip(TTR("Continue")); docontinue->set_shortcut(ED_GET_SHORTCUT("debugger/continue")); - docontinue->connect("pressed", this, "debug_continue"); + docontinue->connect_compat("pressed", this, "debug_continue"); back = memnew(Button); hbc->add_child(back); @@ -2402,14 +2402,14 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { stack_dump->set_column_title(0, TTR("Stack Frames")); stack_dump->set_h_size_flags(SIZE_EXPAND_FILL); stack_dump->set_hide_root(true); - stack_dump->connect("cell_selected", this, "_stack_dump_frame_selected"); + stack_dump->connect_compat("cell_selected", this, "_stack_dump_frame_selected"); sc->add_child(stack_dump); inspector = memnew(EditorInspector); inspector->set_h_size_flags(SIZE_EXPAND_FILL); inspector->set_enable_capitalize_paths(false); inspector->set_read_only(true); - inspector->connect("object_id_selected", this, "_scene_tree_property_select_object"); + inspector->connect_compat("object_id_selected", this, "_scene_tree_property_select_object"); sc->add_child(inspector); server.instance(); @@ -2432,12 +2432,12 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { Button *expand_all = memnew(Button); expand_all->set_text(TTR("Expand All")); - expand_all->connect("pressed", this, "_expand_errors_list"); + expand_all->connect_compat("pressed", this, "_expand_errors_list"); errhb->add_child(expand_all); Button *collapse_all = memnew(Button); collapse_all->set_text(TTR("Collapse All")); - collapse_all->connect("pressed", this, "_collapse_errors_list"); + collapse_all->connect_compat("pressed", this, "_collapse_errors_list"); errhb->add_child(collapse_all); Control *space = memnew(Control); @@ -2447,7 +2447,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { clearbutton = memnew(Button); clearbutton->set_text(TTR("Clear")); clearbutton->set_h_size_flags(0); - clearbutton->connect("pressed", this, "_clear_errors_list"); + clearbutton->connect_compat("pressed", this, "_clear_errors_list"); errhb->add_child(clearbutton); error_tree = memnew(Tree); @@ -2462,11 +2462,11 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { error_tree->set_hide_root(true); error_tree->set_v_size_flags(SIZE_EXPAND_FILL); error_tree->set_allow_rmb_select(true); - error_tree->connect("item_rmb_selected", this, "_error_tree_item_rmb_selected"); + error_tree->connect_compat("item_rmb_selected", this, "_error_tree_item_rmb_selected"); errors_tab->add_child(error_tree); item_menu = memnew(PopupMenu); - item_menu->connect("id_pressed", this, "_item_menu_id_pressed"); + item_menu->connect_compat("id_pressed", this, "_item_menu_id_pressed"); error_tree->add_child(item_menu); tabs->add_child(errors_tab); @@ -2476,12 +2476,12 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { inspect_scene_tree = memnew(Tree); EditorNode::get_singleton()->get_scene_tree_dock()->add_remote_tree_editor(inspect_scene_tree); - EditorNode::get_singleton()->get_scene_tree_dock()->connect("remote_tree_selected", this, "_scene_tree_selected"); + EditorNode::get_singleton()->get_scene_tree_dock()->connect_compat("remote_tree_selected", this, "_scene_tree_selected"); inspect_scene_tree->set_v_size_flags(SIZE_EXPAND_FILL); - inspect_scene_tree->connect("cell_selected", this, "_scene_tree_selected"); - inspect_scene_tree->connect("item_collapsed", this, "_scene_tree_folded"); + inspect_scene_tree->connect_compat("cell_selected", this, "_scene_tree_selected"); + inspect_scene_tree->connect_compat("item_collapsed", this, "_scene_tree_folded"); inspect_scene_tree->set_allow_rmb_select(true); - inspect_scene_tree->connect("item_rmb_selected", this, "_scene_tree_rmb_selected"); + inspect_scene_tree->connect_compat("item_rmb_selected", this, "_scene_tree_rmb_selected"); auto_switch_remote_scene_tree = EDITOR_DEF("debugger/auto_switch_to_remote_scene_tree", false); inspect_scene_tree_timeout = EDITOR_DEF("debugger/remote_scene_tree_refresh_interval", 1.0); inspect_edited_object_timeout = EDITOR_DEF("debugger/remote_inspect_refresh_interval", 0.2); @@ -2491,7 +2491,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { { // File dialog file_dialog = memnew(EditorFileDialog); - file_dialog->connect("file_selected", this, "_file_selected"); + file_dialog->connect_compat("file_selected", this, "_file_selected"); add_child(file_dialog); } @@ -2499,22 +2499,22 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { profiler = memnew(EditorProfiler); profiler->set_name(TTR("Profiler")); tabs->add_child(profiler); - profiler->connect("enable_profiling", this, "_profiler_activate"); - profiler->connect("break_request", this, "_profiler_seeked"); + profiler->connect_compat("enable_profiling", this, "_profiler_activate"); + profiler->connect_compat("break_request", this, "_profiler_seeked"); } { //frame profiler visual_profiler = memnew(EditorVisualProfiler); visual_profiler->set_name(TTR("Visual Profiler")); tabs->add_child(visual_profiler); - visual_profiler->connect("enable_profiling", this, "_visual_profiler_activate"); + visual_profiler->connect_compat("enable_profiling", this, "_visual_profiler_activate"); } { //network profiler network_profiler = memnew(EditorNetworkProfiler); network_profiler->set_name(TTR("Network Profiler")); tabs->add_child(network_profiler); - network_profiler->connect("enable_profiling", this, "_network_profiler_activate"); + network_profiler->connect_compat("enable_profiling", this, "_network_profiler_activate"); } { //monitors @@ -2526,12 +2526,12 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { perf_monitors->set_column_title(0, TTR("Monitor")); perf_monitors->set_column_title(1, TTR("Value")); perf_monitors->set_column_titles_visible(true); - perf_monitors->connect("item_edited", this, "_performance_select"); + perf_monitors->connect_compat("item_edited", this, "_performance_select"); hsp->add_child(perf_monitors); perf_draw = memnew(Control); perf_draw->set_clip_contents(true); - perf_draw->connect("draw", this, "_performance_draw"); + perf_draw->connect_compat("draw", this, "_performance_draw"); hsp->add_child(perf_draw); hsp->set_name(TTR("Monitors")); @@ -2593,7 +2593,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { vmem_refresh->set_disabled(true); vmem_hb->add_child(vmem_refresh); vmem_vb->add_child(vmem_hb); - vmem_refresh->connect("pressed", this, "_video_mem_request"); + vmem_refresh->connect_compat("pressed", this, "_video_mem_request"); VBoxContainer *vmmc = memnew(VBoxContainer); vmem_tree = memnew(Tree); @@ -2660,7 +2660,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { HBoxContainer *buttons = memnew(HBoxContainer); export_csv = memnew(Button(TTR("Export measures as CSV"))); - export_csv->connect("pressed", this, "_export_csv"); + export_csv->connect_compat("pressed", this, "_export_csv"); buttons->add_child(export_csv); misc->add_child(buttons); @@ -2681,7 +2681,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { last_error_count = 0; last_warning_count = 0; - EditorNode::get_singleton()->get_pause_button()->connect("pressed", this, "_paused"); + EditorNode::get_singleton()->get_pause_button()->connect_compat("pressed", this, "_paused"); } ScriptEditorDebugger::~ScriptEditorDebugger() { diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index 44962323e5..c1a902bdcc 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -412,7 +412,7 @@ EditorSettingsDialog::EditorSettingsDialog() { tabs = memnew(TabContainer); tabs->set_tab_align(TabContainer::ALIGN_LEFT); - tabs->connect("tab_changed", this, "_tabs_tab_changed"); + tabs->connect_compat("tab_changed", this, "_tabs_tab_changed"); add_child(tabs); // General Tab @@ -435,8 +435,8 @@ EditorSettingsDialog::EditorSettingsDialog() { inspector->set_v_size_flags(Control::SIZE_EXPAND_FILL); inspector->get_inspector()->set_undo_redo(undo_redo); tab_general->add_child(inspector); - inspector->get_inspector()->connect("property_edited", this, "_settings_property_edited"); - inspector->get_inspector()->connect("restart_requested", this, "_editor_restart_request"); + inspector->get_inspector()->connect_compat("property_edited", this, "_settings_property_edited"); + inspector->get_inspector()->connect_compat("restart_requested", this, "_editor_restart_request"); restart_container = memnew(PanelContainer); tab_general->add_child(restart_container); @@ -450,11 +450,11 @@ EditorSettingsDialog::EditorSettingsDialog() { restart_hb->add_child(restart_label); restart_hb->add_spacer(); Button *restart_button = memnew(Button); - restart_button->connect("pressed", this, "_editor_restart"); + restart_button->connect_compat("pressed", this, "_editor_restart"); restart_hb->add_child(restart_button); restart_button->set_text(TTR("Save & Restart")); restart_close_button = memnew(ToolButton); - restart_close_button->connect("pressed", this, "_editor_restart_close"); + restart_close_button->connect_compat("pressed", this, "_editor_restart_close"); restart_hb->add_child(restart_close_button); restart_container->hide(); @@ -471,7 +471,7 @@ EditorSettingsDialog::EditorSettingsDialog() { shortcut_search_box = memnew(LineEdit); shortcut_search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); hbc->add_child(shortcut_search_box); - shortcut_search_box->connect("text_changed", this, "_filter_shortcuts"); + shortcut_search_box->connect_compat("text_changed", this, "_filter_shortcuts"); shortcuts = memnew(Tree); tab_shortcuts->add_child(shortcuts, true); @@ -481,7 +481,7 @@ EditorSettingsDialog::EditorSettingsDialog() { shortcuts->set_column_titles_visible(true); shortcuts->set_column_title(0, TTR("Name")); shortcuts->set_column_title(1, TTR("Binding")); - shortcuts->connect("button_pressed", this, "_shortcut_button_pressed"); + shortcuts->connect_compat("button_pressed", this, "_shortcut_button_pressed"); press_a_key = memnew(ConfirmationDialog); press_a_key->set_focus_mode(FOCUS_ALL); @@ -495,17 +495,17 @@ EditorSettingsDialog::EditorSettingsDialog() { l->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_BEGIN, 30); press_a_key_label = l; press_a_key->add_child(l); - press_a_key->connect("gui_input", this, "_wait_for_key"); - press_a_key->connect("confirmed", this, "_press_a_key_confirm"); + press_a_key->connect_compat("gui_input", this, "_wait_for_key"); + press_a_key->connect_compat("confirmed", this, "_press_a_key_confirm"); set_hide_on_ok(true); timer = memnew(Timer); timer->set_wait_time(1.5); - timer->connect("timeout", this, "_settings_save"); + timer->connect_compat("timeout", this, "_settings_save"); timer->set_one_shot(true); add_child(timer); - EditorSettings::get_singleton()->connect("settings_changed", this, "_settings_changed"); + EditorSettings::get_singleton()->connect_compat("settings_changed", this, "_settings_changed"); get_ok()->set_text(TTR("Close")); updating = false; diff --git a/modules/bullet/area_bullet.cpp b/modules/bullet/area_bullet.cpp index 7806145390..e8a5c1475a 100644 --- a/modules/bullet/area_bullet.cpp +++ b/modules/bullet/area_bullet.cpp @@ -117,7 +117,7 @@ void AreaBullet::call_event(CollisionObjectBullet *p_otherObject, PhysicsServer: call_event_res[3] = 0; // other_body_shape ID call_event_res[4] = 0; // self_shape ID - Variant::CallError outResp; + Callable::CallError outResp; areaGodoObject->call(event.event_callback_method, (const Variant **)call_event_res_ptr, 5, outResp); } diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp index e5804fbde8..d33c3a748c 100644 --- a/modules/bullet/rigid_body_bullet.cpp +++ b/modules/bullet/rigid_body_bullet.cpp @@ -370,7 +370,7 @@ void RigidBodyBullet::dispatch_callbacks() { } else { const Variant *vp[2] = { &variantBodyDirect, &force_integration_callback->udata }; - Variant::CallError responseCallError; + Callable::CallError responseCallError; int argc = (force_integration_callback->udata.get_type() == Variant::NIL) ? 1 : 2; obj->call(force_integration_callback->method, vp, argc, responseCallError); } diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index e0c0aa6a51..7e7f383ea6 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -898,12 +898,12 @@ void CSGMesh::set_mesh(const Ref<Mesh> &p_mesh) { if (mesh == p_mesh) return; if (mesh.is_valid()) { - mesh->disconnect("changed", this, "_mesh_changed"); + mesh->disconnect_compat("changed", this, "_mesh_changed"); } mesh = p_mesh; if (mesh.is_valid()) { - mesh->connect("changed", this, "_mesh_changed"); + mesh->connect_compat("changed", this, "_mesh_changed"); } _make_dirty(); @@ -1812,15 +1812,15 @@ CSGBrush *CSGPolygon::_build_brush() { if (path != path_cache) { if (path_cache) { - path_cache->disconnect("tree_exited", this, "_path_exited"); - path_cache->disconnect("curve_changed", this, "_path_changed"); + path_cache->disconnect_compat("tree_exited", this, "_path_exited"); + path_cache->disconnect_compat("curve_changed", this, "_path_changed"); path_cache = NULL; } path_cache = path; - path_cache->connect("tree_exited", this, "_path_exited"); - path_cache->connect("curve_changed", this, "_path_changed"); + path_cache->connect_compat("tree_exited", this, "_path_exited"); + path_cache->connect_compat("curve_changed", this, "_path_changed"); path_cache = NULL; } curve = path->get_curve(); @@ -2236,8 +2236,8 @@ CSGBrush *CSGPolygon::_build_brush() { void CSGPolygon::_notification(int p_what) { if (p_what == NOTIFICATION_EXIT_TREE) { if (path_cache) { - path_cache->disconnect("tree_exited", this, "_path_exited"); - path_cache->disconnect("curve_changed", this, "_path_changed"); + path_cache->disconnect_compat("tree_exited", this, "_path_exited"); + path_cache->disconnect_compat("curve_changed", this, "_path_changed"); path_cache = NULL; } } diff --git a/modules/gdnative/gdnative/gdnative.cpp b/modules/gdnative/gdnative/gdnative.cpp index 018a613724..d996b006a5 100644 --- a/modules/gdnative/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative/gdnative.cpp @@ -79,7 +79,7 @@ godot_variant GDAPI godot_method_bind_call(godot_method_bind *p_method_bind, god Variant *ret_val = (Variant *)&ret; - Variant::CallError r_error; + Callable::CallError r_error; *ret_val = mb->call(o, args, p_arg_count, r_error); if (p_call_error) { diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp index 176d5a0461..1d8ba6087f 100644 --- a/modules/gdnative/gdnative/variant.cpp +++ b/modules/gdnative/gdnative/variant.cpp @@ -459,7 +459,7 @@ godot_variant GDAPI godot_variant_call(godot_variant *p_self, const godot_string const Variant **args = (const Variant **)p_args; godot_variant raw_dest; Variant *dest = (Variant *)&raw_dest; - Variant::CallError error; + Callable::CallError error; memnew_placement_custom(dest, Variant, Variant(self->call(*method, args, p_argcount, error))); if (r_error) { r_error->error = (godot_variant_call_error_error)error.error; diff --git a/modules/gdnative/gdnative_library_editor_plugin.cpp b/modules/gdnative/gdnative_library_editor_plugin.cpp index a30b438e6f..b434bc8385 100644 --- a/modules/gdnative/gdnative_library_editor_plugin.cpp +++ b/modules/gdnative/gdnative_library_editor_plugin.cpp @@ -359,7 +359,7 @@ GDNativeLibraryEditor::GDNativeLibraryEditor() { filter_list->set_item_checked(idx, true); idx += 1; } - filter_list->connect("index_pressed", this, "_on_filter_selected"); + filter_list->connect_compat("index_pressed", this, "_on_filter_selected"); tree = memnew(Tree); container->add_child(tree); @@ -374,16 +374,16 @@ GDNativeLibraryEditor::GDNativeLibraryEditor() { tree->set_column_title(2, TTR("Dependencies")); tree->set_column_expand(3, false); tree->set_column_min_width(3, int(110 * EDSCALE)); - tree->connect("button_pressed", this, "_on_item_button"); - tree->connect("item_collapsed", this, "_on_item_collapsed"); - tree->connect("item_activated", this, "_on_item_activated"); + tree->connect_compat("button_pressed", this, "_on_item_button"); + tree->connect_compat("item_collapsed", this, "_on_item_collapsed"); + tree->connect_compat("item_activated", this, "_on_item_activated"); file_dialog = memnew(EditorFileDialog); file_dialog->set_access(EditorFileDialog::ACCESS_RESOURCES); file_dialog->set_resizable(true); add_child(file_dialog); - file_dialog->connect("file_selected", this, "_on_library_selected"); - file_dialog->connect("files_selected", this, "_on_dependencies_selected"); + file_dialog->connect_compat("file_selected", this, "_on_library_selected"); + file_dialog->connect_compat("files_selected", this, "_on_dependencies_selected"); new_architecture_dialog = memnew(ConfirmationDialog); add_child(new_architecture_dialog); @@ -392,7 +392,7 @@ GDNativeLibraryEditor::GDNativeLibraryEditor() { new_architecture_dialog->add_child(new_architecture_input); new_architecture_dialog->set_custom_minimum_size(Vector2(300, 80) * EDSCALE); new_architecture_input->set_anchors_and_margins_preset(PRESET_HCENTER_WIDE, PRESET_MODE_MINSIZE, 5 * EDSCALE); - new_architecture_dialog->get_ok()->connect("pressed", this, "_on_create_new_entry"); + new_architecture_dialog->get_ok()->connect_compat("pressed", this, "_on_create_new_entry"); } void GDNativeLibraryEditorPlugin::edit(Object *p_node) { diff --git a/modules/gdnative/gdnative_library_singleton_editor.cpp b/modules/gdnative/gdnative_library_singleton_editor.cpp index 17a7d5492a..e5eb3c44d0 100644 --- a/modules/gdnative/gdnative_library_singleton_editor.cpp +++ b/modules/gdnative/gdnative_library_singleton_editor.cpp @@ -207,8 +207,8 @@ GDNativeLibrarySingletonEditor::GDNativeLibrarySingletonEditor() { libraries->set_hide_root(true); add_margin_child(TTR("Libraries: "), libraries, true); updating = false; - libraries->connect("item_edited", this, "_item_edited"); - EditorFileSystem::get_singleton()->connect("filesystem_changed", this, "_discover_singletons"); + libraries->connect_compat("item_edited", this, "_item_edited"); + EditorFileSystem::get_singleton()->connect_compat("filesystem_changed", this, "_discover_singletons"); } #endif // TOOLS_ENABLED diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index a2be4807d7..8240ae2f83 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -725,21 +725,21 @@ String NativeScript::get_property_documentation(const StringName &p_path) const ERR_FAIL_V_MSG("", "Attempt to get property documentation for non-existent signal."); } -Variant NativeScript::_new(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant NativeScript::_new(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { if (lib_path.empty() || class_name.empty() || library.is_null()) { - r_error.error = Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL; + r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL; return Variant(); } NativeScriptDesc *script_data = get_script_desc(); if (!script_data) { - r_error.error = Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL; + r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL; return Variant(); } - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; REF ref; Object *owner = NULL; @@ -751,7 +751,7 @@ Variant NativeScript::_new(const Variant **p_args, int p_argcount, Variant::Call } if (!owner) { - r_error.error = Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL; + r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL; return Variant(); } @@ -964,7 +964,7 @@ bool NativeScriptInstance::has_method(const StringName &p_method) const { return script->has_method(p_method); } -Variant NativeScriptInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant NativeScriptInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { NativeScriptDesc *script_data = GET_SCRIPT_DESC(); @@ -989,14 +989,14 @@ Variant NativeScriptInstance::call(const StringName &p_method, const Variant **p Variant res = *(Variant *)&result; godot_variant_destroy(&result); - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; return res; } script_data = script_data->base_data; } - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; return Variant(); } @@ -1017,9 +1017,9 @@ void NativeScriptInstance::notification(int p_notification) { String NativeScriptInstance::to_string(bool *r_valid) { 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); - if (ce.error == Variant::CallError::CALL_OK) { + if (ce.error == Callable::CallError::CALL_OK) { if (ret.get_type() != Variant::STRING) { if (r_valid) *r_valid = false; @@ -1036,21 +1036,21 @@ String NativeScriptInstance::to_string(bool *r_valid) { } void NativeScriptInstance::refcount_incremented() { - Variant::CallError err; + Callable::CallError err; call("_refcount_incremented", NULL, 0, err); - if (err.error != Variant::CallError::CALL_OK && err.error != Variant::CallError::CALL_ERROR_INVALID_METHOD) { + if (err.error != Callable::CallError::CALL_OK && err.error != Callable::CallError::CALL_ERROR_INVALID_METHOD) { ERR_PRINT("Failed to invoke _refcount_incremented - should not happen"); } } bool NativeScriptInstance::refcount_decremented() { - Variant::CallError err; + Callable::CallError err; Variant ret = call("_refcount_decremented", NULL, 0, err); - if (err.error != Variant::CallError::CALL_OK && err.error != Variant::CallError::CALL_ERROR_INVALID_METHOD) { + if (err.error != Callable::CallError::CALL_OK && err.error != Callable::CallError::CALL_ERROR_INVALID_METHOD) { ERR_PRINT("Failed to invoke _refcount_decremented - should not happen"); return true; // assume we can destroy the object } - if (err.error == Variant::CallError::CALL_ERROR_INVALID_METHOD) { + if (err.error == Callable::CallError::CALL_ERROR_INVALID_METHOD) { // the method does not exist, default is true return true; } diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h index 58e4052368..609ffa2bd4 100644 --- a/modules/gdnative/nativescript/nativescript.h +++ b/modules/gdnative/nativescript/nativescript.h @@ -197,7 +197,7 @@ public: String get_signal_documentation(const StringName &p_signal_name) const; String get_property_documentation(const StringName &p_path) const; - Variant _new(const Variant **p_args, int p_argcount, Variant::CallError &r_error); + Variant _new(const Variant **p_args, int p_argcount, Callable::CallError &r_error); NativeScript(); ~NativeScript(); @@ -224,7 +224,7 @@ public: virtual Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid) const; virtual void get_method_list(List<MethodInfo> *p_list) 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); String to_string(bool *r_valid); virtual Ref<Script> get_script() const; diff --git a/modules/gdnative/pluginscript/pluginscript_instance.cpp b/modules/gdnative/pluginscript/pluginscript_instance.cpp index 26a1d5f47a..22e8372130 100644 --- a/modules/gdnative/pluginscript/pluginscript_instance.cpp +++ b/modules/gdnative/pluginscript/pluginscript_instance.cpp @@ -79,7 +79,7 @@ bool PluginScriptInstance::has_method(const StringName &p_method) const { return _script->has_method(p_method); } -Variant PluginScriptInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant PluginScriptInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { // TODO: optimize when calling a Godot method from Godot to avoid param conversion ? godot_variant ret = _desc->call_method( _data, (godot_string_name *)&p_method, (const godot_variant **)p_args, diff --git a/modules/gdnative/pluginscript/pluginscript_instance.h b/modules/gdnative/pluginscript/pluginscript_instance.h index 154bebd72a..c91ad643a7 100644 --- a/modules/gdnative/pluginscript/pluginscript_instance.h +++ b/modules/gdnative/pluginscript/pluginscript_instance.h @@ -60,7 +60,7 @@ public: virtual void get_method_list(List<MethodInfo> *p_list) 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); // Rely on default implementations provided by ScriptInstance for the moment. // Note that multilevel call could be removed in 3.0 release, so stay tuned diff --git a/modules/gdnative/pluginscript/pluginscript_script.cpp b/modules/gdnative/pluginscript/pluginscript_script.cpp index fffb169129..fe1f63f6da 100644 --- a/modules/gdnative/pluginscript/pluginscript_script.cpp +++ b/modules/gdnative/pluginscript/pluginscript_script.cpp @@ -55,9 +55,9 @@ void PluginScript::_bind_methods() { ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "new", &PluginScript::_new, MethodInfo("new")); } -PluginScriptInstance *PluginScript::_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, Variant::CallError &r_error) { +PluginScriptInstance *PluginScript::_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, Callable::CallError &r_error) { - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; // Create instance PluginScriptInstance *instance = memnew(PluginScriptInstance()); @@ -67,7 +67,7 @@ PluginScriptInstance *PluginScript::_create_instance(const Variant **p_args, int _instances.insert(instance->get_owner()); _language->unlock(); } else { - r_error.error = Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL; + r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL; memdelete(instance); ERR_FAIL_V(NULL); } @@ -83,12 +83,12 @@ PluginScriptInstance *PluginScript::_create_instance(const Variant **p_args, int return instance; } -Variant PluginScript::_new(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant PluginScript::_new(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; if (!_valid) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; return Variant(); } @@ -102,7 +102,7 @@ Variant PluginScript::_new(const Variant **p_args, int p_argcount, Variant::Call } if (!owner) { - r_error.error = Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL; + r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL; return Variant(); } @@ -201,7 +201,7 @@ ScriptInstance *PluginScript::instance_create(Object *p_this) { } } - Variant::CallError unchecked_error; + Callable::CallError unchecked_error; return _create_instance(NULL, 0, p_this, unchecked_error); } diff --git a/modules/gdnative/pluginscript/pluginscript_script.h b/modules/gdnative/pluginscript/pluginscript_script.h index f6bca8a9cb..5c93ae38f5 100644 --- a/modules/gdnative/pluginscript/pluginscript_script.h +++ b/modules/gdnative/pluginscript/pluginscript_script.h @@ -72,8 +72,8 @@ private: protected: static void _bind_methods(); - PluginScriptInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, Variant::CallError &r_error); - Variant _new(const Variant **p_args, int p_argcount, Variant::CallError &r_error); + PluginScriptInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, Callable::CallError &r_error); + Variant _new(const Variant **p_args, int p_argcount, Callable::CallError &r_error); #ifdef TOOLS_ENABLED Set<PlaceHolderScriptInstance *> placeholders; diff --git a/modules/gdnavigation/navigation_mesh_editor_plugin.cpp b/modules/gdnavigation/navigation_mesh_editor_plugin.cpp index 13c74d5706..28fe0bfd06 100644 --- a/modules/gdnavigation/navigation_mesh_editor_plugin.cpp +++ b/modules/gdnavigation/navigation_mesh_editor_plugin.cpp @@ -107,13 +107,13 @@ NavigationMeshEditor::NavigationMeshEditor() { bake_hbox->add_child(button_bake); button_bake->set_toggle_mode(true); button_bake->set_text(TTR("Bake NavMesh")); - button_bake->connect("pressed", this, "_bake_pressed"); + button_bake->connect_compat("pressed", this, "_bake_pressed"); button_reset = memnew(ToolButton); bake_hbox->add_child(button_reset); // No button text, we only use a revert icon which is set when entering the tree. button_reset->set_tooltip(TTR("Clear the navigation mesh.")); - button_reset->connect("pressed", this, "_clear_pressed"); + button_reset->connect_compat("pressed", this, "_clear_pressed"); bake_info = memnew(Label); bake_hbox->add_child(bake_info); diff --git a/modules/gdnavigation/rvo_agent.cpp b/modules/gdnavigation/rvo_agent.cpp index 4d19bc15af..677e525bbf 100644 --- a/modules/gdnavigation/rvo_agent.cpp +++ b/modules/gdnavigation/rvo_agent.cpp @@ -74,7 +74,7 @@ void RvoAgent::dispatch_callback() { callback.id = ObjectID(); } - Variant::CallError responseCallError; + Callable::CallError responseCallError; callback.new_velocity = Vector3(agent.newVelocity_.x(), agent.newVelocity_.y(), agent.newVelocity_.z()); diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 6d926fb88d..a72bb7ba49 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -84,7 +84,7 @@ Object *GDScriptNativeClass::instance() { return ClassDB::instance(name); } -GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Variant::CallError &r_error) { +GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Callable::CallError &r_error) { /* STEP 1, CREATE */ @@ -116,7 +116,7 @@ GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argco initializer->call(instance, p_args, p_argcount, r_error); - if (r_error.error != Variant::CallError::CALL_OK) { + if (r_error.error != Callable::CallError::CALL_OK) { instance->script = Ref<GDScript>(); instance->owner->set_script_instance(NULL); #ifndef NO_THREADS @@ -127,23 +127,23 @@ GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argco GDScriptLanguage::singleton->lock->unlock(); #endif - ERR_FAIL_COND_V(r_error.error != Variant::CallError::CALL_OK, NULL); //error constructing + ERR_FAIL_COND_V(r_error.error != Callable::CallError::CALL_OK, NULL); //error constructing } //@TODO make thread safe return instance; } -Variant GDScript::_new(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant GDScript::_new(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { /* STEP 1, CREATE */ if (!valid) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; return Variant(); } - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; REF ref; Object *owner = NULL; @@ -329,7 +329,7 @@ ScriptInstance *GDScript::instance_create(Object *p_this) { } } - Variant::CallError unchecked_error; + Callable::CallError unchecked_error; return _create_instance(NULL, 0, p_this, Object::cast_to<Reference>(p_this) != NULL, unchecked_error); } @@ -739,7 +739,7 @@ MultiplayerAPI::RPCMode GDScript::get_rset_mode(const StringName &p_variable) co return get_rset_mode_by_id(get_rset_property_id(p_variable)); } -Variant GDScript::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant GDScript::call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { GDScript *top = this; while (top) { @@ -1081,18 +1081,18 @@ bool GDScriptInstance::set(const StringName &p_name, const Variant &p_value) { const GDScript::MemberInfo *member = &E->get(); if (member->setter) { const Variant *val = &p_value; - Variant::CallError err; + Callable::CallError err; call(member->setter, &val, 1, err); - if (err.error == Variant::CallError::CALL_OK) { + if (err.error == Callable::CallError::CALL_OK) { return true; //function exists, call was successful } } else { if (!member->data_type.is_type(p_value)) { // Try conversion - Variant::CallError ce; + Callable::CallError ce; const Variant *value = &p_value; Variant converted = Variant::construct(member->data_type.builtin_type, &value, 1, ce); - if (ce.error == Variant::CallError::CALL_OK) { + if (ce.error == Callable::CallError::CALL_OK) { members.write[member->index] = converted; return true; } else { @@ -1115,9 +1115,9 @@ bool GDScriptInstance::set(const StringName &p_name, const Variant &p_value) { Variant name = p_name; const Variant *args[2] = { &name, &p_value }; - Variant::CallError err; + Callable::CallError err; Variant ret = E->get()->call(this, (const Variant **)args, 2, err); - if (err.error == Variant::CallError::CALL_OK && ret.get_type() == Variant::BOOL && ret.operator bool()) + if (err.error == Callable::CallError::CALL_OK && ret.get_type() == Variant::BOOL && ret.operator bool()) return true; } sptr = sptr->_base; @@ -1135,9 +1135,9 @@ bool GDScriptInstance::get(const StringName &p_name, Variant &r_ret) const { const Map<StringName, GDScript::MemberInfo>::Element *E = script->member_indices.find(p_name); if (E) { if (E->get().getter) { - Variant::CallError err; + Callable::CallError err; r_ret = const_cast<GDScriptInstance *>(this)->call(E->get().getter, NULL, 0, err); - if (err.error == Variant::CallError::CALL_OK) { + if (err.error == Callable::CallError::CALL_OK) { return true; } } @@ -1166,9 +1166,9 @@ bool GDScriptInstance::get(const StringName &p_name, Variant &r_ret) const { Variant name = p_name; const Variant *args[1] = { &name }; - Variant::CallError err; + Callable::CallError err; Variant ret = const_cast<GDScriptFunction *>(E->get())->call(const_cast<GDScriptInstance *>(this), (const Variant **)args, 1, err); - if (err.error == Variant::CallError::CALL_OK && ret.get_type() != Variant::NIL) { + if (err.error == Callable::CallError::CALL_OK && ret.get_type() != Variant::NIL) { r_ret = ret; return true; } @@ -1209,9 +1209,9 @@ void GDScriptInstance::get_property_list(List<PropertyInfo> *p_properties) const const Map<StringName, GDScriptFunction *>::Element *E = sptr->member_functions.find(GDScriptLanguage::get_singleton()->strings._get_property_list); if (E) { - Variant::CallError err; + Callable::CallError err; Variant ret = const_cast<GDScriptFunction *>(E->get())->call(const_cast<GDScriptInstance *>(this), NULL, 0, err); - if (err.error == Variant::CallError::CALL_OK) { + if (err.error == Callable::CallError::CALL_OK) { ERR_FAIL_COND_MSG(ret.get_type() != Variant::ARRAY, "Wrong type for _get_property_list, must be an array of dictionaries."); @@ -1296,7 +1296,7 @@ bool GDScriptInstance::has_method(const StringName &p_method) const { return false; } -Variant GDScriptInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant GDScriptInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { GDScript *sptr = script.ptr(); while (sptr) { @@ -1306,14 +1306,14 @@ Variant GDScriptInstance::call(const StringName &p_method, const Variant **p_arg } sptr = sptr->_base; } - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; return Variant(); } void GDScriptInstance::call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount) { GDScript *sptr = script.ptr(); - Variant::CallError ce; + Callable::CallError ce; while (sptr) { Map<StringName, GDScriptFunction *>::Element *E = sptr->member_functions.find(p_method); @@ -1329,7 +1329,7 @@ void GDScriptInstance::_ml_call_reversed(GDScript *sptr, const StringName &p_met if (sptr->_base) _ml_call_reversed(sptr->_base, p_method, p_args, p_argcount); - Variant::CallError ce; + Callable::CallError ce; Map<StringName, GDScriptFunction *>::Element *E = sptr->member_functions.find(p_method); if (E) { @@ -1354,9 +1354,9 @@ void GDScriptInstance::notification(int p_notification) { while (sptr) { Map<StringName, GDScriptFunction *>::Element *E = sptr->member_functions.find(GDScriptLanguage::get_singleton()->strings._notification); if (E) { - Variant::CallError err; + Callable::CallError err; E->get()->call(this, args, 1, err); - if (err.error != Variant::CallError::CALL_OK) { + if (err.error != Callable::CallError::CALL_OK) { //print error about notification call } } @@ -1366,9 +1366,9 @@ void GDScriptInstance::notification(int p_notification) { String GDScriptInstance::to_string(bool *r_valid) { 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); - if (ce.error == Variant::CallError::CALL_OK) { + if (ce.error == Callable::CallError::CALL_OK) { if (ret.get_type() != Variant::STRING) { if (r_valid) *r_valid = false; diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h index 3e60028281..6598a0023b 100644 --- a/modules/gdscript/gdscript.h +++ b/modules/gdscript/gdscript.h @@ -115,7 +115,7 @@ class GDScript : public Script { String fully_qualified_name; SelfList<GDScript> script_list; - GDScriptInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Variant::CallError &r_error); + GDScriptInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Callable::CallError &r_error); void _set_subclass_path(Ref<GDScript> &p_sc, const String &p_path); @@ -140,7 +140,7 @@ protected: bool _set(const StringName &p_name, const Variant &p_value); void _get_property_list(List<PropertyInfo> *p_properties) const; - Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error); + Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error); //void call_multilevel(const StringName& p_method,const Variant** p_args,int p_argcount); static void _bind_methods(); @@ -169,7 +169,7 @@ public: const Map<StringName, GDScriptFunction *> &debug_get_member_functions() const; //this is debug only StringName debug_get_member_by_index(int p_idx) const; - Variant _new(const Variant **p_args, int p_argcount, Variant::CallError &r_error); + Variant _new(const Variant **p_args, int p_argcount, Callable::CallError &r_error); virtual bool can_instance() const; virtual Ref<Script> get_base_script() const; @@ -261,7 +261,7 @@ public: virtual void get_method_list(List<MethodInfo> *p_list) 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 call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount); virtual void call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount); diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp index fba1b992ec..4bd425f999 100644 --- a/modules/gdscript/gdscript_compiler.cpp +++ b/modules/gdscript/gdscript_compiler.cpp @@ -2076,10 +2076,10 @@ Error GDScriptCompiler::_parse_class_blocks(GDScript *p_script, const GDScriptPa /* STEP 2, INITIALIZE AND CONSTRUCT */ - Variant::CallError ce; + Callable::CallError ce; p_script->initializer->call(instance, NULL, 0, ce); - if (ce.error != Variant::CallError::CALL_OK) { + if (ce.error != Callable::CallError::CALL_OK) { //well, tough luck, not goinna do anything here } } diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 52527b7da3..eac879f3d9 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -905,10 +905,10 @@ static bool _guess_expression_type(GDScriptCompletionContext &p_context, const G argptr.push_back(&args[i]); } - Variant::CallError ce; + Callable::CallError ce; Variant ret = mb->call(baseptr, (const Variant **)argptr.ptr(), argptr.size(), ce); - if (ce.error == Variant::CallError::CALL_OK && ret.get_type() != Variant::NIL) { + if (ce.error == Callable::CallError::CALL_OK && ret.get_type() != Variant::NIL) { if (ret.get_type() != Variant::OBJECT || ret.operator Object *() != NULL) { r_type = _type_from_variant(ret); found = true; @@ -1060,7 +1060,7 @@ static bool _guess_expression_type(GDScriptCompletionContext &p_context, const G StringName id = index.value; found = _guess_identifier_type_from_base(c, base, id, r_type); } else if (!found && index.type.kind == GDScriptParser::DataType::BUILTIN) { - Variant::CallError err; + Callable::CallError err; Variant base_val = Variant::construct(base.type.builtin_type, NULL, 0, err); bool valid = false; Variant res = base_val.get(index.value, &valid); @@ -1114,7 +1114,7 @@ static bool _guess_expression_type(GDScriptCompletionContext &p_context, const G break; } - Variant::CallError ce; + Callable::CallError ce; bool v1_use_value = p1.value.get_type() != Variant::NIL && p1.value.get_type() != Variant::OBJECT; Variant v1 = (v1_use_value) ? p1.value : Variant::construct(p1.type.builtin_type, NULL, 0, ce); bool v2_use_value = p2.value.get_type() != Variant::NIL && p2.value.get_type() != Variant::OBJECT; @@ -1533,10 +1533,10 @@ static bool _guess_identifier_type_from_base(GDScriptCompletionContext &p_contex return false; } break; case GDScriptParser::DataType::BUILTIN: { - Variant::CallError err; + Callable::CallError err; Variant tmp = Variant::construct(base_type.builtin_type, NULL, 0, err); - if (err.error != Variant::CallError::CALL_OK) { + if (err.error != Callable::CallError::CALL_OK) { return false; } bool valid = false; @@ -1703,9 +1703,9 @@ static bool _guess_method_return_type_from_base(GDScriptCompletionContext &p_con return false; } break; case GDScriptParser::DataType::BUILTIN: { - Variant::CallError err; + Callable::CallError err; Variant tmp = Variant::construct(base_type.builtin_type, NULL, 0, err); - if (err.error != Variant::CallError::CALL_OK) { + if (err.error != Callable::CallError::CALL_OK) { return false; } @@ -2088,9 +2088,9 @@ static void _find_identifiers_in_base(const GDScriptCompletionContext &p_context return; } break; case GDScriptParser::DataType::BUILTIN: { - Variant::CallError err; + Callable::CallError err; Variant tmp = Variant::construct(base_type.builtin_type, NULL, 0, err); - if (err.error != Variant::CallError::CALL_OK) { + if (err.error != Callable::CallError::CALL_OK) { return; } @@ -2372,9 +2372,9 @@ static void _find_call_arguments(const GDScriptCompletionContext &p_context, con } break; case GDScriptParser::DataType::BUILTIN: { if (base.get_type() == Variant::NIL) { - Variant::CallError err; + Callable::CallError err; base = Variant::construct(base_type.builtin_type, NULL, 0, err); - if (err.error != Variant::CallError::CALL_OK) { + if (err.error != Callable::CallError::CALL_OK) { return; } } @@ -3219,9 +3219,9 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co v_ref.instance(); v = v_ref; } else { - Variant::CallError err; + Callable::CallError err; v = Variant::construct(base_type.builtin_type, NULL, 0, err); - if (err.error != Variant::CallError::CALL_OK) { + if (err.error != Callable::CallError::CALL_OK) { break; } } diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp index 1931d5f160..27857ea91f 100644 --- a/modules/gdscript/gdscript_function.cpp +++ b/modules/gdscript/gdscript_function.cpp @@ -160,11 +160,11 @@ static String _get_var_type(const Variant *p_var) { } #endif // DEBUG_ENABLED -String GDScriptFunction::_get_call_error(const Variant::CallError &p_err, const String &p_where, const Variant **argptrs) const { +String GDScriptFunction::_get_call_error(const Callable::CallError &p_err, const String &p_where, const Variant **argptrs) const { String err_text; - if (p_err.error == Variant::CallError::CALL_ERROR_INVALID_ARGUMENT) { + if (p_err.error == Callable::CallError::CALL_ERROR_INVALID_ARGUMENT) { int errorarg = p_err.argument; // Handle the Object to Object case separately as we don't have further class details. #ifdef DEBUG_ENABLED @@ -173,15 +173,15 @@ String GDScriptFunction::_get_call_error(const Variant::CallError &p_err, const } else #endif // DEBUG_ENABLED { - err_text = "Invalid type in " + p_where + ". Cannot convert argument " + itos(errorarg + 1) + " from " + Variant::get_type_name(argptrs[errorarg]->get_type()) + " to " + Variant::get_type_name(p_err.expected) + "."; + err_text = "Invalid type in " + p_where + ". Cannot convert argument " + itos(errorarg + 1) + " from " + Variant::get_type_name(argptrs[errorarg]->get_type()) + " to " + Variant::get_type_name(Variant::Type(p_err.expected)) + "."; } - } else if (p_err.error == Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS) { + } else if (p_err.error == Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS) { err_text = "Invalid call to " + p_where + ". Expected " + itos(p_err.argument) + " arguments."; - } else if (p_err.error == Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS) { + } else if (p_err.error == Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS) { err_text = "Invalid call to " + p_where + ". Expected " + itos(p_err.argument) + " arguments."; - } else if (p_err.error == Variant::CallError::CALL_ERROR_INVALID_METHOD) { + } else if (p_err.error == Callable::CallError::CALL_ERROR_INVALID_METHOD) { err_text = "Invalid call. Nonexistent " + p_where + "."; - } else if (p_err.error == Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL) { + } else if (p_err.error == Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL) { err_text = "Attempt to call " + p_where + " on a null instance."; } else { err_text = "Bug, call error: #" + itos(p_err.error); @@ -258,7 +258,7 @@ String GDScriptFunction::_get_call_error(const Variant::CallError &p_err, const #define OPCODE_OUT break #endif -Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_args, int p_argcount, Variant::CallError &r_err, CallState *p_state) { +Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_args, int p_argcount, Callable::CallError &r_err, CallState *p_state) { OPCODES_TABLE; @@ -267,7 +267,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a return Variant(); } - r_err.error = Variant::CallError::CALL_OK; + r_err.error = Callable::CallError::CALL_OK; Variant self; Variant static_ref; @@ -306,13 +306,13 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a if (p_argcount > _argument_count) { - r_err.error = Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; + r_err.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; r_err.argument = _argument_count; return Variant(); } else if (p_argcount < _argument_count - _default_arg_count) { - r_err.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; + r_err.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; r_err.argument = _argument_count - _default_arg_count; return Variant(); } else { @@ -341,7 +341,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a memnew_placement(&stack[i], Variant); continue; } else { - r_err.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_err.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_err.argument = i; r_err.expected = argument_types[i].kind == GDScriptDataType::BUILTIN ? argument_types[i].builtin_type : Variant::OBJECT; return Variant(); @@ -792,7 +792,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a #ifdef DEBUG_ENABLED if (Variant::can_convert_strict(src->get_type(), var_type)) { #endif // DEBUG_ENABLED - Variant::CallError ce; + Callable::CallError ce; *dst = Variant::construct(var_type, const_cast<const Variant **>(&src), 1, ce); } else { #ifdef DEBUG_ENABLED @@ -898,11 +898,11 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a GD_ERR_BREAK(to_type < 0 || to_type >= Variant::VARIANT_MAX); - Variant::CallError err; + Callable::CallError err; *dst = Variant::construct(to_type, (const Variant **)&src, 1, err); #ifdef DEBUG_ENABLED - if (err.error != Variant::CallError::CALL_OK) { + if (err.error != Callable::CallError::CALL_OK) { err_text = "Invalid cast: could not convert value to '" + Variant::get_type_name(to_type) + "'."; OPCODE_BREAK; } @@ -1001,11 +1001,11 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a } GET_VARIANT_PTR(dst, 3 + argc); - Variant::CallError err; + Callable::CallError err; *dst = Variant::construct(t, (const Variant **)argptrs, argc, err); #ifdef DEBUG_ENABLED - if (err.error != Variant::CallError::CALL_OK) { + if (err.error != Callable::CallError::CALL_OK) { err_text = _get_call_error(err, "'" + Variant::get_type_name(t) + "' constructor", (const Variant **)argptrs); OPCODE_BREAK; @@ -1092,7 +1092,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a } #endif - Variant::CallError err; + Callable::CallError err; if (call_ret) { GET_VARIANT_PTR(ret, argc); @@ -1106,7 +1106,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a function_call_time += OS::get_singleton()->get_ticks_usec() - call_time; } - if (err.error != Variant::CallError::CALL_OK) { + if (err.error != Callable::CallError::CALL_OK) { String methodstr = *methodname; String basestr = _get_var_type(base); @@ -1114,13 +1114,13 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a if (methodstr == "call") { if (argc >= 1) { methodstr = String(*argptrs[0]) + " (via call)"; - if (err.error == Variant::CallError::CALL_ERROR_INVALID_ARGUMENT) { + if (err.error == Callable::CallError::CALL_ERROR_INVALID_ARGUMENT) { err.argument += 1; } } } else if (methodstr == "free") { - if (err.error == Variant::CallError::CALL_ERROR_INVALID_METHOD) { + if (err.error == Callable::CallError::CALL_ERROR_INVALID_METHOD) { if (base->is_ref()) { err_text = "Attempted to free a reference."; @@ -1161,12 +1161,12 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a GET_VARIANT_PTR(dst, argc); - Variant::CallError err; + Callable::CallError err; GDScriptFunctions::call(func, (const Variant **)argptrs, argc, *dst, err); #ifdef DEBUG_ENABLED - if (err.error != Variant::CallError::CALL_OK) { + if (err.error != Callable::CallError::CALL_OK) { String methodstr = GDScriptFunctions::get_func_name(func); if (dst->get_type() == Variant::STRING) { @@ -1224,7 +1224,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a break; } - Variant::CallError err; + Callable::CallError err; if (E) { @@ -1235,23 +1235,23 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a MethodBind *mb = ClassDB::get_method(gds->native->get_name(), *methodname); if (!mb) { - err.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + err.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; } else { *dst = mb->call(p_instance->owner, (const Variant **)argptrs, argc, err); } } else { - err.error = Variant::CallError::CALL_OK; + err.error = Callable::CallError::CALL_OK; } } else { if (*methodname != GDScriptLanguage::get_singleton()->strings._init) { - err.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + err.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; } else { - err.error = Variant::CallError::CALL_OK; + err.error = Callable::CallError::CALL_OK; } } - if (err.error != Variant::CallError::CALL_OK) { + if (err.error != Callable::CallError::CALL_OK) { String methodstr = *methodname; err_text = _get_call_error(err, "function '" + methodstr + "'", (const Variant **)argptrs); @@ -1332,7 +1332,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a OPCODE_BREAK; } - Error err = obj->connect(signal, gdfs.ptr(), "_signal_callback", varray(gdfs), Object::CONNECT_ONESHOT); + Error err = obj->connect_compat(signal, gdfs.ptr(), "_signal_callback", varray(gdfs), Object::CONNECT_ONESHOT); if (err != OK) { err_text = "Error connecting to signal: " + signal + " during yield()."; OPCODE_BREAK; @@ -1341,7 +1341,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a Object *obj = argobj->operator Object *(); String signal = argname->operator String(); - obj->connect(signal, gdfs.ptr(), "_signal_callback", varray(gdfs), Object::CONNECT_ONESHOT); + obj->connect_compat(signal, gdfs.ptr(), "_signal_callback", varray(gdfs), Object::CONNECT_ONESHOT); #endif } @@ -1806,13 +1806,13 @@ GDScriptFunction::~GDScriptFunction() { ///////////////////// -Variant GDScriptFunctionState::_signal_callback(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant GDScriptFunctionState::_signal_callback(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { Variant arg; - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; 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; return Variant(); } else if (p_argcount == 1) { @@ -1830,7 +1830,7 @@ Variant GDScriptFunctionState::_signal_callback(const Variant **p_args, int p_ar Ref<GDScriptFunctionState> self = *p_args[p_argcount - 1]; 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.expected = Variant::OBJECT; return Variant(); @@ -1865,7 +1865,7 @@ Variant GDScriptFunctionState::resume(const Variant &p_arg) { } state.result = p_arg; - Variant::CallError err; + Callable::CallError err; Variant ret = function->call(NULL, NULL, 0, err, &state); bool completed = true; diff --git a/modules/gdscript/gdscript_function.h b/modules/gdscript/gdscript_function.h index 2c432360ba..34019e563d 100644 --- a/modules/gdscript/gdscript_function.h +++ b/modules/gdscript/gdscript_function.h @@ -266,7 +266,7 @@ private: List<StackDebug> stack_debug; _FORCE_INLINE_ Variant *_get_variant(int p_address, GDScriptInstance *p_instance, GDScript *p_script, Variant &self, Variant &static_ref, Variant *p_stack, String &r_error) const; - _FORCE_INLINE_ String _get_call_error(const Variant::CallError &p_err, const String &p_where, const Variant **argptrs) const; + _FORCE_INLINE_ String _get_call_error(const Callable::CallError &p_err, const String &p_where, const Variant **argptrs) const; friend class GDScriptLanguage; @@ -339,7 +339,7 @@ public: return default_arguments[p_idx]; } - Variant call(GDScriptInstance *p_instance, const Variant **p_args, int p_argcount, Variant::CallError &r_err, CallState *p_state = NULL); + Variant call(GDScriptInstance *p_instance, const Variant **p_args, int p_argcount, Callable::CallError &r_err, CallState *p_state = NULL); _FORCE_INLINE_ MultiplayerAPI::RPCMode get_rpc_mode() const { return rpc_mode; } GDScriptFunction(); @@ -352,7 +352,7 @@ class GDScriptFunctionState : public Reference { friend class GDScriptFunction; GDScriptFunction *function; GDScriptFunction::CallState state; - 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); Ref<GDScriptFunctionState> first_state; protected: diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp index bd887fd303..18ec147c13 100644 --- a/modules/gdscript/gdscript_functions.cpp +++ b/modules/gdscript/gdscript_functions.cpp @@ -139,32 +139,32 @@ const char *GDScriptFunctions::get_func_name(Function p_func) { return _names[p_func]; } -void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_count, Variant &r_ret, Variant::CallError &r_error) { +void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_count, Variant &r_ret, Callable::CallError &r_error) { - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; #ifdef DEBUG_ENABLED -#define VALIDATE_ARG_COUNT(m_count) \ - if (p_arg_count < m_count) { \ - r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; \ - r_error.argument = m_count; \ - r_ret = Variant(); \ - return; \ - } \ - if (p_arg_count > m_count) { \ - r_error.error = Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; \ - r_error.argument = m_count; \ - r_ret = Variant(); \ - return; \ +#define VALIDATE_ARG_COUNT(m_count) \ + if (p_arg_count < m_count) { \ + r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; \ + r_error.argument = m_count; \ + r_ret = Variant(); \ + return; \ + } \ + if (p_arg_count > m_count) { \ + r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; \ + r_error.argument = m_count; \ + r_ret = Variant(); \ + return; \ } -#define VALIDATE_ARG_NUM(m_arg) \ - if (!p_args[m_arg]->is_num()) { \ - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; \ - r_error.argument = m_arg; \ - r_error.expected = Variant::REAL; \ - r_ret = Variant(); \ - return; \ +#define VALIDATE_ARG_NUM(m_arg) \ + if (!p_args[m_arg]->is_num()) { \ + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; \ + r_error.argument = m_arg; \ + r_error.expected = Variant::REAL; \ + r_ret = Variant(); \ + return; \ } #else @@ -278,7 +278,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ r_ret = Math::abs(r); } 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.expected = Variant::REAL; r_ret = Variant(); @@ -296,7 +296,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ r_ret = r < 0.0 ? -1.0 : (r > 0.0 ? +1.0 : 0.0); } 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.expected = Variant::REAL; r_ret = Variant(); @@ -585,7 +585,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ Ref<WeakRef> wref = memnew(WeakRef); r_ret = wref; } 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.expected = Variant::OBJECT; r_ret = Variant(); @@ -596,7 +596,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ VALIDATE_ARG_COUNT(2); if (p_args[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.expected = Variant::OBJECT; r_ret = Variant(); @@ -604,7 +604,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ } if (p_args[1]->get_type() != Variant::STRING && p_args[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.expected = Variant::STRING; r_ret = Variant(); @@ -626,7 +626,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ if (type < 0 || type >= Variant::VARIANT_MAX) { r_ret = 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.expected = Variant::INT; return; @@ -660,7 +660,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ if (p_args[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.expected = Variant::STRING; r_ret = Variant(); @@ -671,7 +671,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ 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.expected = Variant::STRING; r_ret = RTR("Expected a string of length 1 (a character)."); @@ -683,7 +683,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ } break; case TEXT_STR: { if (p_arg_count < 1) { - 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_ret = Variant(); @@ -785,7 +785,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ case PUSH_ERROR: { VALIDATE_ARG_COUNT(1); if (p_args[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.expected = Variant::STRING; r_ret = Variant(); @@ -799,7 +799,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ case PUSH_WARNING: { VALIDATE_ARG_COUNT(1); if (p_args[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.expected = Variant::STRING; r_ret = Variant(); @@ -819,7 +819,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ case STR_TO_VAR: { VALIDATE_ARG_COUNT(1); if (p_args[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.expected = Variant::STRING; r_ret = Variant(); @@ -837,17 +837,17 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ case VAR_TO_BYTES: { bool full_objects = false; if (p_arg_count < 1) { - 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_ret = Variant(); return; } else if (p_arg_count > 2) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; r_error.argument = 2; r_ret = Variant(); } else if (p_arg_count == 2) { if (p_args[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.expected = Variant::BOOL; r_ret = Variant(); @@ -860,7 +860,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ int len; Error err = encode_variant(*p_args[0], NULL, len, full_objects); 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.expected = Variant::NIL; r_ret = "Unexpected error encoding variable to bytes, likely unserializable type found (Object or RID)."; @@ -877,17 +877,17 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ case BYTES_TO_VAR: { bool allow_objects = false; if (p_arg_count < 1) { - 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_ret = Variant(); return; } else if (p_arg_count > 2) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; r_error.argument = 2; r_ret = Variant(); } else if (p_arg_count == 2) { if (p_args[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.expected = Variant::BOOL; r_ret = Variant(); @@ -897,7 +897,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ } if (p_args[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 = 1; r_error.expected = Variant::PACKED_BYTE_ARRAY; r_ret = Variant(); @@ -911,7 +911,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ Error err = decode_variant(ret, r, varr.size(), NULL, allow_objects); if (err != OK) { r_ret = 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.expected = Variant::PACKED_BYTE_ARRAY; return; @@ -927,7 +927,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ case 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_ret = Variant(); @@ -943,7 +943,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ } Error err = arr.resize(count); if (err != OK) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; r_ret = Variant(); return; } @@ -969,7 +969,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ } Error err = arr.resize(to - from); if (err != OK) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; r_ret = Variant(); return; } @@ -989,7 +989,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ if (incr == 0) { r_ret = RTR("Step argument is zero!"); - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; return; } @@ -1016,7 +1016,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ Error err = arr.resize(count); if (err != OK) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; r_ret = Variant(); return; } @@ -1038,7 +1038,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ } break; default: { - r_error.error = Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; r_error.argument = 3; r_ret = Variant(); @@ -1049,7 +1049,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ case RESOURCE_LOAD: { VALIDATE_ARG_COUNT(1); if (p_args[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.expected = Variant::STRING; r_ret = Variant(); @@ -1065,7 +1065,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ if (p_args[0]->get_type() == Variant::NIL) { r_ret = Variant(); } else if (p_args[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_ret = Variant(); } else { @@ -1076,7 +1076,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ } else if (!obj->get_script_instance() || obj->get_script_instance()->get_language() != GDScriptLanguage::get_singleton()) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; r_error.expected = Variant::DICTIONARY; r_ret = RTR("Not a script with an instance"); @@ -1087,7 +1087,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ Ref<GDScript> base = ins->get_script(); if (base.is_null()) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; r_error.expected = Variant::DICTIONARY; r_ret = RTR("Not based on a script"); @@ -1105,7 +1105,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ sname.invert(); if (!p->path.is_resource_file()) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; r_error.expected = Variant::DICTIONARY; r_ret = Variant(); @@ -1137,7 +1137,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ if (p_args[0]->get_type() != Variant::DICTIONARY) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; r_error.expected = Variant::DICTIONARY; r_ret = Variant(); @@ -1149,7 +1149,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ if (!d.has("@path")) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; r_error.expected = Variant::OBJECT; r_ret = RTR("Invalid instance dictionary format (missing @path)"); @@ -1160,7 +1160,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ Ref<Script> scr = ResourceLoader::load(d["@path"]); if (!scr.is_valid()) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; r_error.expected = Variant::OBJECT; r_ret = RTR("Invalid instance dictionary format (can't load script at @path)"); @@ -1171,7 +1171,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ if (!gdscr.is_valid()) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; r_error.expected = Variant::OBJECT; r_ret = Variant(); @@ -1189,7 +1189,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ gdscr = gdscr->subclasses[sub.get_name(i)]; if (!gdscr.is_valid()) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; r_error.expected = Variant::OBJECT; r_ret = Variant(); @@ -1215,7 +1215,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ VALIDATE_ARG_COUNT(1); if (p_args[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.expected = Variant::STRING; r_ret = Variant(); @@ -1239,7 +1239,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ VALIDATE_ARG_COUNT(1); if (p_args[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.expected = Variant::STRING; r_ret = Variant(); @@ -1271,14 +1271,14 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ case COLOR8: { if (p_arg_count < 3) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; r_error.argument = 3; r_ret = Variant(); return; } if (p_arg_count > 4) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; r_error.argument = 4; r_ret = Variant(); @@ -1302,21 +1302,21 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ case COLORN: { if (p_arg_count < 1) { - 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_ret = Variant(); return; } if (p_arg_count > 2) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; r_error.argument = 2; r_ret = Variant(); return; } if (p_args[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_ret = Variant(); } else { @@ -1360,7 +1360,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ VALIDATE_ARG_COUNT(1); if (p_args[0]->get_type() != Variant::INT && p_args[0]->get_type() != Variant::REAL) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; r_error.expected = Variant::INT; r_ret = Variant(); @@ -1426,7 +1426,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ r_ret = d.size(); } break; default: { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; r_error.expected = Variant::OBJECT; r_ret = Variant(); diff --git a/modules/gdscript/gdscript_functions.h b/modules/gdscript/gdscript_functions.h index 8b97194ed6..2c6dc02913 100644 --- a/modules/gdscript/gdscript_functions.h +++ b/modules/gdscript/gdscript_functions.h @@ -129,7 +129,7 @@ public: }; static const char *get_func_name(Function p_func); - static void call(Function p_func, const Variant **p_args, int p_arg_count, Variant &r_ret, Variant::CallError &r_error); + static void call(Function p_func, const Variant **p_args, int p_arg_count, Variant &r_ret, Callable::CallError &r_error); static bool is_deterministic(Function p_func); static MethodInfo get_info(Function p_func); }; diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 33c6a55bfb..ce6226d757 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -1739,7 +1739,7 @@ GDScriptParser::Node *GDScriptParser::_reduce_expression(Node *p_node, bool p_to vptr = (const Variant **)&ptrs[0]; } - Variant::CallError ce; + Callable::CallError ce; Variant v; if (op->arguments[0]->type == Node::TYPE_TYPE) { @@ -1751,7 +1751,7 @@ GDScriptParser::Node *GDScriptParser::_reduce_expression(Node *p_node, bool p_to GDScriptFunctions::call(func, vptr, ptrs.size(), v, ce); } - if (ce.error != Variant::CallError::CALL_OK) { + if (ce.error != Callable::CallError::CALL_OK) { String errwhere; if (op->arguments[0]->type == Node::TYPE_TYPE) { @@ -1765,16 +1765,16 @@ GDScriptParser::Node *GDScriptParser::_reduce_expression(Node *p_node, bool p_to switch (ce.error) { - case Variant::CallError::CALL_ERROR_INVALID_ARGUMENT: { + case Callable::CallError::CALL_ERROR_INVALID_ARGUMENT: { _set_error("Invalid argument (#" + itos(ce.argument + 1) + ") for " + errwhere + "."); } break; - case Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS: { + case Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS: { _set_error("Too many arguments for " + errwhere + "."); } break; - case Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS: { + case Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS: { _set_error("Too few arguments for " + errwhere + "."); } break; @@ -4809,7 +4809,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) { } #ifdef TOOLS_ENABLED - Variant::CallError ce; + Callable::CallError ce; member.default_value = Variant::construct(member._export.type, NULL, 0, ce); #endif @@ -4878,7 +4878,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) { if (cn->value.get_type() != Variant::NIL) { if (member._export.type != Variant::NIL && cn->value.get_type() != member._export.type) { if (Variant::can_convert(cn->value.get_type(), member._export.type)) { - Variant::CallError err; + Callable::CallError err; const Variant *args = &cn->value; cn->value = Variant::construct(member._export.type, &args, 1, err); } else { @@ -5933,9 +5933,9 @@ GDScriptParser::DataType GDScriptParser::_get_operation_type(const Variant::Oper a_ref.instance(); a = a_ref; } else { - Variant::CallError err; + Callable::CallError err; a = Variant::construct(a_type, NULL, 0, err); - if (err.error != Variant::CallError::CALL_OK) { + if (err.error != Callable::CallError::CALL_OK) { r_valid = false; return DataType(); } @@ -5946,9 +5946,9 @@ GDScriptParser::DataType GDScriptParser::_get_operation_type(const Variant::Oper b_ref.instance(); b = b_ref; } else { - Variant::CallError err; + Callable::CallError err; b = Variant::construct(b_type, NULL, 0, err); - if (err.error != Variant::CallError::CALL_OK) { + if (err.error != Callable::CallError::CALL_OK) { r_valid = false; return DataType(); } @@ -6218,7 +6218,7 @@ GDScriptParser::Node *GDScriptParser::_get_default_value_for_type(const DataType result = alloc_node<DictionaryNode>(); } else { ConstantNode *c = alloc_node<ConstantNode>(); - Variant::CallError err; + Callable::CallError err; c->value = Variant::construct(p_type.builtin_type, NULL, 0, err); result = c; } @@ -6531,7 +6531,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) { result.has_type = false; } break; default: { - Variant::CallError err; + Callable::CallError err; Variant temp = Variant::construct(base_type.builtin_type, NULL, 0, err); bool valid = false; @@ -6656,7 +6656,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) { break; } default: { - Variant::CallError err; + Callable::CallError err; Variant temp = Variant::construct(base_type.builtin_type, NULL, 0, err); bool valid = false; @@ -7095,7 +7095,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat } if (base_type.kind == DataType::BUILTIN) { - Variant::CallError err; + Callable::CallError err; Variant tmp = Variant::construct(base_type.builtin_type, NULL, 0, err); if (check_types) { diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp index b30f81959e..745dd37a5b 100644 --- a/modules/gdscript/gdscript_tokenizer.cpp +++ b/modules/gdscript/gdscript_tokenizer.cpp @@ -162,6 +162,8 @@ static const _bit _type_list[] = { { Variant::OBJECT, "Object" }, { Variant::NODE_PATH, "NodePath" }, { Variant::DICTIONARY, "Dictionary" }, + { Variant::CALLABLE, "Callable" }, + { Variant::SIGNAL, "Signal" }, { Variant::ARRAY, "Array" }, { Variant::PACKED_BYTE_ARRAY, "PackedByteArray" }, { Variant::PACKED_INT_ARRAY, "PackedIntArray" }, diff --git a/modules/gdscript/language_server/gdscript_language_protocol.cpp b/modules/gdscript/language_server/gdscript_language_protocol.cpp index b2da5dfdbc..590cfd88d7 100644 --- a/modules/gdscript/language_server/gdscript_language_protocol.cpp +++ b/modules/gdscript/language_server/gdscript_language_protocol.cpp @@ -161,9 +161,9 @@ Error GDScriptLanguageProtocol::start(int p_port, const IP_Address &p_bind_ip) { server = dynamic_cast<WebSocketServer *>(ClassDB::instance("WebSocketServer")); ERR_FAIL_COND_V(!server, FAILED); server->set_buffers(8192, 1024, 8192, 1024); // 8mb should be way more than enough - server->connect("data_received", this, "on_data_received"); - server->connect("client_connected", this, "on_client_connected"); - server->connect("client_disconnected", this, "on_client_disconnected"); + server->connect_compat("data_received", this, "on_data_received"); + server->connect_compat("client_connected", this, "on_client_connected"); + server->connect_compat("client_disconnected", this, "on_client_disconnected"); } server->set_bind_ip(p_bind_ip); return server->listen(p_port); diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index 43f5feb388..761771a02c 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -954,7 +954,7 @@ void GridMapEditor::update_palette() { void GridMapEditor::edit(GridMap *p_gridmap) { if (!p_gridmap && node) - node->disconnect("cell_size_changed", this, "_draw_grids"); + node->disconnect_compat("cell_size_changed", this, "_draw_grids"); node = p_gridmap; @@ -988,7 +988,7 @@ void GridMapEditor::edit(GridMap *p_gridmap) { update_grid(); _update_clip(); - node->connect("cell_size_changed", this, "_draw_grids"); + node->connect_compat("cell_size_changed", this, "_draw_grids"); } void GridMapEditor::_update_clip() { @@ -1077,8 +1077,8 @@ void GridMapEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - get_tree()->connect("node_removed", this, "_node_removed"); - mesh_library_palette->connect("item_selected", this, "_item_selected_cbk"); + get_tree()->connect_compat("node_removed", this, "_node_removed"); + mesh_library_palette->connect_compat("item_selected", this, "_item_selected_cbk"); for (int i = 0; i < 3; i++) { grid[i] = VS::get_singleton()->mesh_create(); @@ -1094,7 +1094,7 @@ void GridMapEditor::_notification(int p_what) { } break; case NOTIFICATION_EXIT_TREE: { - get_tree()->disconnect("node_removed", this, "_node_removed"); + get_tree()->disconnect_compat("node_removed", this, "_node_removed"); _clear_clipboard_data(); for (int i = 0; i < 3; i++) { @@ -1241,9 +1241,9 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { floor->get_line_edit()->add_constant_override("minimum_spaces", 16); spatial_editor_hb->add_child(floor); - floor->connect("value_changed", this, "_floor_changed"); - floor->connect("mouse_exited", this, "_floor_mouse_exited"); - floor->get_line_edit()->connect("mouse_exited", this, "_floor_mouse_exited"); + floor->connect_compat("value_changed", this, "_floor_changed"); + floor->connect_compat("mouse_exited", this, "_floor_mouse_exited"); + floor->get_line_edit()->connect_compat("mouse_exited", this, "_floor_mouse_exited"); spatial_editor_hb->add_child(memnew(VSeparator)); @@ -1300,7 +1300,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { settings_vbc->add_margin_child(TTR("Pick Distance:"), settings_pick_distance); clip_mode = CLIP_DISABLED; - options->get_popup()->connect("id_pressed", this, "_menu_option"); + options->get_popup()->connect_compat("id_pressed", this, "_menu_option"); HBoxContainer *hb = memnew(HBoxContainer); add_child(hb); @@ -1310,22 +1310,22 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { search_box->set_h_size_flags(SIZE_EXPAND_FILL); search_box->set_placeholder(TTR("Filter meshes")); hb->add_child(search_box); - search_box->connect("text_changed", this, "_text_changed"); - search_box->connect("gui_input", this, "_sbox_input"); + search_box->connect_compat("text_changed", this, "_text_changed"); + search_box->connect_compat("gui_input", this, "_sbox_input"); mode_thumbnail = memnew(ToolButton); mode_thumbnail->set_toggle_mode(true); mode_thumbnail->set_pressed(true); mode_thumbnail->set_icon(p_editor->get_gui_base()->get_icon("FileThumbnail", "EditorIcons")); hb->add_child(mode_thumbnail); - mode_thumbnail->connect("pressed", this, "_set_display_mode", varray(DISPLAY_THUMBNAIL)); + mode_thumbnail->connect_compat("pressed", this, "_set_display_mode", varray(DISPLAY_THUMBNAIL)); mode_list = memnew(ToolButton); mode_list->set_toggle_mode(true); mode_list->set_pressed(false); mode_list->set_icon(p_editor->get_gui_base()->get_icon("FileList", "EditorIcons")); hb->add_child(mode_list); - mode_list->connect("pressed", this, "_set_display_mode", varray(DISPLAY_LIST)); + mode_list->connect_compat("pressed", this, "_set_display_mode", varray(DISPLAY_LIST)); size_slider = memnew(HSlider); size_slider->set_h_size_flags(SIZE_EXPAND_FILL); @@ -1333,7 +1333,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { size_slider->set_max(4.0f); size_slider->set_step(0.1f); size_slider->set_value(1.0f); - size_slider->connect("value_changed", this, "_icon_size_changed"); + size_slider->connect_compat("value_changed", this, "_icon_size_changed"); add_child(size_slider); EDITOR_DEF("editors/grid_map/preview_size", 64); @@ -1343,7 +1343,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { mesh_library_palette = memnew(ItemList); add_child(mesh_library_palette); mesh_library_palette->set_v_size_flags(SIZE_EXPAND_FILL); - mesh_library_palette->connect("gui_input", this, "_mesh_library_palette_input"); + mesh_library_palette->connect_compat("gui_input", this, "_mesh_library_palette_input"); info_message = memnew(Label); info_message->set_text(TTR("Give a MeshLibrary resource to this GridMap to use its meshes.")); diff --git a/modules/mbedtls/dtls_server_mbedtls.cpp b/modules/mbedtls/dtls_server_mbedtls.cpp index c4ac69e9ab..215b511758 100644 --- a/modules/mbedtls/dtls_server_mbedtls.cpp +++ b/modules/mbedtls/dtls_server_mbedtls.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/mbedtls/dtls_server_mbedtls.h b/modules/mbedtls/dtls_server_mbedtls.h index 180ab7d84c..d61ab3179e 100644 --- a/modules/mbedtls/dtls_server_mbedtls.h +++ b/modules/mbedtls/dtls_server_mbedtls.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/mbedtls/packet_peer_mbed_dtls.cpp b/modules/mbedtls/packet_peer_mbed_dtls.cpp index 134bd54801..bdf36ad1b1 100755 --- a/modules/mbedtls/packet_peer_mbed_dtls.cpp +++ b/modules/mbedtls/packet_peer_mbed_dtls.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/mbedtls/packet_peer_mbed_dtls.h b/modules/mbedtls/packet_peer_mbed_dtls.h index bd0856abe8..26c4543785 100755 --- a/modules/mbedtls/packet_peer_mbed_dtls.h +++ b/modules/mbedtls/packet_peer_mbed_dtls.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 15415d7655..2b3b6aa98a 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -1720,7 +1720,7 @@ bool CSharpInstance::has_method(const StringName &p_method) const { return false; } -Variant CSharpInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant CSharpInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { ERR_FAIL_COND_V(!script.is_valid(), Variant()); @@ -1729,7 +1729,7 @@ Variant CSharpInstance::call(const StringName &p_method, const Variant **p_args, MonoObject *mono_object = get_mono_object(); if (!mono_object) { - r_error.error = Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL; + r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL; ERR_FAIL_V(Variant()); } @@ -1741,7 +1741,7 @@ Variant CSharpInstance::call(const StringName &p_method, const Variant **p_args, if (method) { MonoObject *return_value = method->invoke(mono_object, p_args); - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; if (return_value) { return GDMonoMarshal::mono_object_to_variant(return_value); @@ -1753,7 +1753,7 @@ Variant CSharpInstance::call(const StringName &p_method, const Variant **p_args, top = top->get_parent_class(); } - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; return Variant(); } @@ -2704,11 +2704,11 @@ void CSharpScript::_clear() { script_class = NULL; } -Variant CSharpScript::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant CSharpScript::call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { if (unlikely(GDMono::get_singleton() == NULL)) { // Probably not the best error but eh. - r_error.error = Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL; + r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL; return Variant(); } @@ -2904,7 +2904,7 @@ StringName CSharpScript::get_instance_base_type() const { return StringName(); } -CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Variant::CallError &r_error) { +CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Callable::CallError &r_error) { GD_MONO_ASSERT_THREAD_ATTACHED; @@ -2968,7 +2968,7 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg CRASH_COND(die == true); p_owner->set_script_instance(NULL); - r_error.error = Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL; + r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL; ERR_FAIL_V_MSG(NULL, "Failed to allocate memory for the object."); } @@ -2994,14 +2994,14 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg return instance; } -Variant CSharpScript::_new(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant CSharpScript::_new(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { if (!valid) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; return Variant(); } - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; ERR_FAIL_NULL_V(native, Variant()); @@ -3049,7 +3049,7 @@ ScriptInstance *CSharpScript::instance_create(Object *p_this) { GD_MONO_SCOPE_THREAD_ATTACH; - Variant::CallError unchecked_error; + Callable::CallError unchecked_error; return _create_instance(NULL, 0, p_this, Object::cast_to<Reference>(p_this) != NULL, unchecked_error); } diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h index 8ee741b4d2..627218eaf5 100644 --- a/modules/mono/csharp_script.h +++ b/modules/mono/csharp_script.h @@ -141,8 +141,8 @@ class CSharpScript : public Script { static int _try_get_member_export_hint(IMonoClassMember *p_member, ManagedType p_type, Variant::Type p_variant_type, bool p_allow_generics, PropertyHint &r_hint, String &r_hint_string); #endif - CSharpInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Variant::CallError &r_error); - Variant _new(const Variant **p_args, int p_argcount, Variant::CallError &r_error); + CSharpInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Callable::CallError &r_error); + Variant _new(const Variant **p_args, int p_argcount, Callable::CallError &r_error); // Do not use unless you know what you are doing friend void GDMonoInternals::tie_managed_to_unmanaged(MonoObject *, Object *); @@ -154,7 +154,7 @@ class CSharpScript : public Script { protected: static void _bind_methods(); - Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error); + Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error); virtual void _resource_path_changed(); bool _get(const StringName &p_name, Variant &r_ret) const; bool _set(const StringName &p_name, const Variant &p_value); @@ -265,7 +265,7 @@ public: /* TODO */ virtual void get_method_list(List<MethodInfo> *p_list) 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 call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount); virtual void call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount); diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 0724d72ce6..10595b4fcc 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -2054,7 +2054,7 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte } if (p_imethod.is_vararg) { - p_output.append("\tVariant::CallError vcall_error;\n\t"); + p_output.append("\tCallable::CallError vcall_error;\n\t"); if (!ret_void) { // See the comment on the C_LOCAL_VARARG_RET declaration diff --git a/modules/mono/glue/base_object_glue.cpp b/modules/mono/glue/base_object_glue.cpp index 8dfb5b7147..8c77220b85 100644 --- a/modules/mono/glue/base_object_glue.cpp +++ b/modules/mono/glue/base_object_glue.cpp @@ -189,12 +189,12 @@ MonoBoolean godot_icall_DynamicGodotObject_InvokeMember(Object *p_ptr, MonoStrin args.set(i, &arg_store.get(i)); } - Variant::CallError error; + Callable::CallError error; Variant result = p_ptr->call(StringName(name), args.ptr(), argc, error); *r_result = GDMonoMarshal::variant_to_mono_object(result); - return error.error == Variant::CallError::CALL_OK; + return error.error == Callable::CallError::CALL_OK; } MonoBoolean godot_icall_DynamicGodotObject_GetMember(Object *p_ptr, MonoString *p_name, MonoObject **r_result) { diff --git a/modules/mono/glue/gd_glue.cpp b/modules/mono/glue/gd_glue.cpp index a6273a60ac..cdacd90538 100644 --- a/modules/mono/glue/gd_glue.cpp +++ b/modules/mono/glue/gd_glue.cpp @@ -55,9 +55,9 @@ MonoObject *godot_icall_GD_bytes2var(MonoArray *p_bytes, MonoBoolean p_allow_obj MonoObject *godot_icall_GD_convert(MonoObject *p_what, int32_t p_type) { Variant what = GDMonoMarshal::mono_object_to_variant(p_what); const Variant *args[1] = { &what }; - Variant::CallError ce; + Callable::CallError ce; Variant ret = Variant::construct(Variant::Type(p_type), args, 1, ce); - ERR_FAIL_COND_V(ce.error != Variant::CallError::CALL_OK, NULL); + ERR_FAIL_COND_V(ce.error != Callable::CallError::CALL_OK, NULL); return GDMonoMarshal::variant_to_mono_object(ret); } diff --git a/modules/mono/signal_awaiter_utils.cpp b/modules/mono/signal_awaiter_utils.cpp index b85d5f2fd9..718bc2bb93 100644 --- a/modules/mono/signal_awaiter_utils.cpp +++ b/modules/mono/signal_awaiter_utils.cpp @@ -51,7 +51,7 @@ Error connect_signal_awaiter(Object *p_source, const String &p_signal, Object *p Vector<Variant> binds; binds.push_back(sa_con); - Error err = p_source->connect(p_signal, sa_con.ptr(), + Error err = p_source->connect_compat(p_signal, sa_con.ptr(), CSharpLanguage::get_singleton()->get_string_names()._signal_callback, binds, Object::CONNECT_ONESHOT); @@ -65,7 +65,7 @@ Error connect_signal_awaiter(Object *p_source, const String &p_signal, Object *p } } // namespace SignalAwaiterUtils -Variant SignalAwaiterHandle::_signal_callback(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant SignalAwaiterHandle::_signal_callback(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { #ifdef DEBUG_ENABLED ERR_FAIL_COND_V_MSG(conn_target_id.is_valid() && !ObjectDB::get_instance(conn_target_id), Variant(), @@ -73,7 +73,7 @@ Variant SignalAwaiterHandle::_signal_callback(const Variant **p_args, int p_argc #endif if (p_argcount < 1) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; r_error.argument = 1; return Variant(); } @@ -81,7 +81,7 @@ Variant SignalAwaiterHandle::_signal_callback(const Variant **p_args, int p_argc Ref<SignalAwaiterHandle> self = *p_args[p_argcount - 1]; 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.expected = Variant::OBJECT; return Variant(); diff --git a/modules/mono/signal_awaiter_utils.h b/modules/mono/signal_awaiter_utils.h index a9956ad5ba..012f6e5bb3 100644 --- a/modules/mono/signal_awaiter_utils.h +++ b/modules/mono/signal_awaiter_utils.h @@ -49,7 +49,7 @@ class SignalAwaiterHandle : public MonoGCHandle { ObjectID conn_target_id; #endif - 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: static void _bind_methods(); diff --git a/modules/opensimplex/noise_texture.cpp b/modules/opensimplex/noise_texture.cpp index 19aa281a72..35f0fb7ac0 100644 --- a/modules/opensimplex/noise_texture.cpp +++ b/modules/opensimplex/noise_texture.cpp @@ -184,11 +184,11 @@ void NoiseTexture::set_noise(Ref<OpenSimplexNoise> p_noise) { if (p_noise == noise) return; if (noise.is_valid()) { - noise->disconnect(CoreStringNames::get_singleton()->changed, this, "_queue_update"); + noise->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_queue_update"); } noise = p_noise; if (noise.is_valid()) { - noise->connect(CoreStringNames::get_singleton()->changed, this, "_queue_update"); + noise->connect_compat(CoreStringNames::get_singleton()->changed, this, "_queue_update"); } _queue_update(); } diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index 762566e9ae..70f650cfd3 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -88,11 +88,11 @@ void VisualScriptNode::validate_input_default_values() { continue; } else { //not the same, reconvert - Variant::CallError ce; + Callable::CallError ce; Variant existing = default_input_values[i]; const Variant *existingp = &existing; 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.. 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()) { - 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); } @@ -340,7 +340,7 @@ void VisualScript::add_node(const StringName &p_func, int p_id, const Ref<Visual nd.pos = p_pos; 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->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.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.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) -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); @@ -1577,7 +1577,7 @@ void VisualScriptInstance::_dependency_step(VisualScriptNodeInstance *node, int for (int i = 0; i < dc; i++) { _dependency_step(deps[i], p_pass, pass_stack, input_args, output_args, variant_stack, r_error, error_str, r_error_node); - if (r_error.error != Variant::CallError::CALL_OK) + if (r_error.error != Callable::CallError::CALL_OK) 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); //ignore return - if (r_error.error != Variant::CallError::CALL_OK) { + if (r_error.error != Callable::CallError::CALL_OK) { *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); 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++) { _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; current_node_id = node->id; 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); - if (r_error.error != Variant::CallError::CALL_OK) { + if (r_error.error != Callable::CallError::CALL_OK) { //use error from step error = true; break; @@ -1738,7 +1738,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p if (ret & VisualScriptNodeInstance::STEP_YIELD_BIT) { //yielded! 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 = true; break; @@ -1747,7 +1747,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p Ref<VisualScriptFunctionState> state = *working_mem; 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 = true; break; @@ -1766,7 +1766,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p state->pass = p_pass; copymem(state->stack.ptrw(), p_stack, p_stack_size); //step 2, run away, return directly - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; #ifdef DEBUG_ENABLED //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 (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 = true; } 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 no exit bit was set, and has sequence outputs, guess next node 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 = true; break; @@ -1888,7 +1888,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p } 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 = true; break; @@ -1900,7 +1900,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p } else { // check for stack overflow 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 = true; break; @@ -1952,22 +1952,22 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p String err_func = p_method; 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()) { 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; - error_str += "Cannot convert argument " + itos(errorarg + 1) + " to " + Variant::get_type_name(r_error.expected) + "."; - } else if (r_error.error == Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS) { + error_str += "Cannot convert argument " + itos(errorarg + 1) + " to " + Variant::get_type_name(Variant::Type(r_error.expected)) + "."; + } else if (r_error.error == Callable::CallError::CALL_ERROR_TOO_MANY_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."; - } 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."; - } 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"; } } @@ -2000,13 +2000,13 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p 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); if (!F) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; 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); 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."); } @@ -2062,14 +2062,14 @@ Variant VisualScriptInstance::call(const StringName &p_method, const Variant **p VSDEBUG("ARGUMENTS: " + itos(f->argument_count) = " RECEIVED: " + itos(p_argcount)); 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(); return Variant(); } 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(); return Variant(); @@ -2094,15 +2094,15 @@ void VisualScriptInstance::notification(int p_notification) { Variant what = p_notification; const Variant *whatp = &what; - Variant::CallError ce; + Callable::CallError ce; call(VisualScriptLanguage::singleton->notification, &whatp, 1, ce); //do as call } String VisualScriptInstance::to_string(bool *r_valid) { 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); - if (ce.error == Variant::CallError::CALL_OK) { + if (ce.error == Callable::CallError::CALL_OK) { if (ret.get_type() != Variant::STRING) { if (r_valid) *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()); @@ -2419,12 +2419,12 @@ Variant VisualScriptFunctionState::_signal_callback(const Variant **p_args, int #endif - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; Array args; 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; return Variant(); } 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. 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.expected = Variant::OBJECT; 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; @@ -2463,7 +2463,7 @@ void VisualScriptFunctionState::connect_to_signal(Object *p_obj, const String &p binds.push_back(p_binds[i]); } 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 { @@ -2481,8 +2481,8 @@ Variant VisualScriptFunctionState::resume(Array p_args) { #endif - Variant::CallError r_error; - r_error.error = Variant::CallError::CALL_OK; + Callable::CallError r_error; + r_error.error = Callable::CallError::CALL_OK; Variant *working_mem = ((Variant *)stack.ptr()) + working_mem_index; diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h index cc77f9d891..08b84bce1d 100644 --- a/modules/visual_script/visual_script.h +++ b/modules/visual_script/visual_script.h @@ -155,7 +155,7 @@ public: 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); } @@ -408,8 +408,8 @@ class VisualScriptInstance : public ScriptInstance { 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); - 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); + 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, Callable::CallError &r_error); //Map<StringName,Function> functions; friend class VisualScriptFunctionState; //for yield @@ -422,7 +422,7 @@ public: virtual void get_method_list(List<MethodInfo> *p_list) 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); String to_string(bool *r_valid); @@ -487,7 +487,7 @@ class VisualScriptFunctionState : public Reference { int flow_stack_pos; 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: static void _bind_methods(); diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp index e6c95c38b8..3fd2b474bb 100644 --- a/modules/visual_script/visual_script_builtin_funcs.cpp +++ b/modules/visual_script/visual_script_builtin_funcs.cpp @@ -675,15 +675,15 @@ VisualScriptBuiltinFunc::BuiltinFunc VisualScriptBuiltinFunc::get_func() { return func; } -#define VALIDATE_ARG_NUM(m_arg) \ - if (!p_inputs[m_arg]->is_num()) { \ - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; \ - r_error.argument = m_arg; \ - r_error.expected = Variant::REAL; \ - return; \ +#define VALIDATE_ARG_NUM(m_arg) \ + if (!p_inputs[m_arg]->is_num()) { \ + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; \ + r_error.argument = m_arg; \ + r_error.expected = Variant::REAL; \ + 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) { case VisualScriptBuiltinFunc::MATH_SIN: { @@ -787,7 +787,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in *r_return = Math::abs(r); } 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.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); } 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.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) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; 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) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; 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) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 1; 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) { 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.expected = Variant::INT; return; @@ -1141,7 +1141,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in case VisualScriptBuiltinFunc::TEXT_ORD: { 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.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(); 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.expected = Variant::STRING; *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: { 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.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); 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.expected = Variant::STRING; *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: { 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.expected = Variant::BOOL; return; @@ -1233,7 +1233,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in bool full_objects = *p_inputs[1]; Error err = encode_variant(*p_inputs[0], NULL, len, full_objects); 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.expected = Variant::NIL; 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: { 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.expected = Variant::PACKED_BYTE_ARRAY; return; } 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.expected = Variant::BOOL; 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); if (err != OK) { 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.expected = Variant::PACKED_BYTE_ARRAY; return; @@ -1306,7 +1306,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) { VisualScriptBuiltinFunc::exec_func(func, p_inputs, p_outputs[0], r_error, r_error_str); return 0; diff --git a/modules/visual_script/visual_script_builtin_funcs.h b/modules/visual_script/visual_script_builtin_funcs.h index d0787b3dd3..d950f858d4 100644 --- a/modules/visual_script/visual_script_builtin_funcs.h +++ b/modules/visual_script/visual_script_builtin_funcs.h @@ -112,7 +112,7 @@ public: static int get_func_argument_count(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); private: diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 8725563c9b..c556527e9b 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -556,8 +556,8 @@ void VisualScriptEditor::_update_graph(int p_only_id) { gnode->set_meta("__vnode", node); gnode->set_name(itos(E->get())); - gnode->connect("dragged", this, "_node_moved", varray(E->get())); - gnode->connect("close_request", this, "_remove_node", varray(E->get()), CONNECT_DEFERRED); + gnode->connect_compat("dragged", this, "_node_moved", varray(E->get())); + gnode->connect_compat("close_request", this, "_remove_node", varray(E->get()), CONNECT_DEFERRED); if (E->get() != script->get_function_node_id(F->get())) { //function can't be erased @@ -575,7 +575,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) { Button *btn = memnew(Button); btn->set_text(TTR("Add Input Port")); 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_input_port_editable()) @@ -584,7 +584,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) { Button *btn = memnew(Button); btn->set_text(TTR("Add Output Port")); 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); } 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->add_font_override("font", get_font("source", "EditorFonts")); 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 { String text = node->get_text(); if (!text.empty()) { @@ -610,7 +610,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) { gnode->set_comment(true); gnode->set_resizable(true); 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())) { @@ -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_text(left_name); name_box->set_expand_to_text_length(true); - name_box->connect("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("resized", this, "_update_node_size", varray(E->get())); + name_box->connect_compat("focus_exited", this, "_port_name_focus_out", varray(name_box, E->get(), i, true)); } else { hbc->add_child(memnew(Label(left_name))); } @@ -734,13 +734,13 @@ void VisualScriptEditor::_update_graph(int p_only_id) { opbtn->select(left_type); opbtn->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); 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); rmbtn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons")); 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 { 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) { //different type? for now convert //not the same, reconvert - Variant::CallError ce; + Callable::CallError ce; const Variant *existingp = &value; value = Variant::construct(left_type, &existingp, 1, ce, false); } if (left_type == Variant::COLOR) { 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()) { Ref<Resource> res = value; @@ -776,7 +776,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) { 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); } } else { @@ -802,7 +802,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) { Button *rmbtn = memnew(Button); rmbtn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons")); 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()) { OptionButton *opbtn = memnew(OptionButton); @@ -812,7 +812,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) { opbtn->select(right_type); opbtn->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); 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()) { @@ -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_text(right_name); name_box->set_expand_to_text_length(true); - name_box->connect("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("resized", this, "_update_node_size", varray(E->get())); + name_box->connect_compat("focus_exited", this, "_port_name_focus_out", varray(name_box, E->get(), i, false)); } else { hbc->add_child(memnew(Label(right_name))); } @@ -1225,7 +1225,7 @@ void VisualScriptEditor::_add_func_input() { LineEdit *name_box = memnew(LineEdit); name_box->set_h_size_flags(SIZE_EXPAND_FILL); 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); Label *type_label = memnew(Label); @@ -1252,7 +1252,7 @@ void VisualScriptEditor::_add_func_input() { func_input_vbox->add_child(hbox); 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->grab_focus(); @@ -2408,7 +2408,7 @@ void VisualScriptEditor::set_edited_resource(const RES &p_res) { variable_editor->script = script; 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(); @@ -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); if (pinfo.type != Variant::NIL && existing.get_type() != pinfo.type) { - Variant::CallError ce; + Callable::CallError ce; const Variant *existingp = &existing; existing = Variant::construct(pinfo.type, &existingp, 1, ce, false); } @@ -3904,8 +3904,8 @@ void VisualScriptEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_READY: { - variable_editor->connect("changed", this, "_update_members"); - signal_editor->connect("changed", this, "_update_members"); + variable_editor->connect_compat("changed", this, "_update_members"); + signal_editor->connect_compat("changed", this, "_update_members"); FALLTHROUGH; } case NOTIFICATION_THEME_CHANGED: { @@ -4697,7 +4697,7 @@ VisualScriptEditor::VisualScriptEditor() { 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/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); // Add but wait until done setting up this. @@ -4707,7 +4707,7 @@ VisualScriptEditor::VisualScriptEditor() { CheckButton *tool_script_check = memnew(CheckButton); tool_script_check->set_text(TTR("Make Tool:")); 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 /// @@ -4715,11 +4715,11 @@ VisualScriptEditor::VisualScriptEditor() { members_section->add_margin_child(TTR("Members:"), members, true); members->set_custom_minimum_size(Size2(0, 50 * EDSCALE)); members->set_hide_root(true); - members->connect("button_pressed", this, "_member_button"); - members->connect("item_edited", this, "_member_edited"); - members->connect("cell_selected", this, "_member_selected", varray(), CONNECT_DEFERRED); - members->connect("gui_input", this, "_members_gui_input"); - members->connect("item_rmb_selected", this, "_member_rmb_selected"); + members->connect_compat("button_pressed", this, "_member_button"); + members->connect_compat("item_edited", this, "_member_edited"); + members->connect_compat("cell_selected", this, "_member_selected", varray(), CONNECT_DEFERRED); + members->connect_compat("gui_input", this, "_members_gui_input"); + members->connect_compat("item_rmb_selected", this, "_member_rmb_selected"); members->set_allow_rmb_select(true); members->set_allow_reselect(true); members->set_hide_folding(true); @@ -4727,13 +4727,13 @@ VisualScriptEditor::VisualScriptEditor() { member_popup = memnew(PopupMenu); 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_box = memnew(LineEdit); function_name_edit->add_child(function_name_box); 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); add_child(function_name_edit); @@ -4743,15 +4743,15 @@ VisualScriptEditor::VisualScriptEditor() { add_child(graph); graph->set_v_size_flags(Control::SIZE_EXPAND_FILL); graph->set_anchors_and_margins_preset(Control::PRESET_WIDE); - graph->connect("node_selected", this, "_node_selected"); - graph->connect("_begin_node_move", this, "_begin_node_move"); - graph->connect("_end_node_move", this, "_end_node_move"); - graph->connect("delete_nodes_request", this, "_on_nodes_delete"); - graph->connect("duplicate_nodes_request", this, "_on_nodes_duplicate"); - graph->connect("gui_input", this, "_graph_gui_input"); + graph->connect_compat("node_selected", this, "_node_selected"); + graph->connect_compat("_begin_node_move", this, "_begin_node_move"); + graph->connect_compat("_end_node_move", this, "_end_node_move"); + graph->connect_compat("delete_nodes_request", this, "_on_nodes_delete"); + graph->connect_compat("duplicate_nodes_request", this, "_on_nodes_duplicate"); + graph->connect_compat("gui_input", this, "_graph_gui_input"); graph->set_drag_forwarding(this); 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. HBoxContainer *graph_hbc = graph->get_zoom_hbox(); @@ -4761,18 +4761,18 @@ VisualScriptEditor::VisualScriptEditor() { graph_hbc->add_child(base_lbl); 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); Button *add_nds = memnew(Button); add_nds->set_text(TTR("Add Nodes...")); 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); fn_btn->set_text(TTR("Add Function...")); 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. 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_placeholder(TTR("function_name")); 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); // Add minor setting for function if needed, here! @@ -4800,7 +4800,7 @@ VisualScriptEditor::VisualScriptEditor() { Button *add_input_button = memnew(Button); add_input_button->set_h_size_flags(SIZE_EXPAND_FILL); 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); func_input_scroll = memnew(ScrollContainer); @@ -4816,7 +4816,7 @@ VisualScriptEditor::VisualScriptEditor() { function_create_dialog->set_title(TTR("Create Function")); function_create_dialog->add_child(function_vb); 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); select_func_text = memnew(Label); @@ -4836,7 +4836,7 @@ VisualScriptEditor::VisualScriptEditor() { hint_text_timer = memnew(Timer); 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); // Allowed casts (connections). @@ -4854,9 +4854,9 @@ VisualScriptEditor::VisualScriptEditor() { graph->add_valid_left_disconnect_type(TYPE_SEQUENCE); - graph->connect("connection_request", this, "_graph_connected"); - graph->connect("disconnection_request", this, "_graph_disconnected"); - graph->connect("connection_to_empty", this, "_graph_connect_to_empty"); + graph->connect_compat("connection_request", this, "_graph_connected"); + graph->connect_compat("disconnection_request", this, "_graph_disconnected"); + graph->connect_compat("connection_to_empty", this, "_graph_connect_to_empty"); edit_signal_dialog = memnew(AcceptDialog); edit_signal_dialog->get_ok()->set_text(TTR("Close")); @@ -4880,7 +4880,7 @@ VisualScriptEditor::VisualScriptEditor() { select_base_type = memnew(CreateDialog); 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); undo_redo = EditorNode::get_singleton()->get_undo_redo(); @@ -4892,22 +4892,22 @@ VisualScriptEditor::VisualScriptEditor() { default_value_edit = memnew(CustomPropertyEditor); 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); add_child(method_select); - method_select->connect("selected", this, "_selected_method"); + method_select->connect_compat("selected", this, "_selected_method"); error_line = -1; new_connect_node_select = memnew(VisualScriptPropertySelector); add_child(new_connect_node_select); new_connect_node_select->set_resizable(true); - new_connect_node_select->connect("selected", this, "_selected_connect_node"); - new_connect_node_select->get_cancel()->connect("pressed", this, "_cancel_connect_node"); + new_connect_node_select->connect_compat("selected", this, "_selected_connect_node"); + new_connect_node_select->get_cancel()->connect_compat("pressed", this, "_cancel_connect_node"); new_virtual_method_select = memnew(VisualScriptPropertySelector); 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() { diff --git a/modules/visual_script/visual_script_expression.cpp b/modules/visual_script/visual_script_expression.cpp index 63880df21d..23d1c8ccc0 100644 --- a/modules/visual_script/visual_script_expression.cpp +++ b/modules/visual_script/visual_script_expression.cpp @@ -1229,7 +1229,7 @@ public: //virtual int get_working_memory_size() const { return 0; } //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) { case VisualScriptExpression::ENode::TYPE_INPUT: { @@ -1371,7 +1371,7 @@ public: 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) + "'."; return true; } @@ -1398,7 +1398,7 @@ public: 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; return true; } @@ -1430,7 +1430,7 @@ public: 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) + "':"; return true; } @@ -1440,24 +1440,24 @@ public: 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) { 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; } bool error = _execute(p_inputs, expression->root, *p_outputs[0], r_error_str, r_error); - if (error && r_error.error == Variant::CallError::CALL_OK) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + if (error && r_error.error == Callable::CallError::CALL_OK) { + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; } #ifdef DEBUG_ENABLED 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.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; } #endif diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp index 213dc897af..475893e86d 100644 --- a/modules/visual_script/visual_script_flow_control.cpp +++ b/modules/visual_script/visual_script_flow_control.cpp @@ -135,7 +135,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) { if (with_value) { *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 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) return 2; @@ -323,7 +323,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) { 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 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) { 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); 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()); return 0; } @@ -429,7 +429,7 @@ public: *p_outputs[0] = p_working_mem[0].iter_get(p_working_mem[1], 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"); return 0; } @@ -440,7 +440,7 @@ public: bool can_iter = p_working_mem[0].iter_next(p_working_mem[1], 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()); return 0; } @@ -451,7 +451,7 @@ public: *p_outputs[0] = p_working_mem[0].iter_get(p_working_mem[1], 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"); return 0; } @@ -549,7 +549,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) { 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 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) { return case_count; //exit @@ -836,14 +836,14 @@ 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 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]; *p_outputs[0] = Variant(); 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"; return 0; } @@ -861,7 +861,7 @@ public: } Ref<Script> cast_script = Ref<Resource>(ResourceCache::get(script)); 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; return 1; } diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index 63c36ae431..011432ef39 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -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); diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index dc49ed72d0..1f1c3e2f52 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -285,7 +285,7 @@ public: //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(); @@ -294,7 +294,7 @@ public: Variant::Type expected = node->get_argument_type(i); if (expected != Variant::NIL) { 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.argument = i; return 0; @@ -762,7 +762,7 @@ public: int input_count = 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) { Array arr; @@ -1031,7 +1031,7 @@ public: //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; if (unary) { @@ -1043,7 +1043,7 @@ public: 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) { r_error_str = *p_outputs[0]; } else { @@ -1165,7 +1165,7 @@ class VisualScriptNodeInstanceSelect : public VisualScriptNodeInstance { public: //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]; if (cond) @@ -1285,10 +1285,10 @@ public: VisualScriptInstance *instance; 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])) { - 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) + "'"; return 0; } @@ -1407,11 +1407,11 @@ public: //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])) { - 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) + "'"; } @@ -1482,7 +1482,7 @@ void VisualScriptConstant::set_constant_type(Variant::Type p_type) { return; type = p_type; - Variant::CallError ce; + Callable::CallError ce; value = Variant::construct(type, NULL, 0, ce); ports_changed_notify(); _change_notify(); @@ -1537,7 +1537,7 @@ public: Variant constant; //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; return 0; @@ -1642,7 +1642,7 @@ public: Ref<Resource> preload; //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; return 0; @@ -1710,13 +1710,13 @@ class VisualScriptNodeInstanceIndexGet : public VisualScriptNodeInstance { public: //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; *p_outputs[0] = p_inputs[0]->get(*p_inputs[1], &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(); } return 0; @@ -1785,14 +1785,14 @@ class VisualScriptNodeInstanceIndexSet : public VisualScriptNodeInstance { public: //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; *p_outputs[0] = *p_inputs[0]; p_outputs[0]->set(*p_inputs[1], *p_inputs[2], &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(); } return 0; @@ -1866,7 +1866,7 @@ public: int index; //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); return 0; @@ -1991,11 +1991,11 @@ public: bool valid; //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) { 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; @@ -2140,11 +2140,11 @@ public: bool valid; //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) { 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; @@ -2283,7 +2283,7 @@ public: float value; //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; return 0; @@ -2389,7 +2389,7 @@ public: //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; return 0; @@ -2512,18 +2512,18 @@ public: //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()); 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(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; } @@ -2696,18 +2696,18 @@ public: //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()); 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; } SceneTree *tree = node->get_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."; return 0; } @@ -2803,7 +2803,7 @@ public: //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; return 0; @@ -2885,7 +2885,7 @@ public: //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(); return 0; @@ -3022,13 +3022,13 @@ public: int 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()) { #ifdef DEBUG_ENABLED 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.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; return 0; } #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); if (ret.get_type() == Variant::STRING) { r_error_str = ret; - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; return 0; } else if (ret.is_num()) { ret_out = ret; } else { 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; } @@ -3144,7 +3144,7 @@ void VisualScriptCustomNode::_bind_methods() { } 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 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) { 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; } *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 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; } @@ -3483,11 +3483,11 @@ public: //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); - if (ce.error != Variant::CallError::CALL_OK) { + if (ce.error != Callable::CallError::CALL_OK) { r_error_str = "Invalid arguments for constructor"; } @@ -3612,7 +3612,7 @@ public: StringName name; 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; return 0; @@ -3733,7 +3733,7 @@ public: StringName name; 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_outputs[0] = *p_working_mem; @@ -3868,7 +3868,7 @@ public: StringName action; 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) { case VisualScriptInputAction::MODE_PRESSED: { @@ -4007,7 +4007,7 @@ void VisualScriptDeconstruct::_update_elements() { elements.clear(); Variant v; - Variant::CallError ce; + Callable::CallError ce; v = Variant::construct(type, NULL, 0, ce); List<PropertyInfo> pinfo; @@ -4065,7 +4065,7 @@ public: //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]; @@ -4074,7 +4074,7 @@ public: *p_outputs[i] = in.get(outputs[i], &valid); if (!valid) { 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; } } diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp index ffcd355fa0..22f696851f 100644 --- a/modules/visual_script/visual_script_property_selector.cpp +++ b/modules/visual_script/visual_script_property_selector.cpp @@ -193,7 +193,7 @@ void VisualScriptPropertySelector::_update_search() { { if (type != Variant::NIL) { Variant v; - Variant::CallError ce; + Callable::CallError ce; v = Variant::construct(type, NULL, 0, ce); v.get_method_list(&methods); } else { @@ -520,7 +520,7 @@ void VisualScriptPropertySelector::_notification(int p_what) { 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); search_box = memnew(LineEdit); vbc->add_margin_child(TTR("Search:"), search_box); - search_box->connect("text_changed", this, "_text_changed"); - search_box->connect("gui_input", this, "_sbox_input"); + search_box->connect_compat("text_changed", this, "_text_changed"); + search_box->connect_compat("gui_input", this, "_sbox_input"); search_options = memnew(Tree); vbc->add_margin_child(TTR("Matches:"), search_options, true); get_ok()->set_text(TTR("Open")); get_ok()->set_disabled(true); register_text_enter(search_box); set_hide_on_ok(false); - search_options->connect("item_activated", this, "_confirmed"); - search_options->connect("cell_selected", this, "_item_selected"); + search_options->connect_compat("item_activated", this, "_confirmed"); + search_options->connect_compat("cell_selected", this, "_item_selected"); search_options->set_hide_root(true); search_options->set_hide_folding(true); virtuals_only = false; seq_connect = false; help_bit = memnew(EditorHelpBit); 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_column_expand(1, false); search_options->set_column_expand(2, false); diff --git a/modules/visual_script/visual_script_yield_nodes.cpp b/modules/visual_script/visual_script_yield_nodes.cpp index 877d5836d2..40d2ec88c5 100644 --- a/modules/visual_script/visual_script_yield_nodes.cpp +++ b/modules/visual_script/visual_script_yield_nodes.cpp @@ -99,7 +99,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 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) { return 0; //resuming yield @@ -109,7 +109,7 @@ public: SceneTree *tree = Object::cast_to<SceneTree>(OS::get_singleton()->get_main_loop()); if (!tree) { 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; } @@ -509,7 +509,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) { if (p_start_mode == START_MODE_RESUME_YIELD) { return 0; //resuming yield @@ -529,14 +529,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; } @@ -548,7 +548,7 @@ public: object = *p_inputs[0]; 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."; return 0; } diff --git a/platform/android/api/api.cpp b/platform/android/api/api.cpp index 2146c5409b..7efb545524 100644 --- a/platform/android/api/api.cpp +++ b/platform/android/api/api.cpp @@ -62,14 +62,14 @@ void JavaClassWrapper::_bind_methods() { #if !defined(ANDROID_ENABLED) -Variant JavaClass::call(const StringName &, const Variant **, int, Variant::CallError &) { +Variant JavaClass::call(const StringName &, const Variant **, int, Callable::CallError &) { return Variant(); } JavaClass::JavaClass() { } -Variant JavaObject::call(const StringName &, const Variant **, int, Variant::CallError &) { +Variant JavaObject::call(const StringName &, const Variant **, int, Callable::CallError &) { return Variant(); } diff --git a/platform/android/api/java_class_wrapper.h b/platform/android/api/java_class_wrapper.h index 2b13be2de4..5414b533f9 100644 --- a/platform/android/api/java_class_wrapper.h +++ b/platform/android/api/java_class_wrapper.h @@ -160,7 +160,7 @@ class JavaClass : public Reference { _FORCE_INLINE_ static bool _convert_object_to_variant(JNIEnv *env, jobject obj, Variant &var, uint32_t p_sig); - bool _call_method(JavaObject *p_instance, const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error, Variant &ret); + bool _call_method(JavaObject *p_instance, const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error, Variant &ret); friend class JavaClassWrapper; Map<StringName, List<MethodInfo> > methods; @@ -168,7 +168,7 @@ class JavaClass : public Reference { #endif public: - 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); JavaClass(); }; @@ -185,7 +185,7 @@ class JavaObject : public Reference { #endif public: - 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); #ifdef ANDROID_ENABLED JavaObject(const Ref<JavaClass> &p_base, jobject *p_instance); diff --git a/platform/android/java_class_wrapper.cpp b/platform/android/java_class_wrapper.cpp index fe2fd89710..76213b949d 100644 --- a/platform/android/java_class_wrapper.cpp +++ b/platform/android/java_class_wrapper.cpp @@ -32,7 +32,7 @@ #include "string_android.h" #include "thread_jandroid.h" -bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error, Variant &ret) { +bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error, Variant &ret) { Map<StringName, List<MethodInfo> >::Element *M = methods.find(p_method); if (!M) @@ -44,20 +44,20 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method, for (List<MethodInfo>::Element *E = M->get().front(); E; E = E->next()) { if (!p_instance && !E->get()._static) { - r_error.error = Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL; + r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL; continue; } int pc = E->get().param_types.size(); if (pc > p_argcount) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; r_error.argument = pc; continue; } if (pc < p_argcount) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; r_error.argument = pc; continue; } @@ -141,7 +141,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method, } if (arg_expected != Variant::NIL) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = i; r_error.expected = arg_expected; valid = false; @@ -158,7 +158,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method, if (!method) return true; //no version convinces - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; jvalue *argv = NULL; @@ -405,7 +405,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method, } } - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; bool success = true; switch (method->return_type) { @@ -501,7 +501,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method, if (!_convert_object_to_variant(env, obj, ret, method->return_type)) { ret = Variant(); - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; success = false; } env->DeleteLocalRef(obj); @@ -517,7 +517,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method, return success; } -Variant JavaClass::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant JavaClass::call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { Variant ret; bool found = _call_method(NULL, p_method, p_args, p_argcount, r_error, ret); @@ -533,7 +533,7 @@ JavaClass::JavaClass() { ///////////////////// -Variant JavaObject::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant JavaObject::call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { return Variant(); } diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp index d3d8304faf..b99cf70659 100644 --- a/platform/android/java_godot_lib_jni.cpp +++ b/platform/android/java_godot_lib_jni.cpp @@ -411,30 +411,30 @@ class JNISingleton : public Object { Map<StringName, MethodData> method_map; public: - 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) { ERR_FAIL_COND_V(!instance, Variant()); - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; Map<StringName, MethodData>::Element *E = method_map.find(p_method); if (!E) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; return Variant(); } int ac = E->get().argtypes.size(); if (ac < p_argcount) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; r_error.argument = ac; return Variant(); } if (ac > p_argcount) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; r_error.argument = ac; return Variant(); } @@ -443,7 +443,7 @@ public: if (!Variant::can_convert(p_args[i]->get_type(), E->get().argtypes[i])) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = i; r_error.expected = E->get().argtypes[i]; } @@ -1370,7 +1370,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_callobject(JNIEnv *en env->DeleteLocalRef(obj); }; - Variant::CallError err; + Callable::CallError err; obj->call(str_method, (const Variant **)vptr, count, err); // something diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp index b98820d5ac..c11e7fd679 100644 --- a/scene/2d/animated_sprite.cpp +++ b/scene/2d/animated_sprite.cpp @@ -475,10 +475,10 @@ void AnimatedSprite::_notification(int p_what) { void AnimatedSprite::set_sprite_frames(const Ref<SpriteFrames> &p_frames) { if (frames.is_valid()) - frames->disconnect("changed", this, "_res_changed"); + frames->disconnect_compat("changed", this, "_res_changed"); frames = p_frames; if (frames.is_valid()) - frames->connect("changed", this, "_res_changed"); + frames->connect_compat("changed", this, "_res_changed"); if (!frames.is_valid()) { frame = 0; diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp index b661db2e52..bdf1f8b9ce 100644 --- a/scene/2d/area_2d.cpp +++ b/scene/2d/area_2d.cpp @@ -171,8 +171,8 @@ void Area2D::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, i E->get().rc = 0; E->get().in_tree = node && node->is_inside_tree(); if (node) { - node->connect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree, make_binds(objid)); - node->connect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree, make_binds(objid)); + node->connect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree, make_binds(objid)); + node->connect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree, make_binds(objid)); if (E->get().in_tree) { emit_signal(SceneStringNames::get_singleton()->body_entered, node); } @@ -198,8 +198,8 @@ void Area2D::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, i if (E->get().rc == 0) { if (node) { - node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); if (E->get().in_tree) emit_signal(SceneStringNames::get_singleton()->body_exited, obj); } @@ -273,8 +273,8 @@ void Area2D::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, i E->get().rc = 0; E->get().in_tree = node && node->is_inside_tree(); if (node) { - node->connect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_area_enter_tree, make_binds(objid)); - node->connect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_area_exit_tree, make_binds(objid)); + node->connect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_area_enter_tree, make_binds(objid)); + node->connect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_area_exit_tree, make_binds(objid)); if (E->get().in_tree) { emit_signal(SceneStringNames::get_singleton()->area_entered, node); } @@ -300,8 +300,8 @@ void Area2D::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, i if (E->get().rc == 0) { if (node) { - node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_area_enter_tree); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_area_exit_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_area_enter_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_area_exit_tree); if (E->get().in_tree) emit_signal(SceneStringNames::get_singleton()->area_exited, obj); } @@ -337,8 +337,8 @@ void Area2D::_clear_monitoring() { continue; //ERR_CONTINUE(!node); - node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); if (!E->get().in_tree) continue; @@ -367,8 +367,8 @@ void Area2D::_clear_monitoring() { continue; //ERR_CONTINUE(!node); - node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_area_enter_tree); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_area_exit_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_area_enter_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_area_exit_tree); if (!E->get().in_tree) continue; diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp index fd654cbf60..871099c2fc 100644 --- a/scene/2d/audio_stream_player_2d.cpp +++ b/scene/2d/audio_stream_player_2d.cpp @@ -545,7 +545,7 @@ AudioStreamPlayer2D::AudioStreamPlayer2D() { stream_paused = false; stream_paused_fade_in = false; stream_paused_fade_out = false; - AudioServer::get_singleton()->connect("bus_layout_changed", this, "_bus_layout_changed"); + AudioServer::get_singleton()->connect_compat("bus_layout_changed", this, "_bus_layout_changed"); } AudioStreamPlayer2D::~AudioStreamPlayer2D() { diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp index bb975350a6..685d501a00 100644 --- a/scene/2d/collision_shape_2d.cpp +++ b/scene/2d/collision_shape_2d.cpp @@ -149,7 +149,7 @@ void CollisionShape2D::_notification(int p_what) { void CollisionShape2D::set_shape(const Ref<Shape2D> &p_shape) { if (shape.is_valid()) - shape->disconnect("changed", this, "_shape_changed"); + shape->disconnect_compat("changed", this, "_shape_changed"); shape = p_shape; update(); if (parent) { @@ -160,7 +160,7 @@ void CollisionShape2D::set_shape(const Ref<Shape2D> &p_shape) { } if (shape.is_valid()) - shape->connect("changed", this, "_shape_changed"); + shape->connect_compat("changed", this, "_shape_changed"); update_configuration_warning(); } diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp index 922ee0c208..4e98873385 100644 --- a/scene/2d/cpu_particles_2d.cpp +++ b/scene/2d/cpu_particles_2d.cpp @@ -212,12 +212,12 @@ void CPUParticles2D::set_texture(const Ref<Texture2D> &p_texture) { return; if (texture.is_valid()) - texture->disconnect(CoreStringNames::get_singleton()->changed, this, "_texture_changed"); + texture->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_texture_changed"); texture = p_texture; if (texture.is_valid()) - texture->connect(CoreStringNames::get_singleton()->changed, this, "_texture_changed"); + texture->connect_compat(CoreStringNames::get_singleton()->changed, this, "_texture_changed"); update(); _update_mesh_texture(); @@ -1053,13 +1053,13 @@ void CPUParticles2D::_set_redraw(bool p_redraw) { update_mutex->lock(); #endif if (redraw) { - VS::get_singleton()->connect("frame_pre_draw", this, "_update_render_thread"); + VS::get_singleton()->connect_compat("frame_pre_draw", this, "_update_render_thread"); VS::get_singleton()->canvas_item_set_update_when_visible(get_canvas_item(), true); VS::get_singleton()->multimesh_set_visible_instances(multimesh, -1); } else { - if (VS::get_singleton()->is_connected("frame_pre_draw", this, "_update_render_thread")) { - VS::get_singleton()->disconnect("frame_pre_draw", this, "_update_render_thread"); + if (VS::get_singleton()->is_connected_compat("frame_pre_draw", this, "_update_render_thread")) { + VS::get_singleton()->disconnect_compat("frame_pre_draw", this, "_update_render_thread"); } VS::get_singleton()->canvas_item_set_update_when_visible(get_canvas_item(), false); diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp index c000346a1a..019eeb9563 100644 --- a/scene/2d/light_occluder_2d.cpp +++ b/scene/2d/light_occluder_2d.cpp @@ -234,7 +234,7 @@ void LightOccluder2D::set_occluder_polygon(const Ref<OccluderPolygon2D> &p_polyg #ifdef DEBUG_ENABLED if (occluder_polygon.is_valid()) - occluder_polygon->disconnect("changed", this, "_poly_changed"); + occluder_polygon->disconnect_compat("changed", this, "_poly_changed"); #endif occluder_polygon = p_polygon; @@ -245,7 +245,7 @@ void LightOccluder2D::set_occluder_polygon(const Ref<OccluderPolygon2D> &p_polyg #ifdef DEBUG_ENABLED if (occluder_polygon.is_valid()) - occluder_polygon->connect("changed", this, "_poly_changed"); + occluder_polygon->connect_compat("changed", this, "_poly_changed"); update(); #endif } diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp index 3c457b7df0..0aadc84091 100644 --- a/scene/2d/line_2d.cpp +++ b/scene/2d/line_2d.cpp @@ -101,14 +101,14 @@ float Line2D::get_width() const { void Line2D::set_curve(const Ref<Curve> &p_curve) { // Cleanup previous connection if any if (_curve.is_valid()) { - _curve->disconnect(CoreStringNames::get_singleton()->changed, this, "_curve_changed"); + _curve->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_curve_changed"); } _curve = p_curve; // Connect to the curve so the line will update when it is changed if (_curve.is_valid()) { - _curve->connect(CoreStringNames::get_singleton()->changed, this, "_curve_changed"); + _curve->connect_compat(CoreStringNames::get_singleton()->changed, this, "_curve_changed"); } update(); @@ -171,14 +171,14 @@ void Line2D::set_gradient(const Ref<Gradient> &p_gradient) { // Cleanup previous connection if any if (_gradient.is_valid()) { - _gradient->disconnect(CoreStringNames::get_singleton()->changed, this, "_gradient_changed"); + _gradient->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_gradient_changed"); } _gradient = p_gradient; // Connect to the gradient so the line will update when the ColorRamp is changed if (_gradient.is_valid()) { - _gradient->connect(CoreStringNames::get_singleton()->changed, this, "_gradient_changed"); + _gradient->connect_compat(CoreStringNames::get_singleton()->changed, this, "_gradient_changed"); } update(); diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp index 678e5f113a..6754c1c9a6 100644 --- a/scene/2d/navigation_polygon.cpp +++ b/scene/2d/navigation_polygon.cpp @@ -503,14 +503,14 @@ void NavigationPolygonInstance::set_navigation_polygon(const Ref<NavigationPolyg } if (navpoly.is_valid()) { - navpoly->disconnect(CoreStringNames::get_singleton()->changed, this, "_navpoly_changed"); + navpoly->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_navpoly_changed"); } navpoly = p_navpoly; Navigation2DServer::get_singleton()->region_set_navpoly(region, p_navpoly); if (navpoly.is_valid()) { - navpoly->connect(CoreStringNames::get_singleton()->changed, this, "_navpoly_changed"); + navpoly->connect_compat(CoreStringNames::get_singleton()->changed, this, "_navpoly_changed"); } _navpoly_changed(); diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index d83c163b4c..3e417e7f5d 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -134,13 +134,13 @@ void Path2D::_curve_changed() { void Path2D::set_curve(const Ref<Curve2D> &p_curve) { if (curve.is_valid()) { - curve->disconnect("changed", this, "_curve_changed"); + curve->disconnect_compat("changed", this, "_curve_changed"); } curve = p_curve; if (curve.is_valid()) { - curve->connect("changed", this, "_curve_changed"); + curve->connect_compat("changed", this, "_curve_changed"); } _curve_changed(); diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 29bfc39477..e4d50db147 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -192,14 +192,14 @@ real_t StaticBody2D::get_constant_angular_velocity() const { void StaticBody2D::set_physics_material_override(const Ref<PhysicsMaterial> &p_physics_material_override) { if (physics_material_override.is_valid()) { - if (physics_material_override->is_connected(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics")) - physics_material_override->disconnect(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics"); + if (physics_material_override->is_connected_compat(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics")) + physics_material_override->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics"); } physics_material_override = p_physics_material_override; if (physics_material_override.is_valid()) { - physics_material_override->connect(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics"); + physics_material_override->connect_compat(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics"); } _reload_physics_characteristics(); } @@ -311,8 +311,8 @@ void RigidBody2D::_body_inout(int p_status, ObjectID p_instance, int p_body_shap //E->get().rc=0; E->get().in_scene = node && node->is_inside_tree(); if (node) { - node->connect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree, make_binds(objid)); - node->connect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree, make_binds(objid)); + node->connect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree, make_binds(objid)); + node->connect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree, make_binds(objid)); if (E->get().in_scene) { emit_signal(SceneStringNames::get_singleton()->body_entered, node); } @@ -340,8 +340,8 @@ void RigidBody2D::_body_inout(int p_status, ObjectID p_instance, int p_body_shap if (E->get().shapes.empty()) { if (node) { - node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); if (in_scene) emit_signal(SceneStringNames::get_singleton()->body_exited, node); } @@ -545,14 +545,14 @@ real_t RigidBody2D::get_weight() const { void RigidBody2D::set_physics_material_override(const Ref<PhysicsMaterial> &p_physics_material_override) { if (physics_material_override.is_valid()) { - if (physics_material_override->is_connected(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics")) - physics_material_override->disconnect(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics"); + if (physics_material_override->is_connected_compat(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics")) + physics_material_override->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics"); } physics_material_override = p_physics_material_override; if (physics_material_override.is_valid()) { - physics_material_override->connect(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics"); + physics_material_override->connect_compat(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics"); } _reload_physics_characteristics(); } @@ -775,8 +775,8 @@ void RigidBody2D::set_contact_monitor(bool p_enabled) { if (node) { - node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); } } diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index 67269134ef..eb8b053301 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -120,11 +120,11 @@ void Polygon2D::_notification(int p_what) { if (new_skeleton_id != current_skeleton_id) { Object *old_skeleton = ObjectDB::get_instance(current_skeleton_id); if (old_skeleton) { - old_skeleton->disconnect("bone_setup_changed", this, "_skeleton_bone_setup_changed"); + old_skeleton->disconnect_compat("bone_setup_changed", this, "_skeleton_bone_setup_changed"); } if (skeleton_node) { - skeleton_node->connect("bone_setup_changed", this, "_skeleton_bone_setup_changed"); + skeleton_node->connect_compat("bone_setup_changed", this, "_skeleton_bone_setup_changed"); } current_skeleton_id = new_skeleton_id; diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp index 2fe39ca104..fac2e7cd46 100644 --- a/scene/2d/sprite.cpp +++ b/scene/2d/sprite.cpp @@ -142,12 +142,12 @@ void Sprite::set_texture(const Ref<Texture2D> &p_texture) { return; if (texture.is_valid()) - texture->disconnect(CoreStringNames::get_singleton()->changed, this, "_texture_changed"); + texture->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_texture_changed"); texture = p_texture; if (texture.is_valid()) - texture->connect(CoreStringNames::get_singleton()->changed, this, "_texture_changed"); + texture->connect_compat(CoreStringNames::get_singleton()->changed, this, "_texture_changed"); update(); emit_signal("texture_changed"); diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 57b11fa069..0ce11ee75d 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -177,7 +177,7 @@ void TileMap::_update_quadrant_transform() { void TileMap::set_tileset(const Ref<TileSet> &p_tileset) { if (tile_set.is_valid()) { - tile_set->disconnect("changed", this, "_recreate_quadrants"); + tile_set->disconnect_compat("changed", this, "_recreate_quadrants"); tile_set->remove_change_receptor(this); } @@ -185,7 +185,7 @@ void TileMap::set_tileset(const Ref<TileSet> &p_tileset) { tile_set = p_tileset; if (tile_set.is_valid()) { - tile_set->connect("changed", this, "_recreate_quadrants"); + tile_set->connect_compat("changed", this, "_recreate_quadrants"); tile_set->add_change_receptor(this); } else { clear(); @@ -853,7 +853,7 @@ void TileMap::_set_celld(const Vector2 &p_pos, const Dictionary &p_data) { Variant v_pos_x = p_pos.x, v_pos_y = p_pos.y, v_tile = p_data["id"], v_flip_h = p_data["flip_h"], v_flip_v = p_data["flip_y"], v_transpose = p_data["transpose"], v_autotile_coord = p_data["auto_coord"]; const Variant *args[7] = { &v_pos_x, &v_pos_y, &v_tile, &v_flip_h, &v_flip_v, &v_transpose, &v_autotile_coord }; - Variant::CallError ce; + Callable::CallError ce; call("set_cell", args, 7, ce); } diff --git a/scene/2d/touch_screen_button.cpp b/scene/2d/touch_screen_button.cpp index beff74f496..ce54cae4b0 100644 --- a/scene/2d/touch_screen_button.cpp +++ b/scene/2d/touch_screen_button.cpp @@ -69,12 +69,12 @@ Ref<BitMap> TouchScreenButton::get_bitmask() const { void TouchScreenButton::set_shape(const Ref<Shape2D> &p_shape) { if (shape.is_valid()) - shape->disconnect("changed", this, "update"); + shape->disconnect_compat("changed", this, "update"); shape = p_shape; if (shape.is_valid()) - shape->connect("changed", this, "update"); + shape->connect_compat("changed", this, "update"); update(); } diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp index 0ac725b7dd..3bfaf1f95c 100644 --- a/scene/2d/visibility_notifier_2d.cpp +++ b/scene/2d/visibility_notifier_2d.cpp @@ -224,7 +224,7 @@ void VisibilityEnabler2D::_find_nodes(Node *p_node) { if (add) { - p_node->connect(SceneStringNames::get_singleton()->tree_exiting, this, "_node_removed", varray(p_node), CONNECT_ONESHOT); + p_node->connect_compat(SceneStringNames::get_singleton()->tree_exiting, this, "_node_removed", varray(p_node), CONNECT_ONESHOT); nodes[p_node] = meta; _change_node_state(p_node, false); } @@ -267,7 +267,7 @@ void VisibilityEnabler2D::_notification(int p_what) { if (!visible) _change_node_state(E->key(), true); - E->key()->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, "_node_removed"); + E->key()->disconnect_compat(SceneStringNames::get_singleton()->tree_exiting, this, "_node_removed"); } nodes.clear(); diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp index 62908e2b0f..d88c088f72 100644 --- a/scene/3d/area.cpp +++ b/scene/3d/area.cpp @@ -170,8 +170,8 @@ void Area::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, int E->get().rc = 0; E->get().in_tree = node && node->is_inside_tree(); if (node) { - node->connect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree, make_binds(objid)); - node->connect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree, make_binds(objid)); + node->connect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree, make_binds(objid)); + node->connect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree, make_binds(objid)); if (E->get().in_tree) { emit_signal(SceneStringNames::get_singleton()->body_entered, node); } @@ -197,8 +197,8 @@ void Area::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, int if (E->get().rc == 0) { if (node) { - node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); if (E->get().in_tree) emit_signal(SceneStringNames::get_singleton()->body_exited, obj); } @@ -244,8 +244,8 @@ void Area::_clear_monitoring() { emit_signal(SceneStringNames::get_singleton()->body_exited, node); - node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); } } @@ -274,8 +274,8 @@ void Area::_clear_monitoring() { emit_signal(SceneStringNames::get_singleton()->area_exited, obj); - node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_area_enter_tree); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_area_exit_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_area_enter_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_area_exit_tree); } } } @@ -363,8 +363,8 @@ void Area::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, int E->get().rc = 0; E->get().in_tree = node && node->is_inside_tree(); if (node) { - node->connect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_area_enter_tree, make_binds(objid)); - node->connect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_area_exit_tree, make_binds(objid)); + node->connect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_area_enter_tree, make_binds(objid)); + node->connect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_area_exit_tree, make_binds(objid)); if (E->get().in_tree) { emit_signal(SceneStringNames::get_singleton()->area_entered, node); } @@ -390,8 +390,8 @@ void Area::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, int if (E->get().rc == 0) { if (node) { - node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_area_enter_tree); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_area_exit_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_area_enter_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_area_exit_tree); if (E->get().in_tree) { emit_signal(SceneStringNames::get_singleton()->area_exited, obj); } diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index ae70e2e1ac..21fd4d9a14 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -1068,7 +1068,7 @@ AudioStreamPlayer3D::AudioStreamPlayer3D() { stream_paused_fade_out = false; velocity_tracker.instance(); - AudioServer::get_singleton()->connect("bus_layout_changed", this, "_bus_layout_changed"); + AudioServer::get_singleton()->connect_compat("bus_layout_changed", this, "_bus_layout_changed"); set_disable_scale(true); } AudioStreamPlayer3D::~AudioStreamPlayer3D() { diff --git a/scene/3d/collision_shape.cpp b/scene/3d/collision_shape.cpp index bf2816fd41..d0d775d557 100644 --- a/scene/3d/collision_shape.cpp +++ b/scene/3d/collision_shape.cpp @@ -152,12 +152,12 @@ void CollisionShape::set_shape(const Ref<Shape> &p_shape) { if (!shape.is_null()) { shape->unregister_owner(this); - shape->disconnect("changed", this, "_shape_changed"); + shape->disconnect_compat("changed", this, "_shape_changed"); } shape = p_shape; if (!shape.is_null()) { shape->register_owner(this); - shape->connect("changed", this, "_shape_changed"); + shape->connect_compat("changed", this, "_shape_changed"); } update_gizmo(); if (parent) { diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp index 552c15c86b..9210c5d5ef 100644 --- a/scene/3d/cpu_particles.cpp +++ b/scene/3d/cpu_particles.cpp @@ -1123,12 +1123,12 @@ void CPUParticles::_set_redraw(bool p_redraw) { update_mutex->lock(); #endif if (redraw) { - VS::get_singleton()->connect("frame_pre_draw", this, "_update_render_thread"); + VS::get_singleton()->connect_compat("frame_pre_draw", this, "_update_render_thread"); VS::get_singleton()->instance_geometry_set_flag(get_instance(), VS::INSTANCE_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE, true); VS::get_singleton()->multimesh_set_visible_instances(multimesh, -1); } else { - if (VS::get_singleton()->is_connected("frame_pre_draw", this, "_update_render_thread")) { - VS::get_singleton()->disconnect("frame_pre_draw", this, "_update_render_thread"); + if (VS::get_singleton()->is_connected_compat("frame_pre_draw", this, "_update_render_thread")) { + VS::get_singleton()->disconnect_compat("frame_pre_draw", this, "_update_render_thread"); } VS::get_singleton()->instance_geometry_set_flag(get_instance(), VS::INSTANCE_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE, false); VS::get_singleton()->multimesh_set_visible_instances(multimesh, 0); diff --git a/scene/3d/mesh_instance.cpp b/scene/3d/mesh_instance.cpp index 3188a8d5b1..fa5b965414 100644 --- a/scene/3d/mesh_instance.cpp +++ b/scene/3d/mesh_instance.cpp @@ -112,7 +112,7 @@ void MeshInstance::set_mesh(const Ref<Mesh> &p_mesh) { return; if (mesh.is_valid()) { - mesh->disconnect(CoreStringNames::get_singleton()->changed, this, SceneStringNames::get_singleton()->_mesh_changed); + mesh->disconnect_compat(CoreStringNames::get_singleton()->changed, this, SceneStringNames::get_singleton()->_mesh_changed); materials.clear(); } @@ -129,7 +129,7 @@ void MeshInstance::set_mesh(const Ref<Mesh> &p_mesh) { blend_shape_tracks["blend_shapes/" + String(mesh->get_blend_shape_name(i))] = mt; } - mesh->connect(CoreStringNames::get_singleton()->changed, this, SceneStringNames::get_singleton()->_mesh_changed); + mesh->connect_compat(CoreStringNames::get_singleton()->changed, this, SceneStringNames::get_singleton()->_mesh_changed); materials.resize(mesh->get_surface_count()); set_base(mesh->get_rid()); diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp index ac012de1ab..30cba441e0 100644 --- a/scene/3d/path.cpp +++ b/scene/3d/path.cpp @@ -59,13 +59,13 @@ void Path::_curve_changed() { void Path::set_curve(const Ref<Curve3D> &p_curve) { if (curve.is_valid()) { - curve->disconnect("changed", this, "_curve_changed"); + curve->disconnect_compat("changed", this, "_curve_changed"); } curve = p_curve; if (curve.is_valid()) { - curve->connect("changed", this, "_curve_changed"); + curve->connect_compat("changed", this, "_curve_changed"); } _curve_changed(); } diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index 9848125d0f..7c7b0d49ad 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -180,14 +180,14 @@ PhysicsBody::PhysicsBody(PhysicsServer::BodyMode p_mode) : void StaticBody::set_physics_material_override(const Ref<PhysicsMaterial> &p_physics_material_override) { if (physics_material_override.is_valid()) { - if (physics_material_override->is_connected(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics")) - physics_material_override->disconnect(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics"); + if (physics_material_override->is_connected_compat(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics")) + physics_material_override->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics"); } physics_material_override = p_physics_material_override; if (physics_material_override.is_valid()) { - physics_material_override->connect(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics"); + physics_material_override->connect_compat(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics"); } _reload_physics_characteristics(); } @@ -322,8 +322,8 @@ void RigidBody::_body_inout(int p_status, ObjectID p_instance, int p_body_shape, //E->get().rc=0; E->get().in_tree = node && node->is_inside_tree(); if (node) { - node->connect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree, make_binds(objid)); - node->connect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree, make_binds(objid)); + node->connect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree, make_binds(objid)); + node->connect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree, make_binds(objid)); if (E->get().in_tree) { emit_signal(SceneStringNames::get_singleton()->body_entered, node); } @@ -349,8 +349,8 @@ void RigidBody::_body_inout(int p_status, ObjectID p_instance, int p_body_shape, if (E->get().shapes.empty()) { if (node) { - node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); if (in_tree) emit_signal(SceneStringNames::get_singleton()->body_exited, node); } @@ -550,14 +550,14 @@ real_t RigidBody::get_weight() const { void RigidBody::set_physics_material_override(const Ref<PhysicsMaterial> &p_physics_material_override) { if (physics_material_override.is_valid()) { - if (physics_material_override->is_connected(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics")) - physics_material_override->disconnect(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics"); + if (physics_material_override->is_connected_compat(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics")) + physics_material_override->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics"); } physics_material_override = p_physics_material_override; if (physics_material_override.is_valid()) { - physics_material_override->connect(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics"); + physics_material_override->connect_compat(CoreStringNames::get_singleton()->changed, this, "_reload_physics_characteristics"); } _reload_physics_characteristics(); } @@ -738,8 +738,8 @@ void RigidBody::set_contact_monitor(bool p_enabled) { if (node) { - node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); - node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); + node->disconnect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); } } diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp index aa5c439f8a..a1d1856001 100644 --- a/scene/3d/skeleton.cpp +++ b/scene/3d/skeleton.cpp @@ -829,7 +829,7 @@ Ref<SkinReference> Skeleton::register_skin(const Ref<Skin> &p_skin) { skin_bindings.insert(skin_ref.operator->()); - skin->connect("changed", skin_ref.operator->(), "_skin_changed"); + skin->connect_compat("changed", skin_ref.operator->(), "_skin_changed"); _make_dirty(); //skin needs to be updated, so update skeleton diff --git a/scene/3d/soft_body.cpp b/scene/3d/soft_body.cpp index c297bd2c80..957e7df179 100644 --- a/scene/3d/soft_body.cpp +++ b/scene/3d/soft_body.cpp @@ -464,12 +464,12 @@ void SoftBody::prepare_physics_server() { become_mesh_owner(); PhysicsServer::get_singleton()->soft_body_set_mesh(physics_rid, get_mesh()); - VS::get_singleton()->connect("frame_pre_draw", this, "_draw_soft_mesh"); + VS::get_singleton()->connect_compat("frame_pre_draw", this, "_draw_soft_mesh"); } else { PhysicsServer::get_singleton()->soft_body_set_mesh(physics_rid, NULL); - if (VS::get_singleton()->is_connected("frame_pre_draw", this, "_draw_soft_mesh")) { - VS::get_singleton()->disconnect("frame_pre_draw", this, "_draw_soft_mesh"); + if (VS::get_singleton()->is_connected_compat("frame_pre_draw", this, "_draw_soft_mesh")) { + VS::get_singleton()->disconnect_compat("frame_pre_draw", this, "_draw_soft_mesh"); } } } diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 7351b87078..610ae7fb13 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -531,11 +531,11 @@ void Sprite3D::set_texture(const Ref<Texture2D> &p_texture) { if (p_texture == texture) return; if (texture.is_valid()) { - texture->disconnect(CoreStringNames::get_singleton()->changed, this, SceneStringNames::get_singleton()->_queue_update); + texture->disconnect_compat(CoreStringNames::get_singleton()->changed, this, SceneStringNames::get_singleton()->_queue_update); } texture = p_texture; if (texture.is_valid()) { - texture->connect(CoreStringNames::get_singleton()->changed, this, SceneStringNames::get_singleton()->_queue_update); + texture->connect_compat(CoreStringNames::get_singleton()->changed, this, SceneStringNames::get_singleton()->_queue_update); } _queue_update(); } @@ -952,10 +952,10 @@ void AnimatedSprite3D::_notification(int p_what) { void AnimatedSprite3D::set_sprite_frames(const Ref<SpriteFrames> &p_frames) { if (frames.is_valid()) - frames->disconnect("changed", this, "_res_changed"); + frames->disconnect_compat("changed", this, "_res_changed"); frames = p_frames; if (frames.is_valid()) - frames->connect("changed", this, "_res_changed"); + frames->connect_compat("changed", this, "_res_changed"); if (!frames.is_valid()) { frame = 0; diff --git a/scene/3d/visibility_notifier.cpp b/scene/3d/visibility_notifier.cpp index 510442dc1c..3bf9584258 100644 --- a/scene/3d/visibility_notifier.cpp +++ b/scene/3d/visibility_notifier.cpp @@ -170,7 +170,7 @@ void VisibilityEnabler::_find_nodes(Node *p_node) { if (add) { - p_node->connect(SceneStringNames::get_singleton()->tree_exiting, this, "_node_removed", varray(p_node), CONNECT_ONESHOT); + p_node->connect_compat(SceneStringNames::get_singleton()->tree_exiting, this, "_node_removed", varray(p_node), CONNECT_ONESHOT); nodes[p_node] = meta; _change_node_state(p_node, false); } @@ -208,7 +208,7 @@ void VisibilityEnabler::_notification(int p_what) { if (!visible) _change_node_state(E->key(), true); - E->key()->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, "_node_removed"); + E->key()->disconnect_compat(SceneStringNames::get_singleton()->tree_exiting, this, "_node_removed"); } nodes.clear(); diff --git a/scene/animation/animation_blend_space_1d.cpp b/scene/animation/animation_blend_space_1d.cpp index 0f55682427..fbbc99baa2 100644 --- a/scene/animation/animation_blend_space_1d.cpp +++ b/scene/animation/animation_blend_space_1d.cpp @@ -118,7 +118,7 @@ void AnimationNodeBlendSpace1D::add_blend_point(const Ref<AnimationRootNode> &p_ blend_points[p_at_index].node = p_node; blend_points[p_at_index].position = p_position; - blend_points[p_at_index].node->connect("tree_changed", this, "_tree_changed", varray(), CONNECT_REFERENCE_COUNTED); + blend_points[p_at_index].node->connect_compat("tree_changed", this, "_tree_changed", varray(), CONNECT_REFERENCE_COUNTED); blend_points_used++; emit_signal("tree_changed"); @@ -135,11 +135,11 @@ void AnimationNodeBlendSpace1D::set_blend_point_node(int p_point, const Ref<Anim ERR_FAIL_COND(p_node.is_null()); if (blend_points[p_point].node.is_valid()) { - blend_points[p_point].node->disconnect("tree_changed", this, "_tree_changed"); + blend_points[p_point].node->disconnect_compat("tree_changed", this, "_tree_changed"); } blend_points[p_point].node = p_node; - blend_points[p_point].node->connect("tree_changed", this, "_tree_changed", varray(), CONNECT_REFERENCE_COUNTED); + blend_points[p_point].node->connect_compat("tree_changed", this, "_tree_changed", varray(), CONNECT_REFERENCE_COUNTED); emit_signal("tree_changed"); } @@ -158,7 +158,7 @@ void AnimationNodeBlendSpace1D::remove_blend_point(int p_point) { ERR_FAIL_INDEX(p_point, blend_points_used); ERR_FAIL_COND(blend_points[p_point].node.is_null()); - blend_points[p_point].node->disconnect("tree_changed", this, "_tree_changed"); + blend_points[p_point].node->disconnect_compat("tree_changed", this, "_tree_changed"); for (int i = p_point; i < blend_points_used - 1; i++) { blend_points[i] = blend_points[i + 1]; diff --git a/scene/animation/animation_blend_space_2d.cpp b/scene/animation/animation_blend_space_2d.cpp index 0eb8203419..c9ea7a212b 100644 --- a/scene/animation/animation_blend_space_2d.cpp +++ b/scene/animation/animation_blend_space_2d.cpp @@ -77,7 +77,7 @@ void AnimationNodeBlendSpace2D::add_blend_point(const Ref<AnimationRootNode> &p_ blend_points[p_at_index].node = p_node; blend_points[p_at_index].position = p_position; - blend_points[p_at_index].node->connect("tree_changed", this, "_tree_changed", varray(), CONNECT_REFERENCE_COUNTED); + blend_points[p_at_index].node->connect_compat("tree_changed", this, "_tree_changed", varray(), CONNECT_REFERENCE_COUNTED); blend_points_used++; _queue_auto_triangles(); @@ -95,10 +95,10 @@ void AnimationNodeBlendSpace2D::set_blend_point_node(int p_point, const Ref<Anim ERR_FAIL_COND(p_node.is_null()); if (blend_points[p_point].node.is_valid()) { - blend_points[p_point].node->disconnect("tree_changed", this, "_tree_changed"); + blend_points[p_point].node->disconnect_compat("tree_changed", this, "_tree_changed"); } blend_points[p_point].node = p_node; - blend_points[p_point].node->connect("tree_changed", this, "_tree_changed", varray(), CONNECT_REFERENCE_COUNTED); + blend_points[p_point].node->connect_compat("tree_changed", this, "_tree_changed", varray(), CONNECT_REFERENCE_COUNTED); emit_signal("tree_changed"); } @@ -114,7 +114,7 @@ void AnimationNodeBlendSpace2D::remove_blend_point(int p_point) { ERR_FAIL_INDEX(p_point, blend_points_used); ERR_FAIL_COND(blend_points[p_point].node.is_null()); - blend_points[p_point].node->disconnect("tree_changed", this, "_tree_changed"); + blend_points[p_point].node->disconnect_compat("tree_changed", this, "_tree_changed"); for (int i = 0; i < triangles.size(); i++) { bool erase = false; diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp index 5c284cb483..bb6cd93878 100644 --- a/scene/animation/animation_blend_tree.cpp +++ b/scene/animation/animation_blend_tree.cpp @@ -884,8 +884,8 @@ void AnimationNodeBlendTree::add_node(const StringName &p_name, Ref<AnimationNod emit_changed(); emit_signal("tree_changed"); - p_node->connect("tree_changed", this, "_tree_changed", varray(), CONNECT_REFERENCE_COUNTED); - p_node->connect("changed", this, "_node_changed", varray(p_name), CONNECT_REFERENCE_COUNTED); + p_node->connect_compat("tree_changed", this, "_tree_changed", varray(), CONNECT_REFERENCE_COUNTED); + p_node->connect_compat("changed", this, "_node_changed", varray(p_name), CONNECT_REFERENCE_COUNTED); } Ref<AnimationNode> AnimationNodeBlendTree::get_node(const StringName &p_name) const { @@ -947,8 +947,8 @@ void AnimationNodeBlendTree::remove_node(const StringName &p_name) { { Ref<AnimationNode> node = nodes[p_name].node; - node->disconnect("tree_changed", this, "_tree_changed"); - node->disconnect("changed", this, "_node_changed"); + node->disconnect_compat("tree_changed", this, "_tree_changed"); + node->disconnect_compat("changed", this, "_node_changed"); } nodes.erase(p_name); @@ -973,7 +973,7 @@ void AnimationNodeBlendTree::rename_node(const StringName &p_name, const StringN ERR_FAIL_COND(p_name == SceneStringNames::get_singleton()->output); ERR_FAIL_COND(p_new_name == SceneStringNames::get_singleton()->output); - nodes[p_name].node->disconnect("changed", this, "_node_changed"); + nodes[p_name].node->disconnect_compat("changed", this, "_node_changed"); nodes[p_new_name] = nodes[p_name]; nodes.erase(p_name); @@ -988,7 +988,7 @@ void AnimationNodeBlendTree::rename_node(const StringName &p_name, const StringN } } //connection must be done with new name - nodes[p_new_name].node->connect("changed", this, "_node_changed", varray(p_new_name), CONNECT_REFERENCE_COUNTED); + nodes[p_new_name].node->connect_compat("changed", this, "_node_changed", varray(p_new_name), CONNECT_REFERENCE_COUNTED); emit_signal("tree_changed"); } diff --git a/scene/animation/animation_cache.cpp b/scene/animation/animation_cache.cpp index 8d1ffb43cc..16b6813bbe 100644 --- a/scene/animation/animation_cache.cpp +++ b/scene/animation/animation_cache.cpp @@ -56,7 +56,7 @@ void AnimationCache::_clear_cache() { while (connected_nodes.size()) { - connected_nodes.front()->get()->disconnect("tree_exiting", this, "_node_exit_tree"); + connected_nodes.front()->get()->disconnect_compat("tree_exiting", this, "_node_exit_tree"); connected_nodes.erase(connected_nodes.front()); } path_cache.clear(); @@ -174,7 +174,7 @@ void AnimationCache::_update_cache() { if (!connected_nodes.has(path.node)) { connected_nodes.insert(path.node); - path.node->connect("tree_exiting", this, "_node_exit_tree", Node::make_binds(path.node), CONNECT_ONESHOT); + path.node->connect_compat("tree_exiting", this, "_node_exit_tree", Node::make_binds(path.node), CONNECT_ONESHOT); } } @@ -218,7 +218,7 @@ void AnimationCache::set_track_value(int p_idx, const Variant &p_value) { p.object->set_indexed(p.subpath, p_value); } -void AnimationCache::call_track(int p_idx, const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +void AnimationCache::call_track(int p_idx, const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { if (cache_dirty) _update_cache(); @@ -283,7 +283,7 @@ void AnimationCache::set_all(float p_time, float p_delta) { Vector<Variant> args = animation->method_track_get_params(i, E->get()); StringName name = animation->method_track_get_name(i, E->get()); - Variant::CallError err; + Callable::CallError err; if (!args.size()) { @@ -313,12 +313,12 @@ void AnimationCache::set_animation(const Ref<Animation> &p_animation) { _clear_cache(); if (animation.is_valid()) - animation->disconnect("changed", this, "_animation_changed"); + animation->disconnect_compat("changed", this, "_animation_changed"); animation = p_animation; if (animation.is_valid()) - animation->connect("changed", this, "_animation_changed"); + animation->connect_compat("changed", this, "_animation_changed"); } void AnimationCache::_bind_methods() { diff --git a/scene/animation/animation_cache.h b/scene/animation/animation_cache.h index 26ad9dfee5..e73b9e2498 100644 --- a/scene/animation/animation_cache.h +++ b/scene/animation/animation_cache.h @@ -79,7 +79,7 @@ protected: public: void set_track_transform(int p_idx, const Transform &p_transform); void set_track_value(int p_idx, const Variant &p_value); - void call_track(int p_idx, const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error); + void call_track(int p_idx, const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error); void set_all(float p_time, float p_delta = 0); diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp index 59d0d9e87f..665060d899 100644 --- a/scene/animation/animation_node_state_machine.cpp +++ b/scene/animation/animation_node_state_machine.cpp @@ -562,7 +562,7 @@ void AnimationNodeStateMachine::add_node(const StringName &p_name, Ref<Animation emit_changed(); emit_signal("tree_changed"); - p_node->connect("tree_changed", this, "_tree_changed", varray(), CONNECT_REFERENCE_COUNTED); + p_node->connect_compat("tree_changed", this, "_tree_changed", varray(), CONNECT_REFERENCE_COUNTED); } Ref<AnimationNode> AnimationNodeStateMachine::get_node(const StringName &p_name) const { @@ -611,7 +611,7 @@ void AnimationNodeStateMachine::remove_node(const StringName &p_name) { ERR_FAIL_COND(node.is_null()); - node->disconnect("tree_changed", this, "_tree_changed"); + node->disconnect_compat("tree_changed", this, "_tree_changed"); } states.erase(p_name); @@ -619,7 +619,7 @@ void AnimationNodeStateMachine::remove_node(const StringName &p_name) { for (int i = 0; i < transitions.size(); i++) { if (transitions[i].from == p_name || transitions[i].to == p_name) { - transitions.write[i].transition->disconnect("advance_condition_changed", this, "_tree_changed"); + transitions.write[i].transition->disconnect_compat("advance_condition_changed", this, "_tree_changed"); transitions.remove(i); i--; } @@ -722,7 +722,7 @@ void AnimationNodeStateMachine::add_transition(const StringName &p_from, const S tr.to = p_to; tr.transition = p_transition; - tr.transition->connect("advance_condition_changed", this, "_tree_changed", varray(), CONNECT_REFERENCE_COUNTED); + tr.transition->connect_compat("advance_condition_changed", this, "_tree_changed", varray(), CONNECT_REFERENCE_COUNTED); transitions.push_back(tr); } @@ -750,7 +750,7 @@ void AnimationNodeStateMachine::remove_transition(const StringName &p_from, cons for (int i = 0; i < transitions.size(); i++) { if (transitions[i].from == p_from && transitions[i].to == p_to) { - transitions.write[i].transition->disconnect("advance_condition_changed", this, "_tree_changed"); + transitions.write[i].transition->disconnect_compat("advance_condition_changed", this, "_tree_changed"); transitions.remove(i); return; } @@ -764,7 +764,7 @@ void AnimationNodeStateMachine::remove_transition(const StringName &p_from, cons void AnimationNodeStateMachine::remove_transition_by_index(int p_transition) { ERR_FAIL_INDEX(p_transition, transitions.size()); - transitions.write[p_transition].transition->disconnect("advance_condition_changed", this, "_tree_changed"); + transitions.write[p_transition].transition->disconnect_compat("advance_condition_changed", this, "_tree_changed"); transitions.remove(p_transition); /*if (playing) { path.clear(); diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 4276c145ec..eb9b5e3aa7 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -263,8 +263,8 @@ void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim) { } { - if (!child->is_connected("tree_exiting", this, "_node_removed")) - child->connect("tree_exiting", this, "_node_removed", make_binds(child), CONNECT_ONESHOT); + if (!child->is_connected_compat("tree_exiting", this, "_node_removed")) + child->connect_compat("tree_exiting", this, "_node_removed", make_binds(child), CONNECT_ONESHOT); } TrackNodeCacheKey key; @@ -1007,12 +1007,12 @@ void AnimationPlayer::remove_animation(const StringName &p_name) { void AnimationPlayer::_ref_anim(const Ref<Animation> &p_anim) { - Ref<Animation>(p_anim)->connect(SceneStringNames::get_singleton()->tracks_changed, this, "_animation_changed", varray(), CONNECT_REFERENCE_COUNTED); + Ref<Animation>(p_anim)->connect_compat(SceneStringNames::get_singleton()->tracks_changed, this, "_animation_changed", varray(), CONNECT_REFERENCE_COUNTED); } void AnimationPlayer::_unref_anim(const Ref<Animation> &p_anim) { - Ref<Animation>(p_anim)->disconnect(SceneStringNames::get_singleton()->tracks_changed, this, "_animation_changed"); + Ref<Animation>(p_anim)->disconnect_compat(SceneStringNames::get_singleton()->tracks_changed, this, "_animation_changed"); } void AnimationPlayer::rename_animation(const StringName &p_name, const StringName &p_new_name) { diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index a08cc0927b..7c6c8ba408 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -463,13 +463,13 @@ AnimationNode::AnimationNode() { void AnimationTree::set_tree_root(const Ref<AnimationNode> &p_root) { if (root.is_valid()) { - root->disconnect("tree_changed", this, "_tree_changed"); + root->disconnect_compat("tree_changed", this, "_tree_changed"); } root = p_root; if (root.is_valid()) { - root->connect("tree_changed", this, "_tree_changed"); + root->connect_compat("tree_changed", this, "_tree_changed"); } properties_dirty = true; @@ -582,8 +582,8 @@ bool AnimationTree::_update_caches(AnimationPlayer *player) { continue; } - if (!child->is_connected("tree_exited", this, "_node_removed")) { - child->connect("tree_exited", this, "_node_removed", varray(child)); + if (!child->is_connected_compat("tree_exited", this, "_node_removed")) { + child->connect_compat("tree_exited", this, "_node_removed", varray(child)); } switch (track_type) { @@ -778,12 +778,12 @@ void AnimationTree::_process_graph(float p_delta) { if (last_animation_player.is_valid()) { Object *old_player = ObjectDB::get_instance(last_animation_player); if (old_player) { - old_player->disconnect("caches_cleared", this, "_clear_caches"); + old_player->disconnect_compat("caches_cleared", this, "_clear_caches"); } } if (player) { - player->connect("caches_cleared", this, "_clear_caches"); + player->connect_compat("caches_cleared", this, "_clear_caches"); } last_animation_player = current_animation_player; @@ -1300,7 +1300,7 @@ void AnimationTree::_notification(int p_what) { Object *player = ObjectDB::get_instance(last_animation_player); if (player) { - player->disconnect("caches_cleared", this, "_clear_caches"); + player->disconnect_compat("caches_cleared", this, "_clear_caches"); } } } else if (p_what == NOTIFICATION_ENTER_TREE) { @@ -1308,7 +1308,7 @@ void AnimationTree::_notification(int p_what) { Object *player = ObjectDB::get_instance(last_animation_player); if (player) { - player->connect("caches_cleared", this, "_clear_caches"); + player->connect_compat("caches_cleared", this, "_clear_caches"); } } } diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index a7f3794a05..161c6d04af 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -97,7 +97,7 @@ void Tween::_process_pending_commands() { // Get the command PendingCommand &cmd = E->get(); - Variant::CallError err; + Callable::CallError err; // Grab all of the arguments for the command Variant *arg[10] = { @@ -309,9 +309,9 @@ Variant Tween::_get_initial_val(const InterpolateData &p_data) const { ERR_FAIL_COND_V(!valid, p_data.initial_val); } else { // Call the method and get the initial value from it - Variant::CallError error; + Callable::CallError error; initial_val = object->call(p_data.target_key[0], NULL, 0, error); - ERR_FAIL_COND_V(error.error != Variant::CallError::CALL_OK, p_data.initial_val); + ERR_FAIL_COND_V(error.error != Callable::CallError::CALL_OK, p_data.initial_val); } return initial_val; } @@ -341,9 +341,9 @@ Variant Tween::_get_final_val(const InterpolateData &p_data) const { ERR_FAIL_COND_V(!valid, p_data.initial_val); } else { // We're looking at a method. Call the method on the target object - Variant::CallError error; + Callable::CallError error; final_val = target->call(p_data.target_key[0], NULL, 0, error); - ERR_FAIL_COND_V(error.error != Variant::CallError::CALL_OK, p_data.initial_val); + ERR_FAIL_COND_V(error.error != Callable::CallError::CALL_OK, p_data.initial_val); } // If we're looking at an INT value, instead convert it to a REAL @@ -383,9 +383,9 @@ Variant &Tween::_get_delta_val(InterpolateData &p_data) { ERR_FAIL_COND_V(!valid, p_data.initial_val); } else { // We're looking at a method. Call the method on the target object - Variant::CallError error; + Callable::CallError error; final_val = target->call(p_data.target_key[0], NULL, 0, error); - ERR_FAIL_COND_V(error.error != Variant::CallError::CALL_OK, p_data.initial_val); + ERR_FAIL_COND_V(error.error != Callable::CallError::CALL_OK, p_data.initial_val); } // If we're looking at an INT value, instead convert it to a REAL @@ -607,7 +607,7 @@ bool Tween::_apply_tween_value(InterpolateData &p_data, Variant &value) { case FOLLOW_METHOD: case TARGETING_METHOD: { // We want to call the method on the target object - Variant::CallError error; + Callable::CallError error; // Do we have a non-nil value passed in? if (value.get_type() != Variant::NIL) { @@ -620,7 +620,7 @@ bool Tween::_apply_tween_value(InterpolateData &p_data, Variant &value) { } // Did we get an error from the function call? - return error.error == Variant::CallError::CALL_OK; + return error.error == Callable::CallError::CALL_OK; } case INTER_CALLBACK: @@ -732,7 +732,7 @@ void Tween::_tween_process(float p_delta) { } } else { // Call the function directly with the arguments - Variant::CallError error; + Callable::CallError error; Variant *arg[5] = { &data.arg[0], &data.arg[1], @@ -1533,9 +1533,9 @@ bool Tween::follow_method(Object *p_object, StringName p_method, Variant p_initi ERR_FAIL_COND_V_MSG(!p_target->has_method(p_target_method), false, "Target has no method named: " + p_target_method + "."); // Call the method to get the target value - Variant::CallError error; + Callable::CallError error; Variant target_val = p_target->call(p_target_method, NULL, 0, error); - ERR_FAIL_COND_V(error.error != Variant::CallError::CALL_OK, false); + ERR_FAIL_COND_V(error.error != Callable::CallError::CALL_OK, false); // Convert target INT values to REAL as they are better for interpolation if (target_val.get_type() == Variant::INT) target_val = target_val.operator real_t(); @@ -1663,9 +1663,9 @@ bool Tween::targeting_method(Object *p_object, StringName p_method, Object *p_in ERR_FAIL_COND_V_MSG(!p_initial->has_method(p_initial_method), false, "Initial Object has no method named: " + p_initial_method + "."); // Call the method to get the initial value - Variant::CallError error; + Callable::CallError error; Variant initial_val = p_initial->call(p_initial_method, NULL, 0, error); - ERR_FAIL_COND_V(error.error != Variant::CallError::CALL_OK, false); + ERR_FAIL_COND_V(error.error != Callable::CallError::CALL_OK, false); // Convert initial INT values to REAL as they aer better for interpolation if (initial_val.get_type() == Variant::INT) initial_val = initial_val.operator real_t(); diff --git a/scene/audio/audio_stream_player.cpp b/scene/audio/audio_stream_player.cpp index 03d96d41fa..1415be5397 100644 --- a/scene/audio/audio_stream_player.cpp +++ b/scene/audio/audio_stream_player.cpp @@ -441,7 +441,7 @@ AudioStreamPlayer::AudioStreamPlayer() { setstop = false; use_fadeout = false; - AudioServer::get_singleton()->connect("bus_layout_changed", this, "_bus_layout_changed"); + AudioServer::get_singleton()->connect_compat("bus_layout_changed", this, "_bus_layout_changed"); } AudioStreamPlayer::~AudioStreamPlayer() { diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 6ed16a2b75..cb71128424 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -615,9 +615,9 @@ void ColorPicker::_screen_pick_pressed() { screen->set_as_toplevel(true); screen->set_anchors_and_margins_preset(Control::PRESET_WIDE); screen->set_default_cursor_shape(CURSOR_POINTING_HAND); - screen->connect("gui_input", this, "_screen_input"); + screen->connect_compat("gui_input", this, "_screen_input"); // It immediately toggles off in the first press otherwise. - screen->call_deferred("connect", "hide", btn_pick, "set_pressed", varray(false)); + screen->call_deferred("connect", "hide", Callable(btn_pick, "set_pressed"), varray(false)); } screen->raise(); screen->show_modal(); @@ -742,20 +742,20 @@ ColorPicker::ColorPicker() : uv_edit = memnew(Control); hb_edit->add_child(uv_edit); - uv_edit->connect("gui_input", this, "_uv_input"); + uv_edit->connect_compat("gui_input", this, "_uv_input"); uv_edit->set_mouse_filter(MOUSE_FILTER_PASS); uv_edit->set_h_size_flags(SIZE_EXPAND_FILL); uv_edit->set_v_size_flags(SIZE_EXPAND_FILL); uv_edit->set_custom_minimum_size(Size2(get_constant("sv_width"), get_constant("sv_height"))); - uv_edit->connect("draw", this, "_hsv_draw", make_binds(0, uv_edit)); + uv_edit->connect_compat("draw", this, "_hsv_draw", make_binds(0, uv_edit)); w_edit = memnew(Control); hb_edit->add_child(w_edit); w_edit->set_custom_minimum_size(Size2(get_constant("h_width"), 0)); w_edit->set_h_size_flags(SIZE_FILL); w_edit->set_v_size_flags(SIZE_EXPAND_FILL); - w_edit->connect("gui_input", this, "_w_input"); - w_edit->connect("draw", this, "_hsv_draw", make_binds(1, w_edit)); + w_edit->connect_compat("gui_input", this, "_w_input"); + w_edit->connect_compat("draw", this, "_hsv_draw", make_binds(1, w_edit)); HBoxContainer *hb_smpl = memnew(HBoxContainer); add_child(hb_smpl); @@ -763,13 +763,13 @@ ColorPicker::ColorPicker() : sample = memnew(TextureRect); hb_smpl->add_child(sample); sample->set_h_size_flags(SIZE_EXPAND_FILL); - sample->connect("draw", this, "_sample_draw"); + sample->connect_compat("draw", this, "_sample_draw"); btn_pick = memnew(ToolButton); hb_smpl->add_child(btn_pick); btn_pick->set_toggle_mode(true); btn_pick->set_tooltip(TTR("Pick a color from the editor window.")); - btn_pick->connect("pressed", this, "_screen_pick_pressed"); + btn_pick->connect_compat("pressed", this, "_screen_pick_pressed"); VBoxContainer *vbl = memnew(VBoxContainer); add_child(vbl); @@ -797,14 +797,14 @@ ColorPicker::ColorPicker() : values[i] = memnew(SpinBox); scroll[i]->share(values[i]); hbc->add_child(values[i]); - values[i]->get_line_edit()->connect("focus_entered", this, "_focus_enter"); - values[i]->get_line_edit()->connect("focus_exited", this, "_focus_exit"); + values[i]->get_line_edit()->connect_compat("focus_entered", this, "_focus_enter"); + values[i]->get_line_edit()->connect_compat("focus_exited", this, "_focus_exit"); scroll[i]->set_min(0); scroll[i]->set_page(0); scroll[i]->set_h_size_flags(SIZE_EXPAND_FILL); - scroll[i]->connect("value_changed", this, "_value_changed"); + scroll[i]->connect_compat("value_changed", this, "_value_changed"); vbr->add_child(hbc); } @@ -816,12 +816,12 @@ ColorPicker::ColorPicker() : btn_hsv = memnew(CheckButton); hhb->add_child(btn_hsv); btn_hsv->set_text(TTR("HSV")); - btn_hsv->connect("toggled", this, "set_hsv_mode"); + btn_hsv->connect_compat("toggled", this, "set_hsv_mode"); btn_raw = memnew(CheckButton); hhb->add_child(btn_raw); btn_raw->set_text(TTR("Raw")); - btn_raw->connect("toggled", this, "set_raw_mode"); + btn_raw->connect_compat("toggled", this, "set_raw_mode"); text_type = memnew(Button); hhb->add_child(text_type); @@ -832,7 +832,7 @@ ColorPicker::ColorPicker() : #ifdef TOOLS_ENABLED text_type->set_custom_minimum_size(Size2(28 * EDSCALE, 0)); // Adjust for the width of the "Script" icon. #endif - text_type->connect("pressed", this, "_text_type_toggled"); + text_type->connect_compat("pressed", this, "_text_type_toggled"); } else { text_type->set_flat(true); @@ -842,9 +842,9 @@ ColorPicker::ColorPicker() : c_text = memnew(LineEdit); hhb->add_child(c_text); c_text->set_h_size_flags(SIZE_EXPAND_FILL); - c_text->connect("text_entered", this, "_html_entered"); - c_text->connect("focus_entered", this, "_focus_enter"); - c_text->connect("focus_exited", this, "_html_focus_exit"); + c_text->connect_compat("text_entered", this, "_html_entered"); + c_text->connect_compat("focus_entered", this, "_focus_enter"); + c_text->connect_compat("focus_exited", this, "_html_focus_exit"); _update_controls(); updating = false; @@ -860,8 +860,8 @@ ColorPicker::ColorPicker() : preset = memnew(TextureRect); preset_container->add_child(preset); - preset->connect("gui_input", this, "_preset_input"); - preset->connect("draw", this, "_update_presets"); + preset->connect_compat("gui_input", this, "_preset_input"); + preset->connect_compat("draw", this, "_update_presets"); preset_container2 = memnew(HBoxContainer); preset_container2->set_h_size_flags(SIZE_EXPAND_FILL); @@ -869,7 +869,7 @@ ColorPicker::ColorPicker() : bt_add_preset = memnew(Button); preset_container2->add_child(bt_add_preset); bt_add_preset->set_tooltip(TTR("Add current color as a preset.")); - bt_add_preset->connect("pressed", this, "_add_preset_pressed"); + bt_add_preset->connect_compat("pressed", this, "_add_preset_pressed"); } ///////////////// @@ -969,10 +969,10 @@ void ColorPickerButton::_update_picker() { picker = memnew(ColorPicker); popup->add_child(picker); add_child(popup); - picker->connect("color_changed", this, "_color_changed"); - popup->connect("modal_closed", this, "_modal_closed"); - popup->connect("about_to_show", this, "set_pressed", varray(true)); - popup->connect("popup_hide", this, "set_pressed", varray(false)); + picker->connect_compat("color_changed", this, "_color_changed"); + popup->connect_compat("modal_closed", this, "_modal_closed"); + popup->connect_compat("about_to_show", this, "set_pressed", varray(true)); + popup->connect_compat("popup_hide", this, "set_pressed", varray(false)); picker->set_pick_color(color); picker->set_edit_alpha(edit_alpha); emit_signal("picker_created"); diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp index b411f563b8..f6ce0c9a60 100644 --- a/scene/gui/container.cpp +++ b/scene/gui/container.cpp @@ -48,9 +48,9 @@ void Container::add_child_notify(Node *p_child) { if (!control) return; - control->connect("size_flags_changed", this, "queue_sort"); - control->connect("minimum_size_changed", this, "_child_minsize_changed"); - control->connect("visibility_changed", this, "_child_minsize_changed"); + control->connect_compat("size_flags_changed", this, "queue_sort"); + control->connect_compat("minimum_size_changed", this, "_child_minsize_changed"); + control->connect_compat("visibility_changed", this, "_child_minsize_changed"); minimum_size_changed(); queue_sort(); @@ -75,9 +75,9 @@ void Container::remove_child_notify(Node *p_child) { if (!control) return; - control->disconnect("size_flags_changed", this, "queue_sort"); - control->disconnect("minimum_size_changed", this, "_child_minsize_changed"); - control->disconnect("visibility_changed", this, "_child_minsize_changed"); + control->disconnect_compat("size_flags_changed", this, "queue_sort"); + control->disconnect_compat("minimum_size_changed", this, "_child_minsize_changed"); + control->disconnect_compat("visibility_changed", this, "_child_minsize_changed"); minimum_size_changed(); queue_sort(); diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index b7bc2f9c9e..7bac476b1e 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -221,28 +221,28 @@ bool Control::_set(const StringName &p_name, const Variant &p_value) { if (name.begins_with("custom_icons/")) { String dname = name.get_slicec('/', 1); if (data.icon_override.has(dname)) { - data.icon_override[dname]->disconnect("changed", this, "_override_changed"); + data.icon_override[dname]->disconnect_compat("changed", this, "_override_changed"); } data.icon_override.erase(dname); notification(NOTIFICATION_THEME_CHANGED); } else if (name.begins_with("custom_shaders/")) { String dname = name.get_slicec('/', 1); if (data.shader_override.has(dname)) { - data.shader_override[dname]->disconnect("changed", this, "_override_changed"); + data.shader_override[dname]->disconnect_compat("changed", this, "_override_changed"); } data.shader_override.erase(dname); notification(NOTIFICATION_THEME_CHANGED); } else if (name.begins_with("custom_styles/")) { String dname = name.get_slicec('/', 1); if (data.style_override.has(dname)) { - data.style_override[dname]->disconnect("changed", this, "_override_changed"); + data.style_override[dname]->disconnect_compat("changed", this, "_override_changed"); } data.style_override.erase(dname); notification(NOTIFICATION_THEME_CHANGED); } else if (name.begins_with("custom_fonts/")) { String dname = name.get_slicec('/', 1); if (data.font_override.has(dname)) { - data.font_override[dname]->disconnect("changed", this, "_override_changed"); + data.font_override[dname]->disconnect_compat("changed", this, "_override_changed"); } data.font_override.erase(dname); notification(NOTIFICATION_THEME_CHANGED); @@ -542,10 +542,10 @@ void Control::_notification(int p_notification) { if (data.parent_canvas_item) { - data.parent_canvas_item->connect("item_rect_changed", this, "_size_changed"); + data.parent_canvas_item->connect_compat("item_rect_changed", this, "_size_changed"); } else { //connect viewport - get_viewport()->connect("size_changed", this, "_size_changed"); + get_viewport()->connect_compat("size_changed", this, "_size_changed"); } } @@ -561,11 +561,11 @@ void Control::_notification(int p_notification) { if (data.parent_canvas_item) { - data.parent_canvas_item->disconnect("item_rect_changed", this, "_size_changed"); + data.parent_canvas_item->disconnect_compat("item_rect_changed", this, "_size_changed"); data.parent_canvas_item = NULL; } else if (!is_set_as_toplevel()) { //disconnect viewport - get_viewport()->disconnect("size_changed", this, "_size_changed"); + get_viewport()->disconnect_compat("size_changed", this, "_size_changed"); } if (data.MI) { @@ -687,9 +687,9 @@ bool Control::has_point(const Point2 &p_point) const { if (get_script_instance()) { Variant v = p_point; const Variant *p = &v; - Variant::CallError ce; + Callable::CallError ce; Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->has_point, &p, 1, ce); - if (ce.error == Variant::CallError::CALL_OK) { + if (ce.error == Callable::CallError::CALL_OK) { return ret; } } @@ -721,9 +721,9 @@ Variant Control::get_drag_data(const Point2 &p_point) { if (get_script_instance()) { Variant v = p_point; const Variant *p = &v; - Variant::CallError ce; + Callable::CallError ce; Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->get_drag_data, &p, 1, ce); - if (ce.error == Variant::CallError::CALL_OK) + if (ce.error == Callable::CallError::CALL_OK) return ret; } @@ -743,9 +743,9 @@ bool Control::can_drop_data(const Point2 &p_point, const Variant &p_data) const if (get_script_instance()) { Variant v = p_point; const Variant *p[2] = { &v, &p_data }; - Variant::CallError ce; + Callable::CallError ce; Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->can_drop_data, p, 2, ce); - if (ce.error == Variant::CallError::CALL_OK) + if (ce.error == Callable::CallError::CALL_OK) return ret; } @@ -765,9 +765,9 @@ void Control::drop_data(const Point2 &p_point, const Variant &p_data) { if (get_script_instance()) { Variant v = p_point; const Variant *p[2] = { &v, &p_data }; - Variant::CallError ce; + Callable::CallError ce; Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->drop_data, p, 2, ce); - if (ce.error == Variant::CallError::CALL_OK) + if (ce.error == Callable::CallError::CALL_OK) return; } } @@ -805,9 +805,9 @@ Size2 Control::get_minimum_size() const { ScriptInstance *si = const_cast<Control *>(this)->get_script_instance(); if (si) { - Variant::CallError ce; + Callable::CallError ce; Variant s = si->call(SceneStringNames::get_singleton()->_get_minimum_size, NULL, 0, ce); - if (ce.error == Variant::CallError::CALL_OK) + if (ce.error == Callable::CallError::CALL_OK) return s; } return Size2(); @@ -1883,7 +1883,7 @@ Rect2 Control::get_anchorable_rect() const { void Control::add_icon_override(const StringName &p_name, const Ref<Texture2D> &p_icon) { if (data.icon_override.has(p_name)) { - data.icon_override[p_name]->disconnect("changed", this, "_override_changed"); + data.icon_override[p_name]->disconnect_compat("changed", this, "_override_changed"); } // clear if "null" is passed instead of a icon @@ -1892,7 +1892,7 @@ void Control::add_icon_override(const StringName &p_name, const Ref<Texture2D> & } else { data.icon_override[p_name] = p_icon; if (data.icon_override[p_name].is_valid()) { - data.icon_override[p_name]->connect("changed", this, "_override_changed", Vector<Variant>(), CONNECT_REFERENCE_COUNTED); + data.icon_override[p_name]->connect_compat("changed", this, "_override_changed", Vector<Variant>(), CONNECT_REFERENCE_COUNTED); } } notification(NOTIFICATION_THEME_CHANGED); @@ -1901,7 +1901,7 @@ void Control::add_icon_override(const StringName &p_name, const Ref<Texture2D> & void Control::add_shader_override(const StringName &p_name, const Ref<Shader> &p_shader) { if (data.shader_override.has(p_name)) { - data.shader_override[p_name]->disconnect("changed", this, "_override_changed"); + data.shader_override[p_name]->disconnect_compat("changed", this, "_override_changed"); } // clear if "null" is passed instead of a shader @@ -1910,7 +1910,7 @@ void Control::add_shader_override(const StringName &p_name, const Ref<Shader> &p } else { data.shader_override[p_name] = p_shader; if (data.shader_override[p_name].is_valid()) { - data.shader_override[p_name]->connect("changed", this, "_override_changed", Vector<Variant>(), CONNECT_REFERENCE_COUNTED); + data.shader_override[p_name]->connect_compat("changed", this, "_override_changed", Vector<Variant>(), CONNECT_REFERENCE_COUNTED); } } notification(NOTIFICATION_THEME_CHANGED); @@ -1918,7 +1918,7 @@ void Control::add_shader_override(const StringName &p_name, const Ref<Shader> &p void Control::add_style_override(const StringName &p_name, const Ref<StyleBox> &p_style) { if (data.style_override.has(p_name)) { - data.style_override[p_name]->disconnect("changed", this, "_override_changed"); + data.style_override[p_name]->disconnect_compat("changed", this, "_override_changed"); } // clear if "null" is passed instead of a style @@ -1927,7 +1927,7 @@ void Control::add_style_override(const StringName &p_name, const Ref<StyleBox> & } else { data.style_override[p_name] = p_style; if (data.style_override[p_name].is_valid()) { - data.style_override[p_name]->connect("changed", this, "_override_changed", Vector<Variant>(), CONNECT_REFERENCE_COUNTED); + data.style_override[p_name]->connect_compat("changed", this, "_override_changed", Vector<Variant>(), CONNECT_REFERENCE_COUNTED); } } notification(NOTIFICATION_THEME_CHANGED); @@ -1936,7 +1936,7 @@ void Control::add_style_override(const StringName &p_name, const Ref<StyleBox> & void Control::add_font_override(const StringName &p_name, const Ref<Font> &p_font) { if (data.font_override.has(p_name)) { - data.font_override[p_name]->disconnect("changed", this, "_override_changed"); + data.font_override[p_name]->disconnect_compat("changed", this, "_override_changed"); } // clear if "null" is passed instead of a font @@ -1945,7 +1945,7 @@ void Control::add_font_override(const StringName &p_name, const Ref<Font> &p_fon } else { data.font_override[p_name] = p_font; if (data.font_override[p_name].is_valid()) { - data.font_override[p_name]->connect("changed", this, "_override_changed", Vector<Variant>(), CONNECT_REFERENCE_COUNTED); + data.font_override[p_name]->connect_compat("changed", this, "_override_changed", Vector<Variant>(), CONNECT_REFERENCE_COUNTED); } } notification(NOTIFICATION_THEME_CHANGED); @@ -2262,7 +2262,7 @@ void Control::set_theme(const Ref<Theme> &p_theme) { return; if (data.theme.is_valid()) { - data.theme->disconnect("changed", this, "_theme_changed"); + data.theme->disconnect_compat("changed", this, "_theme_changed"); } data.theme = p_theme; @@ -2282,7 +2282,7 @@ void Control::set_theme(const Ref<Theme> &p_theme) { } if (data.theme.is_valid()) { - data.theme->connect("changed", this, "_theme_changed", varray(), CONNECT_DEFERRED); + data.theme->connect_compat("changed", this, "_theme_changed", varray(), CONNECT_DEFERRED); } } @@ -2625,9 +2625,9 @@ bool Control::is_text_field() const { if (get_script_instance()) { Variant v=p_point; const Variant *p[2]={&v,&p_data}; - Variant::CallError ce; + Callable::CallError ce; Variant ret = get_script_instance()->call("is_text_field",p,2,ce); - if (ce.error==Variant::CallError::CALL_OK) + if (ce.error==Callable::CallError::CALL_OK) return ret; } */ diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index e0e88e1577..74a82faf28 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -347,7 +347,7 @@ WindowDialog::WindowDialog() { resizable = false; close_button = memnew(TextureButton); add_child(close_button); - close_button->connect("pressed", this, "_closed"); + close_button->connect_compat("pressed", this, "_closed"); #ifdef TOOLS_ENABLED was_editor_dimmed = false; @@ -446,7 +446,7 @@ void AcceptDialog::register_text_enter(Node *p_line_edit) { ERR_FAIL_NULL(p_line_edit); LineEdit *line_edit = Object::cast_to<LineEdit>(p_line_edit); if (line_edit) - line_edit->connect("text_entered", this, "_builtin_text_entered"); + line_edit->connect_compat("text_entered", this, "_builtin_text_entered"); } void AcceptDialog::_update_child_rects() { @@ -531,7 +531,7 @@ Button *AcceptDialog::add_button(const String &p_text, bool p_right, const Strin } if (p_action != "") { - button->connect("pressed", this, "_custom_action", varray(p_action)); + button->connect_compat("pressed", this, "_custom_action", varray(p_action)); } return button; @@ -543,7 +543,7 @@ Button *AcceptDialog::add_cancel(const String &p_cancel) { if (p_cancel == "") c = RTR("Cancel"); Button *b = swap_ok_cancel ? add_button(c, true) : add_button(c); - b->connect("pressed", this, "_closed"); + b->connect_compat("pressed", this, "_closed"); return b; } @@ -600,7 +600,7 @@ AcceptDialog::AcceptDialog() { hbc->add_child(ok); hbc->add_spacer(); - ok->connect("pressed", this, "_ok"); + ok->connect_compat("pressed", this, "_ok"); set_as_toplevel(true); hide_on_ok = true; diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 931fb4f13e..e27e7d1490 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -900,11 +900,11 @@ FileDialog::FileDialog() { dir_up = memnew(ToolButton); dir_up->set_tooltip(RTR("Go to parent folder.")); hbc->add_child(dir_up); - dir_up->connect("pressed", this, "_go_up"); + dir_up->connect_compat("pressed", this, "_go_up"); drives = memnew(OptionButton); hbc->add_child(drives); - drives->connect("item_selected", this, "_select_drive"); + drives->connect_compat("item_selected", this, "_select_drive"); hbc->add_child(memnew(Label(RTR("Path:")))); dir = memnew(LineEdit); @@ -913,19 +913,19 @@ FileDialog::FileDialog() { refresh = memnew(ToolButton); refresh->set_tooltip(RTR("Refresh files.")); - refresh->connect("pressed", this, "_update_file_list"); + refresh->connect_compat("pressed", this, "_update_file_list"); hbc->add_child(refresh); show_hidden = memnew(ToolButton); show_hidden->set_toggle_mode(true); show_hidden->set_pressed(is_showing_hidden_files()); show_hidden->set_tooltip(RTR("Toggle the visibility of hidden files.")); - show_hidden->connect("toggled", this, "set_show_hidden_files"); + show_hidden->connect_compat("toggled", this, "set_show_hidden_files"); hbc->add_child(show_hidden); makedir = memnew(Button); makedir->set_text(RTR("Create Folder")); - makedir->connect("pressed", this, "_make_dir"); + makedir->connect_compat("pressed", this, "_make_dir"); hbc->add_child(makedir); vbc->add_child(hbc); @@ -950,20 +950,20 @@ FileDialog::FileDialog() { access = ACCESS_RESOURCES; _update_drives(); - connect("confirmed", this, "_action_pressed"); - tree->connect("multi_selected", this, "_tree_multi_selected", varray(), CONNECT_DEFERRED); - tree->connect("cell_selected", this, "_tree_selected", varray(), CONNECT_DEFERRED); - tree->connect("item_activated", this, "_tree_item_activated", varray()); - tree->connect("nothing_selected", this, "deselect_items"); - dir->connect("text_entered", this, "_dir_entered"); - file->connect("text_entered", this, "_file_entered"); - filter->connect("item_selected", this, "_filter_selected"); + connect_compat("confirmed", this, "_action_pressed"); + tree->connect_compat("multi_selected", this, "_tree_multi_selected", varray(), CONNECT_DEFERRED); + tree->connect_compat("cell_selected", this, "_tree_selected", varray(), CONNECT_DEFERRED); + tree->connect_compat("item_activated", this, "_tree_item_activated", varray()); + tree->connect_compat("nothing_selected", this, "deselect_items"); + dir->connect_compat("text_entered", this, "_dir_entered"); + file->connect_compat("text_entered", this, "_file_entered"); + filter->connect_compat("item_selected", this, "_filter_selected"); confirm_save = memnew(ConfirmationDialog); confirm_save->set_as_toplevel(true); add_child(confirm_save); - confirm_save->connect("confirmed", this, "_save_confirm_pressed"); + confirm_save->connect_compat("confirmed", this, "_save_confirm_pressed"); makedialog = memnew(ConfirmationDialog); makedialog->set_title(RTR("Create Folder")); @@ -974,7 +974,7 @@ FileDialog::FileDialog() { makevb->add_margin_child(RTR("Name:"), makedirname); add_child(makedialog); makedialog->register_text_enter(makedirname); - makedialog->connect("confirmed", this, "_make_dir_confirm"); + makedialog->connect_compat("confirmed", this, "_make_dir_confirm"); mkdirerr = memnew(AcceptDialog); mkdirerr->set_text(RTR("Could not create folder.")); add_child(mkdirerr); @@ -1029,10 +1029,10 @@ LineEditFileChooser::LineEditFileChooser() { button = memnew(Button); button->set_text(" .. "); add_child(button); - button->connect("pressed", this, "_browse"); + button->connect_compat("pressed", this, "_browse"); dialog = memnew(FileDialog); add_child(dialog); - dialog->connect("file_selected", this, "_chosen"); - dialog->connect("dir_selected", this, "_chosen"); - dialog->connect("files_selected", this, "_chosen"); + dialog->connect_compat("file_selected", this, "_chosen"); + dialog->connect_compat("dir_selected", this, "_chosen"); + dialog->connect_compat("files_selected", this, "_chosen"); } diff --git a/scene/gui/gradient_edit.cpp b/scene/gui/gradient_edit.cpp index 80431cefe0..98c2d3a0e9 100644 --- a/scene/gui/gradient_edit.cpp +++ b/scene/gui/gradient_edit.cpp @@ -302,8 +302,8 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) { void GradientEdit::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - if (!picker->is_connected("color_changed", this, "_color_changed")) { - picker->connect("color_changed", this, "_color_changed"); + if (!picker->is_connected_compat("color_changed", this, "_color_changed")) { + picker->connect_compat("color_changed", this, "_color_changed"); } } if (p_what == NOTIFICATION_DRAW) { diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index c6a5e21ff8..3c434e336c 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -257,9 +257,9 @@ void GraphEdit::add_child_notify(Node *p_child) { GraphNode *gn = Object::cast_to<GraphNode>(p_child); if (gn) { gn->set_scale(Vector2(zoom, zoom)); - gn->connect("offset_changed", this, "_graph_node_moved", varray(gn)); - gn->connect("raise_request", this, "_graph_node_raised", varray(gn)); - gn->connect("item_rect_changed", connections_layer, "update"); + gn->connect_compat("offset_changed", this, "_graph_node_moved", varray(gn)); + gn->connect_compat("raise_request", this, "_graph_node_raised", varray(gn)); + gn->connect_compat("item_rect_changed", connections_layer, "update"); _graph_node_moved(gn); gn->set_mouse_filter(MOUSE_FILTER_PASS); } @@ -273,8 +273,8 @@ void GraphEdit::remove_child_notify(Node *p_child) { } GraphNode *gn = Object::cast_to<GraphNode>(p_child); if (gn) { - gn->disconnect("offset_changed", this, "_graph_node_moved"); - gn->disconnect("raise_request", this, "_graph_node_raised"); + gn->disconnect_compat("offset_changed", this, "_graph_node_moved"); + gn->disconnect_compat("raise_request", this, "_graph_node_raised"); } } @@ -1341,12 +1341,12 @@ GraphEdit::GraphEdit() { add_child(top_layer); top_layer->set_mouse_filter(MOUSE_FILTER_PASS); top_layer->set_anchors_and_margins_preset(Control::PRESET_WIDE); - top_layer->connect("draw", this, "_top_layer_draw"); - top_layer->connect("gui_input", this, "_top_layer_input"); + top_layer->connect_compat("draw", this, "_top_layer_draw"); + top_layer->connect_compat("gui_input", this, "_top_layer_input"); connections_layer = memnew(Control); add_child(connections_layer); - connections_layer->connect("draw", this, "_connections_layer_draw"); + connections_layer->connect_compat("draw", this, "_connections_layer_draw"); connections_layer->set_name("CLAYER"); connections_layer->set_disable_visibility_clip(true); // so it can draw freely and be offset connections_layer->set_mouse_filter(MOUSE_FILTER_IGNORE); @@ -1373,8 +1373,8 @@ GraphEdit::GraphEdit() { v_scroll->set_min(-10000); v_scroll->set_max(10000); - h_scroll->connect("value_changed", this, "_scroll_moved"); - v_scroll->connect("value_changed", this, "_scroll_moved"); + h_scroll->connect_compat("value_changed", this, "_scroll_moved"); + v_scroll->connect_compat("value_changed", this, "_scroll_moved"); zoom = 1; @@ -1385,25 +1385,25 @@ GraphEdit::GraphEdit() { zoom_minus = memnew(ToolButton); zoom_hb->add_child(zoom_minus); zoom_minus->set_tooltip(RTR("Zoom Out")); - zoom_minus->connect("pressed", this, "_zoom_minus"); + zoom_minus->connect_compat("pressed", this, "_zoom_minus"); zoom_minus->set_focus_mode(FOCUS_NONE); zoom_reset = memnew(ToolButton); zoom_hb->add_child(zoom_reset); zoom_reset->set_tooltip(RTR("Zoom Reset")); - zoom_reset->connect("pressed", this, "_zoom_reset"); + zoom_reset->connect_compat("pressed", this, "_zoom_reset"); zoom_reset->set_focus_mode(FOCUS_NONE); zoom_plus = memnew(ToolButton); zoom_hb->add_child(zoom_plus); zoom_plus->set_tooltip(RTR("Zoom In")); - zoom_plus->connect("pressed", this, "_zoom_plus"); + zoom_plus->connect_compat("pressed", this, "_zoom_plus"); zoom_plus->set_focus_mode(FOCUS_NONE); snap_button = memnew(ToolButton); snap_button->set_toggle_mode(true); snap_button->set_tooltip(RTR("Enable snap and show grid.")); - snap_button->connect("pressed", this, "_snap_toggled"); + snap_button->connect_compat("pressed", this, "_snap_toggled"); snap_button->set_pressed(true); snap_button->set_focus_mode(FOCUS_NONE); zoom_hb->add_child(snap_button); @@ -1413,7 +1413,7 @@ GraphEdit::GraphEdit() { snap_amount->set_max(100); snap_amount->set_step(1); snap_amount->set_value(20); - snap_amount->connect("value_changed", this, "_snap_value_changed"); + snap_amount->connect_compat("value_changed", this, "_snap_value_changed"); zoom_hb->add_child(snap_amount); setting_scroll_ofs = false; diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index cf798f36e4..85e7af0783 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -1599,7 +1599,7 @@ ItemList::ItemList() { add_child(scroll_bar); shape_changed = true; - scroll_bar->connect("value_changed", this, "_scroll_changed"); + scroll_bar->connect_compat("value_changed", this, "_scroll_changed"); set_focus_mode(FOCUS_ALL); current_columns = 1; diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 3f4fd37c08..86fe6d7630 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -648,8 +648,8 @@ void LineEdit::_notification(int p_what) { cursor_set_blink_enabled(EDITOR_DEF("text_editor/cursor/caret_blink", false)); cursor_set_blink_speed(EDITOR_DEF("text_editor/cursor/caret_blink_speed", 0.65)); - if (!EditorSettings::get_singleton()->is_connected("settings_changed", this, "_editor_settings_changed")) { - EditorSettings::get_singleton()->connect("settings_changed", this, "_editor_settings_changed"); + if (!EditorSettings::get_singleton()->is_connected_compat("settings_changed", this, "_editor_settings_changed")) { + EditorSettings::get_singleton()->connect_compat("settings_changed", this, "_editor_settings_changed"); } } } break; @@ -1870,7 +1870,7 @@ LineEdit::LineEdit() { caret_blink_timer = memnew(Timer); add_child(caret_blink_timer); caret_blink_timer->set_wait_time(0.65); - caret_blink_timer->connect("timeout", this, "_toggle_draw_caret"); + caret_blink_timer->connect_compat("timeout", this, "_toggle_draw_caret"); cursor_set_blink_enabled(false); context_menu_enabled = true; @@ -1878,7 +1878,7 @@ LineEdit::LineEdit() { add_child(menu); editable = false; // Initialise to opposite first, so we get past the early-out in set_editable. set_editable(true); - menu->connect("id_pressed", this, "menu_option"); + menu->connect_compat("id_pressed", this, "menu_option"); expand_to_text_length = false; } diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index 6e348054e2..a211ee02ed 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -137,8 +137,8 @@ MenuButton::MenuButton() { popup->hide(); add_child(popup); popup->set_pass_on_modal_close_click(false); - popup->connect("about_to_show", this, "set_pressed", varray(true)); // For when switching from another MenuButton. - popup->connect("popup_hide", this, "set_pressed", varray(false)); + popup->connect_compat("about_to_show", this, "set_pressed", varray(true)); // For when switching from another MenuButton. + popup->connect_compat("popup_hide", this, "set_pressed", varray(false)); } MenuButton::~MenuButton() { diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index 6f656025e6..6488d6ce0a 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -363,9 +363,9 @@ OptionButton::OptionButton() { popup->set_pass_on_modal_close_click(false); popup->set_notify_transform(true); popup->set_allow_search(true); - popup->connect("index_pressed", this, "_selected"); - popup->connect("id_focused", this, "_focused"); - popup->connect("popup_hide", this, "set_pressed", varray(false)); + popup->connect_compat("index_pressed", this, "_selected"); + popup->connect_compat("id_focused", this, "_focused"); + popup->connect_compat("popup_hide", this, "set_pressed", varray(false)); } OptionButton::~OptionButton() { diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index b494506c6c..2416931dae 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -1233,7 +1233,7 @@ void PopupMenu::_ref_shortcut(Ref<ShortCut> p_sc) { if (!shortcut_refcount.has(p_sc)) { shortcut_refcount[p_sc] = 1; - p_sc->connect("changed", this, "update"); + p_sc->connect_compat("changed", this, "update"); } else { shortcut_refcount[p_sc] += 1; } @@ -1244,7 +1244,7 @@ void PopupMenu::_unref_shortcut(Ref<ShortCut> p_sc) { ERR_FAIL_COND(!shortcut_refcount.has(p_sc)); shortcut_refcount[p_sc]--; if (shortcut_refcount[p_sc] == 0) { - p_sc->disconnect("changed", this, "update"); + p_sc->disconnect_compat("changed", this, "update"); shortcut_refcount.erase(p_sc); } } @@ -1514,7 +1514,7 @@ PopupMenu::PopupMenu() { submenu_timer = memnew(Timer); submenu_timer->set_wait_time(0.3); submenu_timer->set_one_shot(true); - submenu_timer->connect("timeout", this, "_submenu_timeout"); + submenu_timer->connect_compat("timeout", this, "_submenu_timeout"); add_child(submenu_timer); } diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index b39a1aff70..3727860321 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -2963,7 +2963,7 @@ RichTextLabel::RichTextLabel() { vscroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 0); vscroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0); vscroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0); - vscroll->connect("value_changed", this, "_scroll_changed"); + vscroll->connect_compat("value_changed", this, "_scroll_changed"); vscroll->set_step(1); vscroll->hide(); current_idx = 1; diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp index 8e6d0843a7..4a27ea23ce 100644 --- a/scene/gui/scroll_bar.cpp +++ b/scene/gui/scroll_bar.cpp @@ -296,15 +296,15 @@ void ScrollBar::_notification(int p_what) { } if (drag_node) { - drag_node->connect("gui_input", this, "_drag_node_input"); - drag_node->connect("tree_exiting", this, "_drag_node_exit", varray(), CONNECT_ONESHOT); + drag_node->connect_compat("gui_input", this, "_drag_node_input"); + drag_node->connect_compat("tree_exiting", this, "_drag_node_exit", varray(), CONNECT_ONESHOT); } } if (p_what == NOTIFICATION_EXIT_TREE) { if (drag_node) { - drag_node->disconnect("gui_input", this, "_drag_node_input"); - drag_node->disconnect("tree_exiting", this, "_drag_node_exit"); + drag_node->disconnect_compat("gui_input", this, "_drag_node_input"); + drag_node->disconnect_compat("tree_exiting", this, "_drag_node_exit"); } drag_node = NULL; @@ -539,7 +539,7 @@ float ScrollBar::get_custom_step() const { void ScrollBar::_drag_node_exit() { if (drag_node) { - drag_node->disconnect("gui_input", this, "_drag_node_input"); + drag_node->disconnect_compat("gui_input", this, "_drag_node_input"); } drag_node = NULL; } @@ -611,8 +611,8 @@ void ScrollBar::set_drag_node(const NodePath &p_path) { if (is_inside_tree()) { if (drag_node) { - drag_node->disconnect("gui_input", this, "_drag_node_input"); - drag_node->disconnect("tree_exiting", this, "_drag_node_exit"); + drag_node->disconnect_compat("gui_input", this, "_drag_node_input"); + drag_node->disconnect_compat("tree_exiting", this, "_drag_node_exit"); } } @@ -627,8 +627,8 @@ void ScrollBar::set_drag_node(const NodePath &p_path) { } if (drag_node) { - drag_node->connect("gui_input", this, "_drag_node_input"); - drag_node->connect("tree_exiting", this, "_drag_node_exit", varray(), CONNECT_ONESHOT); + drag_node->connect_compat("gui_input", this, "_drag_node_input"); + drag_node->connect_compat("tree_exiting", this, "_drag_node_exit", varray(), CONNECT_ONESHOT); } } } diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index 509e6d19f6..5829a86a42 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -267,7 +267,7 @@ void ScrollContainer::_notification(int p_what) { if (p_what == NOTIFICATION_READY) { - get_viewport()->connect("gui_focus_changed", this, "_ensure_focused_visible"); + get_viewport()->connect_compat("gui_focus_changed", this, "_ensure_focused_visible"); } if (p_what == NOTIFICATION_SORT_CHILDREN) { @@ -610,12 +610,12 @@ ScrollContainer::ScrollContainer() { h_scroll = memnew(HScrollBar); h_scroll->set_name("_h_scroll"); add_child(h_scroll); - h_scroll->connect("value_changed", this, "_scroll_moved"); + h_scroll->connect_compat("value_changed", this, "_scroll_moved"); v_scroll = memnew(VScrollBar); v_scroll->set_name("_v_scroll"); add_child(v_scroll); - v_scroll->connect("value_changed", this, "_scroll_moved"); + v_scroll->connect_compat("value_changed", this, "_scroll_moved"); drag_speed = Vector2(); drag_touching = false; diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp index c49d7f3d12..1200877127 100644 --- a/scene/gui/spin_box.cpp +++ b/scene/gui/spin_box.cpp @@ -297,12 +297,12 @@ SpinBox::SpinBox() { line_edit->set_anchors_and_margins_preset(Control::PRESET_WIDE); line_edit->set_mouse_filter(MOUSE_FILTER_PASS); //connect("value_changed",this,"_value_changed"); - line_edit->connect("text_entered", this, "_text_entered", Vector<Variant>(), CONNECT_DEFERRED); - line_edit->connect("focus_exited", this, "_line_edit_focus_exit", Vector<Variant>(), CONNECT_DEFERRED); - line_edit->connect("gui_input", this, "_line_edit_input"); + line_edit->connect_compat("text_entered", this, "_text_entered", Vector<Variant>(), CONNECT_DEFERRED); + line_edit->connect_compat("focus_exited", this, "_line_edit_focus_exit", Vector<Variant>(), CONNECT_DEFERRED); + line_edit->connect_compat("gui_input", this, "_line_edit_input"); drag.enabled = false; range_click_timer = memnew(Timer); - range_click_timer->connect("timeout", this, "_range_click_timeout"); + range_click_timer->connect_compat("timeout", this, "_range_click_timeout"); add_child(range_click_timer); } diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 402623e53d..66ecbea378 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -537,7 +537,7 @@ void TabContainer::add_child_notify(Node *p_child) { c->set_margin(Margin(MARGIN_BOTTOM), c->get_margin(Margin(MARGIN_BOTTOM)) - sb->get_margin(Margin(MARGIN_BOTTOM))); update(); - p_child->connect("renamed", this, "_child_renamed_callback"); + p_child->connect_compat("renamed", this, "_child_renamed_callback"); if (first) emit_signal("tab_changed", current); } @@ -620,7 +620,7 @@ void TabContainer::remove_child_notify(Node *p_child) { call_deferred("_update_current_tab"); - p_child->disconnect("renamed", this, "_child_renamed_callback"); + p_child->disconnect_compat("renamed", this, "_child_renamed_callback"); update(); } @@ -1048,5 +1048,5 @@ TabContainer::TabContainer() { tabs_rearrange_group = -1; use_hidden_tabs_for_min_size = false; - connect("mouse_exited", this, "_on_mouse_exited"); + connect_compat("mouse_exited", this, "_on_mouse_exited"); } diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp index 4aa7ea8cb1..ea1e6546e9 100644 --- a/scene/gui/tabs.cpp +++ b/scene/gui/tabs.cpp @@ -1034,5 +1034,5 @@ Tabs::Tabs() { drag_to_rearrange_enabled = false; tabs_rearrange_group = -1; - connect("mouse_exited", this, "_on_mouse_exited"); + connect_compat("mouse_exited", this, "_on_mouse_exited"); } diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index ae169e3dcd..313b82035c 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -7223,10 +7223,10 @@ TextEdit::TextEdit() { updating_scrolls = false; selection.active = false; - h_scroll->connect("value_changed", this, "_scroll_moved"); - v_scroll->connect("value_changed", this, "_scroll_moved"); + h_scroll->connect_compat("value_changed", this, "_scroll_moved"); + v_scroll->connect_compat("value_changed", this, "_scroll_moved"); - v_scroll->connect("scrolling", this, "_v_scroll_input"); + v_scroll->connect_compat("scrolling", this, "_v_scroll_input"); cursor_changed_dirty = false; text_changed_dirty = false; @@ -7243,7 +7243,7 @@ TextEdit::TextEdit() { caret_blink_timer = memnew(Timer); add_child(caret_blink_timer); caret_blink_timer->set_wait_time(0.65); - caret_blink_timer->connect("timeout", this, "_toggle_draw_caret"); + caret_blink_timer->connect_compat("timeout", this, "_toggle_draw_caret"); cursor_set_blink_enabled(false); right_click_moves_caret = true; @@ -7251,12 +7251,12 @@ TextEdit::TextEdit() { add_child(idle_detect); idle_detect->set_one_shot(true); idle_detect->set_wait_time(GLOBAL_GET("gui/timers/text_edit_idle_detect_sec")); - idle_detect->connect("timeout", this, "_push_current_op"); + idle_detect->connect_compat("timeout", this, "_push_current_op"); click_select_held = memnew(Timer); add_child(click_select_held); click_select_held->set_wait_time(0.05); - click_select_held->connect("timeout", this, "_click_selection_held"); + click_select_held->connect_compat("timeout", this, "_click_selection_held"); current_op.type = TextOperation::TYPE_NONE; undo_enabled = true; @@ -7314,7 +7314,7 @@ TextEdit::TextEdit() { add_child(menu); readonly = true; // Initialise to opposite first, so we get past the early-out in set_readonly. set_readonly(false); - menu->connect("id_pressed", this, "menu_option"); + menu->connect_compat("id_pressed", this, "menu_option"); first_draw = true; executing_line = -1; diff --git a/scene/gui/texture_rect.cpp b/scene/gui/texture_rect.cpp index 64693e2531..87442f32e8 100644 --- a/scene/gui/texture_rect.cpp +++ b/scene/gui/texture_rect.cpp @@ -160,13 +160,13 @@ void TextureRect::set_texture(const Ref<Texture2D> &p_tex) { } if (texture.is_valid()) { - texture->disconnect(CoreStringNames::get_singleton()->changed, this, "_texture_changed"); + texture->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_texture_changed"); } texture = p_tex; if (texture.is_valid()) { - texture->connect(CoreStringNames::get_singleton()->changed, this, "_texture_changed"); + texture->connect_compat(CoreStringNames::get_singleton()->changed, this, "_texture_changed"); } update(); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 08835be9fd..d9ca940177 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -729,16 +729,16 @@ bool TreeItem::is_folding_disabled() const { return disable_folding; } -Variant TreeItem::_call_recursive_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant TreeItem::_call_recursive_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { if (p_argcount < 1) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; r_error.argument = 0; return Variant(); } if (p_args[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.expected = Variant::STRING; return Variant(); @@ -750,7 +750,7 @@ Variant TreeItem::_call_recursive_bind(const Variant **p_args, int p_argcount, V return Variant(); } -void recursive_call_aux(TreeItem *p_item, const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +void recursive_call_aux(TreeItem *p_item, const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { if (!p_item) { return; } @@ -762,7 +762,7 @@ void recursive_call_aux(TreeItem *p_item, const StringName &p_method, const Vari } } -void TreeItem::call_recursive(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +void TreeItem::call_recursive(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { recursive_call_aux(this, p_method, p_args, p_argcount, r_error); } @@ -4043,15 +4043,15 @@ Tree::Tree() { add_child(v_scroll); range_click_timer = memnew(Timer); - range_click_timer->connect("timeout", this, "_range_click_timeout"); + range_click_timer->connect_compat("timeout", this, "_range_click_timeout"); add_child(range_click_timer); - h_scroll->connect("value_changed", this, "_scroll_moved"); - v_scroll->connect("value_changed", this, "_scroll_moved"); - text_editor->connect("text_entered", this, "_text_editor_enter"); - text_editor->connect("modal_closed", this, "_text_editor_modal_close"); - popup_menu->connect("id_pressed", this, "_popup_select"); - value_editor->connect("value_changed", this, "_value_editor_changed"); + h_scroll->connect_compat("value_changed", this, "_scroll_moved"); + v_scroll->connect_compat("value_changed", this, "_scroll_moved"); + text_editor->connect_compat("text_entered", this, "_text_editor_enter"); + text_editor->connect_compat("modal_closed", this, "_text_editor_modal_close"); + popup_menu->connect_compat("id_pressed", this, "_popup_select"); + value_editor->connect_compat("value_changed", this, "_value_editor_changed"); value_editor->set_as_toplevel(true); text_editor->set_as_toplevel(true); diff --git a/scene/gui/tree.h b/scene/gui/tree.h index b58f937c57..b179c5bcba 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -172,7 +172,7 @@ protected: remove_child(Object::cast_to<TreeItem>(p_child)); } - Variant _call_recursive_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error); + Variant _call_recursive_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error); public: /* cell mode */ @@ -282,7 +282,7 @@ public: void set_disable_folding(bool p_disable); bool is_folding_disabled() const; - void call_recursive(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error); + void call_recursive(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error); ~TreeItem(); }; diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp index c4fb3335dc..85bde92851 100644 --- a/scene/main/http_request.cpp +++ b/scene/main/http_request.cpp @@ -589,7 +589,7 @@ HTTPRequest::HTTPRequest() { timer = memnew(Timer); timer->set_one_shot(true); - timer->connect("timeout", this, "_timeout"); + timer->connect_compat("timeout", this, "_timeout"); add_child(timer); timeout = 0; } diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 8ceac74bb8..2c15ac6aae 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -592,16 +592,16 @@ void Node::rpc_unreliable_id(int p_peer_id, const StringName &p_method, VARIANT_ rpcp(p_peer_id, true, p_method, argptr, argc); } -Variant Node::_rpc_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant Node::_rpc_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { if (p_argcount < 1) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; r_error.argument = 1; return Variant(); } if (p_args[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.expected = Variant::STRING; return Variant(); @@ -611,27 +611,27 @@ Variant Node::_rpc_bind(const Variant **p_args, int p_argcount, Variant::CallErr rpcp(0, false, method, &p_args[1], p_argcount - 1); - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; return Variant(); } -Variant Node::_rpc_id_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant Node::_rpc_id_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { if (p_argcount < 2) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; r_error.argument = 2; return Variant(); } if (p_args[0]->get_type() != Variant::INT) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; r_error.expected = Variant::INT; return Variant(); } if (p_args[1]->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 = 1; r_error.expected = Variant::STRING; return Variant(); @@ -642,20 +642,20 @@ Variant Node::_rpc_id_bind(const Variant **p_args, int p_argcount, Variant::Call rpcp(peer_id, false, method, &p_args[2], p_argcount - 2); - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; return Variant(); } -Variant Node::_rpc_unreliable_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant Node::_rpc_unreliable_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { if (p_argcount < 1) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; r_error.argument = 1; return Variant(); } if (p_args[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.expected = Variant::STRING; return Variant(); @@ -665,27 +665,27 @@ Variant Node::_rpc_unreliable_bind(const Variant **p_args, int p_argcount, Varia rpcp(0, true, method, &p_args[1], p_argcount - 1); - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; return Variant(); } -Variant Node::_rpc_unreliable_id_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant Node::_rpc_unreliable_id_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { if (p_argcount < 2) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; r_error.argument = 2; return Variant(); } if (p_args[0]->get_type() != Variant::INT) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; r_error.expected = Variant::INT; return Variant(); } if (p_args[1]->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 = 1; r_error.expected = Variant::STRING; return Variant(); @@ -696,7 +696,7 @@ Variant Node::_rpc_unreliable_id_bind(const Variant **p_args, int p_argcount, Va rpcp(peer_id, true, method, &p_args[2], p_argcount - 2); - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; return Variant(); } @@ -2360,7 +2360,7 @@ void Node::_duplicate_signals(const Node *p_original, Node *p_copy) const { NodePath p = p_original->get_path_to(this); Node *copy = p_copy->get_node(p); - Node *target = Object::cast_to<Node>(E->get().target); + Node *target = Object::cast_to<Node>(E->get().callable.get_object()); if (!target) { continue; } @@ -2375,8 +2375,8 @@ void Node::_duplicate_signals(const Node *p_original, Node *p_copy) const { if (p_copy->has_node(ptarget)) copytarget = p_copy->get_node(ptarget); - if (copy && copytarget && !copy->is_connected(E->get().signal, copytarget, E->get().method)) { - copy->connect(E->get().signal, copytarget, E->get().method, E->get().binds, E->get().flags); + if (copy && copytarget && !copy->is_connected_compat(E->get().signal.get_name(), copytarget, E->get().callable.get_method())) { + copy->connect_compat(E->get().signal.get_name(), copytarget, E->get().callable.get_method(), E->get().binds, E->get().flags); } } } @@ -2531,10 +2531,10 @@ void Node::_replace_connections_target(Node *p_new_target) { Connection &c = E->get(); if (c.flags & CONNECT_PERSIST) { - c.source->disconnect(c.signal, this, c.method); - bool valid = p_new_target->has_method(c.method) || Ref<Script>(p_new_target->get_script()).is_null() || Ref<Script>(p_new_target->get_script())->has_method(c.method); - ERR_CONTINUE_MSG(!valid, "Attempt to connect signal '" + c.source->get_class() + "." + c.signal + "' to nonexistent method '" + c.target->get_class() + "." + c.method + "'."); - c.source->connect(c.signal, p_new_target, c.method, c.binds, c.flags); + c.signal.get_object()->disconnect_compat(c.signal.get_name(), this, c.callable.get_method()); + bool valid = p_new_target->has_method(c.callable.get_method()) || Ref<Script>(p_new_target->get_script()).is_null() || Ref<Script>(p_new_target->get_script())->has_method(c.callable.get_method()); + ERR_CONTINUE_MSG(!valid, "Attempt to connect signal '" + c.signal.get_object()->get_class() + "." + c.signal.get_name() + "' to nonexistent method '" + c.callable.get_object()->get_class() + "." + c.callable.get_method() + "'."); + c.signal.get_object()->connect_compat(c.signal.get_name(), p_new_target, c.callable.get_method(), c.binds, c.flags); } } } diff --git a/scene/main/node.h b/scene/main/node.h index 02c828e8ff..d1f75b71ec 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -185,10 +185,10 @@ private: Array _get_children() const; Array _get_groups() const; - Variant _rpc_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error); - Variant _rpc_unreliable_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error); - Variant _rpc_id_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error); - Variant _rpc_unreliable_id_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error); + Variant _rpc_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error); + Variant _rpc_unreliable_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error); + Variant _rpc_id_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error); + Variant _rpc_unreliable_id_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error); friend class SceneTree; diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 2a0825252d..f558670693 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -87,7 +87,7 @@ void SceneTreeTimer::release_connections() { for (List<Connection>::Element *E = connections.front(); E; E = E->next()) { Connection const &connection = E->get(); - disconnect(connection.signal, connection.target, connection.method); + disconnect_compat(connection.signal.get_name(), connection.callable.get_object(), connection.callable.get_method()); } } @@ -1004,9 +1004,9 @@ void SceneMainLoop::_update_listener_2d() { } */ -Variant SceneTree::_call_group_flags(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant SceneTree::_call_group_flags(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; ERR_FAIL_COND_V(p_argcount < 3, Variant()); ERR_FAIL_COND_V(!p_args[0]->is_num(), Variant()); @@ -1027,9 +1027,9 @@ Variant SceneTree::_call_group_flags(const Variant **p_args, int p_argcount, Var return Variant(); } -Variant SceneTree::_call_group(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant SceneTree::_call_group(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; ERR_FAIL_COND_V(p_argcount < 2, Variant()); ERR_FAIL_COND_V(p_args[0]->get_type() != Variant::STRING, Variant()); @@ -1766,21 +1766,21 @@ void SceneTree::set_multiplayer(Ref<MultiplayerAPI> p_multiplayer) { ERR_FAIL_COND(!p_multiplayer.is_valid()); if (multiplayer.is_valid()) { - multiplayer->disconnect("network_peer_connected", this, "_network_peer_connected"); - multiplayer->disconnect("network_peer_disconnected", this, "_network_peer_disconnected"); - multiplayer->disconnect("connected_to_server", this, "_connected_to_server"); - multiplayer->disconnect("connection_failed", this, "_connection_failed"); - multiplayer->disconnect("server_disconnected", this, "_server_disconnected"); + multiplayer->disconnect_compat("network_peer_connected", this, "_network_peer_connected"); + multiplayer->disconnect_compat("network_peer_disconnected", this, "_network_peer_disconnected"); + multiplayer->disconnect_compat("connected_to_server", this, "_connected_to_server"); + multiplayer->disconnect_compat("connection_failed", this, "_connection_failed"); + multiplayer->disconnect_compat("server_disconnected", this, "_server_disconnected"); } multiplayer = p_multiplayer; multiplayer->set_root_node(root); - multiplayer->connect("network_peer_connected", this, "_network_peer_connected"); - multiplayer->connect("network_peer_disconnected", this, "_network_peer_disconnected"); - multiplayer->connect("connected_to_server", this, "_connected_to_server"); - multiplayer->connect("connection_failed", this, "_connection_failed"); - multiplayer->connect("server_disconnected", this, "_server_disconnected"); + multiplayer->connect_compat("network_peer_connected", this, "_network_peer_connected"); + multiplayer->connect_compat("network_peer_disconnected", this, "_network_peer_disconnected"); + multiplayer->connect_compat("connected_to_server", this, "_connected_to_server"); + multiplayer->connect_compat("connection_failed", this, "_connection_failed"); + multiplayer->connect_compat("server_disconnected", this, "_server_disconnected"); } void SceneTree::set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_network_peer) { diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h index 565c58fac1..80f0da66e2 100644 --- a/scene/main/scene_tree.h +++ b/scene/main/scene_tree.h @@ -208,8 +208,8 @@ private: void _notify_group_pause(const StringName &p_group, int p_notification); void _call_input_pause(const StringName &p_group, const StringName &p_method, const Ref<InputEvent> &p_input); - Variant _call_group_flags(const Variant **p_args, int p_argcount, Variant::CallError &r_error); - Variant _call_group(const Variant **p_args, int p_argcount, Variant::CallError &r_error); + Variant _call_group_flags(const Variant **p_args, int p_argcount, Callable::CallError &r_error); + Variant _call_group(const Variant **p_args, int p_argcount, Callable::CallError &r_error); void _flush_delete_queue(); //optimization diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index d9be77954b..d39bbed55b 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1124,7 +1124,7 @@ void Viewport::set_world(const Ref<World> &p_world) { _propagate_exit_world(this); if (own_world.is_valid() && world.is_valid()) { - world->disconnect(CoreStringNames::get_singleton()->changed, this, "_own_world_changed"); + world->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_own_world_changed"); } world = p_world; @@ -1132,7 +1132,7 @@ void Viewport::set_world(const Ref<World> &p_world) { if (own_world.is_valid()) { if (world.is_valid()) { own_world = world->duplicate(); - world->connect(CoreStringNames::get_singleton()->changed, this, "_own_world_changed"); + world->connect_compat(CoreStringNames::get_singleton()->changed, this, "_own_world_changed"); } else { own_world = Ref<World>(memnew(World)); } @@ -2473,7 +2473,7 @@ List<Control *>::Element *Viewport::_gui_add_root_control(Control *p_control) { List<Control *>::Element *Viewport::_gui_add_subwindow_control(Control *p_control) { - p_control->connect("visibility_changed", this, "_subwindow_visibility_changed"); + p_control->connect_compat("visibility_changed", this, "_subwindow_visibility_changed"); if (p_control->is_visible_in_tree()) { gui.subwindow_order_dirty = true; @@ -2568,7 +2568,7 @@ void Viewport::_gui_remove_subwindow_control(List<Control *>::Element *SI) { Control *control = SI->get(); - control->disconnect("visibility_changed", this, "_subwindow_visibility_changed"); + control->disconnect_compat("visibility_changed", this, "_subwindow_visibility_changed"); List<Control *>::Element *E = gui.subwindows.find(control); if (E) @@ -2850,12 +2850,12 @@ void Viewport::set_use_own_world(bool p_world) { if (!p_world) { own_world = Ref<World>(); if (world.is_valid()) { - world->disconnect(CoreStringNames::get_singleton()->changed, this, "_own_world_changed"); + world->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_own_world_changed"); } } else { if (world.is_valid()) { own_world = world->duplicate(); - world->connect(CoreStringNames::get_singleton()->changed, this, "_own_world_changed"); + world->connect_compat(CoreStringNames::get_singleton()->changed, this, "_own_world_changed"); } else { own_world = Ref<World>(memnew(World)); } diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 341a63e9e0..246b372eb0 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -197,7 +197,7 @@ void ShaderMaterial::set_shader(const Ref<Shader> &p_shader) { // This can be a slow operation, and `_change_notify()` (which is called by `_shader_changed()`) // does nothing in non-editor builds anyway. See GH-34741 for details. if (shader.is_valid() && Engine::get_singleton()->is_editor_hint()) { - shader->disconnect("changed", this, "_shader_changed"); + shader->disconnect_compat("changed", this, "_shader_changed"); } shader = p_shader; @@ -207,7 +207,7 @@ void ShaderMaterial::set_shader(const Ref<Shader> &p_shader) { rid = shader->get_rid(); if (Engine::get_singleton()->is_editor_hint()) { - shader->connect("changed", this, "_shader_changed"); + shader->connect_compat("changed", this, "_shader_changed"); } } diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index c018ab2029..910f61b956 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -331,7 +331,7 @@ Node *SceneState::instance(GenEditState p_edit_state) const { binds.write[j] = props[c.binds[j]]; } - cfrom->connect(snames[c.signal], cto, snames[c.method], binds, CONNECT_PERSIST | c.flags); + cfrom->connect_compat(snames[c.signal], cto, snames[c.method], binds, CONNECT_PERSIST | c.flags); } //Node *s = ret_nodes[0]; @@ -702,7 +702,7 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, Map<StringName // only connections that originate or end into main saved scene are saved // everything else is discarded - Node *target = Object::cast_to<Node>(c.target); + Node *target = Object::cast_to<Node>(c.callable.get_object()); if (!target) { continue; @@ -734,7 +734,7 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, Map<StringName NodePath signal_from = common_parent->get_path_to(p_node); NodePath signal_to = common_parent->get_path_to(target); - if (ps->has_connection(signal_from, c.signal, signal_to, c.method)) { + if (ps->has_connection(signal_from, c.signal.get_name(), signal_to, c.callable.get_method())) { exists = true; break; } @@ -766,7 +766,7 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, Map<StringName if (from_node >= 0 && to_node >= 0) { //this one has state for this node, save - if (state->is_connection(from_node, c.signal, to_node, c.method)) { + if (state->is_connection(from_node, c.signal.get_name(), to_node, c.callable.get_method())) { exists2 = true; break; } @@ -784,7 +784,7 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, Map<StringName if (from_node >= 0 && to_node >= 0) { //this one has state for this node, save - if (state->is_connection(from_node, c.signal, to_node, c.method)) { + if (state->is_connection(from_node, c.signal.get_name(), to_node, c.callable.get_method())) { exists2 = true; break; } @@ -831,8 +831,8 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, Map<StringName ConnectionData cd; cd.from = src_id; cd.to = target_id; - cd.method = _nm_get_string(c.method, name_map); - cd.signal = _nm_get_string(c.signal, name_map); + cd.method = _nm_get_string(c.callable.get_method(), name_map); + cd.signal = _nm_get_string(c.signal.get_name(), name_map); cd.flags = c.flags; for (int i = 0; i < c.binds.size(); i++) { diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 7fb3ba5155..160061ed05 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -1409,11 +1409,11 @@ void CurveTexture::ensure_default_setup(float p_min, float p_max) { void CurveTexture::set_curve(Ref<Curve> p_curve) { if (_curve != p_curve) { if (_curve.is_valid()) { - _curve->disconnect(CoreStringNames::get_singleton()->changed, this, "_update"); + _curve->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_update"); } _curve = p_curve; if (_curve.is_valid()) { - _curve->connect(CoreStringNames::get_singleton()->changed, this, "_update"); + _curve->connect_compat(CoreStringNames::get_singleton()->changed, this, "_update"); } _update(); } @@ -1514,11 +1514,11 @@ void GradientTexture::set_gradient(Ref<Gradient> p_gradient) { if (p_gradient == gradient) return; if (gradient.is_valid()) { - gradient->disconnect(CoreStringNames::get_singleton()->changed, this, "_update"); + gradient->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_update"); } gradient = p_gradient; if (gradient.is_valid()) { - gradient->connect(CoreStringNames::get_singleton()->changed, this, "_update"); + gradient->connect_compat(CoreStringNames::get_singleton()->changed, this, "_update"); } _update(); emit_changed(); @@ -1867,7 +1867,7 @@ AnimatedTexture::AnimatedTexture() { fps = 4; prev_ticks = 0; current_frame = 0; - VisualServer::get_singleton()->connect("frame_pre_draw", this, "_update_proxy"); + VisualServer::get_singleton()->connect_compat("frame_pre_draw", this, "_update_proxy"); #ifndef NO_THREADS rw_lock = RWLock::create(); diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index aa05e41b16..5db521bc20 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -302,13 +302,13 @@ void Theme::set_default_theme_font(const Ref<Font> &p_default_font) { return; if (default_theme_font.is_valid()) { - default_theme_font->disconnect("changed", this, "_emit_theme_changed"); + default_theme_font->disconnect_compat("changed", this, "_emit_theme_changed"); } default_theme_font = p_default_font; if (default_theme_font.is_valid()) { - default_theme_font->connect("changed", this, "_emit_theme_changed", varray(), CONNECT_REFERENCE_COUNTED); + default_theme_font->connect_compat("changed", this, "_emit_theme_changed", varray(), CONNECT_REFERENCE_COUNTED); } _change_notify(); @@ -366,13 +366,13 @@ void Theme::set_icon(const StringName &p_name, const StringName &p_type, const R bool new_value = !icon_map.has(p_type) || !icon_map[p_type].has(p_name); if (icon_map[p_type].has(p_name) && icon_map[p_type][p_name].is_valid()) { - icon_map[p_type][p_name]->disconnect("changed", this, "_emit_theme_changed"); + icon_map[p_type][p_name]->disconnect_compat("changed", this, "_emit_theme_changed"); } icon_map[p_type][p_name] = p_icon; if (p_icon.is_valid()) { - icon_map[p_type][p_name]->connect("changed", this, "_emit_theme_changed", varray(), CONNECT_REFERENCE_COUNTED); + icon_map[p_type][p_name]->connect_compat("changed", this, "_emit_theme_changed", varray(), CONNECT_REFERENCE_COUNTED); } if (new_value) { @@ -401,7 +401,7 @@ void Theme::clear_icon(const StringName &p_name, const StringName &p_type) { ERR_FAIL_COND(!icon_map[p_type].has(p_name)); if (icon_map[p_type][p_name].is_valid()) { - icon_map[p_type][p_name]->disconnect("changed", this, "_emit_theme_changed"); + icon_map[p_type][p_name]->disconnect_compat("changed", this, "_emit_theme_changed"); } icon_map[p_type].erase(p_name); @@ -479,13 +479,13 @@ void Theme::set_stylebox(const StringName &p_name, const StringName &p_type, con bool new_value = !style_map.has(p_type) || !style_map[p_type].has(p_name); if (style_map[p_type].has(p_name) && style_map[p_type][p_name].is_valid()) { - style_map[p_type][p_name]->disconnect("changed", this, "_emit_theme_changed"); + style_map[p_type][p_name]->disconnect_compat("changed", this, "_emit_theme_changed"); } style_map[p_type][p_name] = p_style; if (p_style.is_valid()) { - style_map[p_type][p_name]->connect("changed", this, "_emit_theme_changed", varray(), CONNECT_REFERENCE_COUNTED); + style_map[p_type][p_name]->connect_compat("changed", this, "_emit_theme_changed", varray(), CONNECT_REFERENCE_COUNTED); } if (new_value) @@ -514,7 +514,7 @@ void Theme::clear_stylebox(const StringName &p_name, const StringName &p_type) { ERR_FAIL_COND(!style_map[p_type].has(p_name)); if (style_map[p_type][p_name].is_valid()) { - style_map[p_type][p_name]->disconnect("changed", this, "_emit_theme_changed"); + style_map[p_type][p_name]->disconnect_compat("changed", this, "_emit_theme_changed"); } style_map[p_type].erase(p_name); @@ -554,13 +554,13 @@ void Theme::set_font(const StringName &p_name, const StringName &p_type, const R bool new_value = !font_map.has(p_type) || !font_map[p_type].has(p_name); if (font_map[p_type][p_name].is_valid()) { - font_map[p_type][p_name]->disconnect("changed", this, "_emit_theme_changed"); + font_map[p_type][p_name]->disconnect_compat("changed", this, "_emit_theme_changed"); } font_map[p_type][p_name] = p_font; if (p_font.is_valid()) { - font_map[p_type][p_name]->connect("changed", this, "_emit_theme_changed", varray(), CONNECT_REFERENCE_COUNTED); + font_map[p_type][p_name]->connect_compat("changed", this, "_emit_theme_changed", varray(), CONNECT_REFERENCE_COUNTED); } if (new_value) { @@ -589,7 +589,7 @@ void Theme::clear_font(const StringName &p_name, const StringName &p_type) { ERR_FAIL_COND(!font_map[p_type].has(p_name)); if (font_map[p_type][p_name].is_valid()) { - font_map[p_type][p_name]->disconnect("changed", this, "_emit_theme_changed"); + font_map[p_type][p_name]->disconnect_compat("changed", this, "_emit_theme_changed"); } font_map[p_type].erase(p_name); @@ -722,7 +722,7 @@ void Theme::clear() { while ((L = icon_map[*K].next(L))) { Ref<Texture2D> icon = icon_map[*K][*L]; if (icon.is_valid()) { - icon->disconnect("changed", this, "_emit_theme_changed"); + icon->disconnect_compat("changed", this, "_emit_theme_changed"); } } } @@ -735,7 +735,7 @@ void Theme::clear() { while ((L = style_map[*K].next(L))) { Ref<StyleBox> style = style_map[*K][*L]; if (style.is_valid()) { - style->disconnect("changed", this, "_emit_theme_changed"); + style->disconnect_compat("changed", this, "_emit_theme_changed"); } } } @@ -748,7 +748,7 @@ void Theme::clear() { while ((L = font_map[*K].next(L))) { Ref<Font> font = font_map[*K][*L]; if (font.is_valid()) { - font->disconnect("changed", this, "_emit_theme_changed"); + font->disconnect_compat("changed", this, "_emit_theme_changed"); } } } diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index 38b7c5cda0..3f31dc13f8 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -305,10 +305,10 @@ void VisualShader::add_node(Type p_type, const Ref<VisualShaderNode> &p_node, co if (input.is_valid()) { input->shader_mode = shader_mode; input->shader_type = p_type; - input->connect("input_type_changed", this, "_input_type_changed", varray(p_type, p_id)); + input->connect_compat("input_type_changed", this, "_input_type_changed", varray(p_type, p_id)); } - n.node->connect("changed", this, "_queue_update"); + n.node->connect_compat("changed", this, "_queue_update"); Ref<VisualShaderNodeCustom> custom = n.node; if (custom.is_valid()) { @@ -375,10 +375,10 @@ void VisualShader::remove_node(Type p_type, int p_id) { Ref<VisualShaderNodeInput> input = g->nodes[p_id].node; if (input.is_valid()) { - input->disconnect("input_type_changed", this, "_input_type_changed"); + input->disconnect_compat("input_type_changed", this, "_input_type_changed"); } - g->nodes[p_id].node->disconnect("changed", this, "_queue_update"); + g->nodes[p_id].node->disconnect_compat("changed", this, "_queue_update"); g->nodes.erase(p_id); diff --git a/servers/physics/area_sw.cpp b/servers/physics/area_sw.cpp index 1016afcaba..4b54a56253 100644 --- a/servers/physics/area_sw.cpp +++ b/servers/physics/area_sw.cpp @@ -200,7 +200,7 @@ void AreaSW::call_queries() { res[3] = E->key().body_shape; res[4] = E->key().area_shape; - Variant::CallError ce; + Callable::CallError ce; obj->call(monitor_callback_method, (const Variant **)resptr, 5, ce); } } @@ -232,7 +232,7 @@ void AreaSW::call_queries() { res[3] = E->key().body_shape; res[4] = E->key().area_shape; - Variant::CallError ce; + Callable::CallError ce; obj->call(area_monitor_callback_method, (const Variant **)resptr, 5, ce); } } diff --git a/servers/physics/body_sw.cpp b/servers/physics/body_sw.cpp index b71c9772df..8819941f04 100644 --- a/servers/physics/body_sw.cpp +++ b/servers/physics/body_sw.cpp @@ -713,7 +713,7 @@ void BodySW::call_queries() { } else { const Variant *vp[2] = { &v, &fi_callback->udata }; - Variant::CallError ce; + Callable::CallError ce; int argc = (fi_callback->udata.get_type() == Variant::NIL) ? 1 : 2; obj->call(fi_callback->method, vp, argc, ce); } diff --git a/servers/physics_2d/area_2d_sw.cpp b/servers/physics_2d/area_2d_sw.cpp index c67d870b2a..45666d9d09 100644 --- a/servers/physics_2d/area_2d_sw.cpp +++ b/servers/physics_2d/area_2d_sw.cpp @@ -200,7 +200,7 @@ void Area2DSW::call_queries() { res[3] = E->key().body_shape; res[4] = E->key().area_shape; - Variant::CallError ce; + Callable::CallError ce; obj->call(monitor_callback_method, (const Variant **)resptr, 5, ce); } } @@ -232,7 +232,7 @@ void Area2DSW::call_queries() { res[3] = E->key().body_shape; res[4] = E->key().area_shape; - Variant::CallError ce; + Callable::CallError ce; obj->call(area_monitor_callback_method, (const Variant **)resptr, 5, ce); } } diff --git a/servers/physics_2d/body_2d_sw.cpp b/servers/physics_2d/body_2d_sw.cpp index 4de52cacbd..863b422996 100644 --- a/servers/physics_2d/body_2d_sw.cpp +++ b/servers/physics_2d/body_2d_sw.cpp @@ -612,7 +612,7 @@ void Body2DSW::call_queries() { set_force_integration_callback(ObjectID(), StringName()); } else { - Variant::CallError ce; + Callable::CallError ce; if (fi_callback->callback_udata.get_type() != Variant::NIL) { obj->call(fi_callback->method, vp, 2, ce); diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index b27c01cccc..35ec52a5c0 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -120,10 +120,10 @@ void VisualServerRaster::draw(bool p_swap_buffers, double frame_step) { Object *obj = ObjectDB::get_instance(frame_drawn_callbacks.front()->get().object); if (obj) { - Variant::CallError ce; + Callable::CallError ce; const Variant *v = &frame_drawn_callbacks.front()->get().param; obj->call(frame_drawn_callbacks.front()->get().method, &v, 1, ce); - if (ce.error != Variant::CallError::CALL_OK) { + if (ce.error != Callable::CallError::CALL_OK) { String err = Variant::get_call_error_text(obj, frame_drawn_callbacks.front()->get().method, &v, 1, ce); ERR_PRINT("Error calling frame drawn function: " + err); } |