diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/object.cpp | 16 | ||||
-rw-r--r-- | core/script_language.h | 1 | ||||
-rw-r--r-- | core/variant.cpp | 12 | ||||
-rw-r--r-- | core/variant_op.cpp | 4 |
4 files changed, 28 insertions, 5 deletions
diff --git a/core/object.cpp b/core/object.cpp index ea77090a45..3a14c7c0b5 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1443,8 +1443,20 @@ Error Object::connect(const StringName &p_signal, Object *p_to_object, const Str if (!s) { bool signal_is_valid = ClassDB::has_signal(get_class_name(), p_signal); //check in script - if (!signal_is_valid && !script.is_null() && Ref<Script>(script)->has_script_signal(p_signal)) - signal_is_valid = true; + if (!signal_is_valid && !script.is_null()) { + + if (Ref<Script>(script)->has_script_signal(p_signal)) { + signal_is_valid = true; + } +#ifdef TOOLS_ENABLED + else { + //allow connecting signals anyway if script is invalid, see issue #17070 + if (!Ref<Script>(script)->is_valid()) { + signal_is_valid = true; + } + } +#endif + } if (!signal_is_valid) { ERR_EXPLAIN("In Object of type '" + String(get_class()) + "': Attempt to connect nonexistent signal '" + p_signal + "' to method '" + p_to_object->get_class() + "." + p_to_method + "'"); diff --git a/core/script_language.h b/core/script_language.h index bcd9c2c5ea..654d1d4265 100644 --- a/core/script_language.h +++ b/core/script_language.h @@ -128,6 +128,7 @@ public: virtual MethodInfo get_method_info(const StringName &p_method) const = 0; virtual bool is_tool() const = 0; + virtual bool is_valid() const = 0; virtual ScriptLanguage *get_language() const = 0; diff --git a/core/variant.cpp b/core/variant.cpp index edbe66ba31..eb9f34fee6 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -1662,7 +1662,17 @@ Variant::operator Transform() const { return Transform(*_data._basis, Vector3()); else if (type == QUAT) return Transform(Basis(*reinterpret_cast<const Quat *>(_data._mem)), Vector3()); - else + else if (type == TRANSFORM2D) { + const Transform2D &t = *_data._transform2d; + Transform m; + m.basis.elements[0][0] = t.elements[0][0]; + m.basis.elements[1][0] = t.elements[0][1]; + m.basis.elements[0][1] = t.elements[1][0]; + m.basis.elements[1][1] = t.elements[1][1]; + m.origin[0] = t.elements[2][0]; + m.origin[1] = t.elements[2][1]; + return m; + } else return Transform(); } diff --git a/core/variant_op.cpp b/core/variant_op.cpp index d193858966..9f172f0d57 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -2149,7 +2149,7 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid) int idx = p_index; if (idx < 0) idx += 4; - if (idx >= 0 || idx < 4) { + if (idx >= 0 && idx < 4) { Color *v = reinterpret_cast<Color *>(_data._mem); (*v)[idx] = p_value; valid = true; @@ -2524,7 +2524,7 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const { int idx = p_index; if (idx < 0) idx += 4; - if (idx >= 0 || idx < 4) { + if (idx >= 0 && idx < 4) { const Color *v = reinterpret_cast<const Color *>(_data._mem); valid = true; return (*v)[idx]; |