diff options
Diffstat (limited to 'modules')
7 files changed, 76 insertions, 34 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index c8cdac3702..9092ae2969 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -1336,10 +1336,11 @@ void GDScriptAnalyzer::resolve_class_body(GDScriptParser::ClassNode *p_class, co push_error(vformat(R"(Getter with type "%s" cannot be used along with setter of type "%s".)", getter_function->datatype.to_string(), setter_function->parameters[0]->datatype.to_string()), member.variable); } } + } + #ifdef DEBUG_ENABLED - parser->ignored_warnings = previously_ignored_warnings; + parser->ignored_warnings = previously_ignored_warnings; #endif // DEBUG_ENABLED - } } } diff --git a/modules/gdscript/tests/scripts/analyzer/warnings/unused_private_class_variable.gd b/modules/gdscript/tests/scripts/analyzer/warnings/unused_private_class_variable.gd new file mode 100644 index 0000000000..5ca8ceffdd --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/warnings/unused_private_class_variable.gd @@ -0,0 +1,10 @@ +# GH-72135 + +var _a +@warning_ignore("unused_private_class_variable") +var _b +@warning_ignore("unused_private_class_variable") var _c +var _d + +func test(): + pass diff --git a/modules/gdscript/tests/scripts/analyzer/warnings/unused_private_class_variable.out b/modules/gdscript/tests/scripts/analyzer/warnings/unused_private_class_variable.out new file mode 100644 index 0000000000..fd88d23950 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/warnings/unused_private_class_variable.out @@ -0,0 +1,9 @@ +GDTEST_OK +>> WARNING +>> Line: 3 +>> UNUSED_PRIVATE_CLASS_VARIABLE +>> The class variable "_a" is declared but never used in the script. +>> WARNING +>> Line: 7 +>> UNUSED_PRIVATE_CLASS_VARIABLE +>> The class variable "_d" is declared but never used in the script. diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 8504fb2ac6..6b52c8eaaf 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -128,7 +128,7 @@ void BindingsGenerator::TypeInterface::postsetup_enum_type(BindingsGenerator::Ty { // The expected types for parameters and return value in ptrcall are 'int64_t' or 'uint64_t'. r_enum_itype.c_in = "%5%0 %1_in = %1;\n"; - r_enum_itype.c_out = "%5return (%0)%1;\n"; + r_enum_itype.c_out = "%5return (%0)(%1);\n"; r_enum_itype.c_type = "long"; r_enum_itype.c_arg_in = "&%s_in"; } @@ -1893,7 +1893,7 @@ Error BindingsGenerator::_generate_cs_property(const BindingsGenerator::TypeInte // Assume the index parameter is an enum const TypeInterface *idx_arg_type = _get_type_or_null(idx_arg.type); CRASH_COND(idx_arg_type == nullptr); - p_output.append("(" + idx_arg_type->proxy_name + ")" + itos(p_iprop.index)); + p_output.append("(" + idx_arg_type->proxy_name + ")(" + itos(p_iprop.index) + ")"); } else { p_output.append(itos(p_iprop.index)); } @@ -1911,7 +1911,7 @@ Error BindingsGenerator::_generate_cs_property(const BindingsGenerator::TypeInte // Assume the index parameter is an enum const TypeInterface *idx_arg_type = _get_type_or_null(idx_arg.type); CRASH_COND(idx_arg_type == nullptr); - p_output.append("(" + idx_arg_type->proxy_name + ")" + itos(p_iprop.index) + ", "); + p_output.append("(" + idx_arg_type->proxy_name + ")(" + itos(p_iprop.index) + "), "); } else { p_output.append(itos(p_iprop.index) + ", "); } @@ -3286,7 +3286,7 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar break; case Variant::INT: if (r_iarg.type.cname != name_cache.type_int) { - r_iarg.default_argument = "(%s)" + r_iarg.default_argument; + r_iarg.default_argument = "(%s)(" + r_iarg.default_argument + ")"; } break; case Variant::FLOAT: @@ -3508,7 +3508,7 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { itype = TypeInterface::create_value_type(String(m_name)); \ if (itype.name != "long" && itype.name != "ulong") { \ itype.c_in = "%5%0 %1_in = %1;\n"; \ - itype.c_out = "%5return (%0)%1;\n"; \ + itype.c_out = "%5return (%0)(%1);\n"; \ itype.c_type = "long"; \ itype.c_arg_in = "&%s_in"; \ } else { \ diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs index ca963cbf4f..36f5d8e2ab 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs @@ -613,6 +613,43 @@ namespace Godot } /// <summary> + /// Creates a <see cref="Basis"/> with a rotation such that the forward + /// axis (-Z) points towards the <paramref name="target"/> position. + /// The up axis (+Y) points as close to the <paramref name="up"/> vector + /// as possible while staying perpendicular to the forward axis. + /// The resulting Basis is orthonormalized. + /// The <paramref name="target"/> and <paramref name="up"/> vectors + /// cannot be zero, and cannot be parallel to each other. + /// </summary> + /// <param name="target">The position to look at.</param> + /// <param name="up">The relative up direction.</param> + /// <returns>The resulting basis matrix.</returns> + public static Basis LookingAt(Vector3 target, Vector3 up) + { +#if DEBUG + if (target.IsZeroApprox()) + { + throw new ArgumentException("The vector can't be zero.", nameof(target)); + } + if (up.IsZeroApprox()) + { + throw new ArgumentException("The vector can't be zero.", nameof(up)); + } +#endif + Vector3 column2 = -target.Normalized(); + Vector3 column0 = up.Cross(column2); +#if DEBUG + if (column0.IsZeroApprox()) + { + throw new ArgumentException("The target vector and up vector can't be parallel to each other."); + } +#endif + column0.Normalize(); + Vector3 column1 = column2.Cross(column0); + return new Basis(column0, column1, column2); + } + + /// <summary> /// Returns the orthonormalized version of the basis matrix (useful to /// call occasionally to avoid rounding errors for orthogonal matrices). /// This performs a Gram-Schmidt orthonormalization on the basis of the matrix. diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs index b34e95c04d..1e2aaa299f 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs @@ -164,14 +164,14 @@ namespace Godot } /// <summary> - /// Returns a copy of the transform rotated such that its - /// -Z axis (forward) points towards the <paramref name="target"/> position. - /// - /// The transform will first be rotated around the given <paramref name="up"/> vector, - /// and then fully aligned to the <paramref name="target"/> by a further rotation around - /// an axis perpendicular to both the <paramref name="target"/> and <paramref name="up"/> vectors. - /// - /// Operations take place in global space. + /// Returns a copy of the transform rotated such that the forward axis (-Z) + /// points towards the <paramref name="target"/> position. + /// The up axis (+Y) points as close to the <paramref name="up"/> vector + /// as possible while staying perpendicular to the forward axis. + /// The resulting transform is orthonormalized. + /// The existing rotation, scale, and skew information from the original transform is discarded. + /// The <paramref name="target"/> and <paramref name="up"/> vectors cannot be zero, + /// cannot be parallel to each other, and are defined in global/parent space. /// </summary> /// <param name="target">The object to look at.</param> /// <param name="up">The relative up direction.</param> @@ -249,24 +249,7 @@ namespace Godot private void SetLookAt(Vector3 eye, Vector3 target, Vector3 up) { - // Make rotation matrix - // Z vector - Vector3 column2 = eye - target; - - column2.Normalize(); - - Vector3 column1 = up; - - Vector3 column0 = column1.Cross(column2); - - // Recompute Y = Z cross X - column1 = column2.Cross(column0); - - column0.Normalize(); - column1.Normalize(); - - Basis = new Basis(column0, column1, column2); - + Basis = Basis.LookingAt(target - eye, up); Origin = eye; } diff --git a/modules/websocket/wsl_peer.cpp b/modules/websocket/wsl_peer.cpp index 816d5276b9..109d5102c3 100644 --- a/modules/websocket/wsl_peer.cpp +++ b/modules/websocket/wsl_peer.cpp @@ -332,7 +332,7 @@ void WSLPeer::_do_client_handshake() { if (connection == tcp) { // Start SSL handshake tls = Ref<StreamPeerTLS>(StreamPeerTLS::create()); - ERR_FAIL_COND_MSG(tls.is_null(), "SSL is not available in this build."); + ERR_FAIL_COND(tls.is_null()); if (tls->connect_to_stream(tcp, requested_host, tls_options) != OK) { close(-1); return; // Error. @@ -501,6 +501,8 @@ Error WSLPeer::connect_to_url(const String &p_url, Ref<TLSOptions> p_options) { path = "/"; } + ERR_FAIL_COND_V_MSG(use_tls && !StreamPeerTLS::is_available(), ERR_UNAVAILABLE, "WSS is not available in this build."); + requested_url = p_url; requested_host = host; |