Skip to content

Commit

Permalink
Merge pull request #87589 from YuriSizov/4.2-cherrypicks
Browse files Browse the repository at this point in the history
Cherry-picks for the 4.2 branch (future 4.2.2) - 2nd batch
  • Loading branch information
YuriSizov authored Jan 25, 2024
2 parents a3d7978 + e070bbc commit 7ecb58d
Show file tree
Hide file tree
Showing 277 changed files with 4,201 additions and 2,406 deletions.
2 changes: 1 addition & 1 deletion COPYRIGHT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ License: Expat

Files: ./thirdparty/thorvg/
Comment: ThorVG
Copyright: 2020-2023, The ThorVG Project
Copyright: 2020-2024, The ThorVG Project
License: Expat

Files: ./thirdparty/tinyexr/
Expand Down
11 changes: 8 additions & 3 deletions core/extension/extension_api_dump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,14 +742,19 @@ Dictionary GDExtensionAPIDump::generate_extension_api(bool p_include_docs) {
Dictionary d2;
String operator_name = Variant::get_operator_name(Variant::Operator(k));
d2["name"] = operator_name;
if (k != Variant::OP_NEGATE && k != Variant::OP_POSITIVE && k != Variant::OP_NOT && k != Variant::OP_BIT_NEGATE) {
d2["right_type"] = get_builtin_or_variant_type_name(Variant::Type(j));

String right_type_name = get_builtin_or_variant_type_name(Variant::Type(j));
bool is_unary = k == Variant::OP_NEGATE || k == Variant::OP_POSITIVE || k == Variant::OP_NOT || k == Variant::OP_BIT_NEGATE;
if (!is_unary) {
d2["right_type"] = right_type_name;
}

d2["return_type"] = get_builtin_or_variant_type_name(Variant::get_operator_return_type(Variant::Operator(k), type, Variant::Type(j)));

if (p_include_docs && builtin_doc != nullptr) {
for (const DocData::MethodDoc &operator_doc : builtin_doc->operators) {
if (operator_doc.name == "operator " + operator_name) {
if (operator_doc.name == "operator " + operator_name &&
(is_unary || operator_doc.arguments[0].type == right_type_name)) {
d2["description"] = fix_doc_description(operator_doc.description);
break;
}
Expand Down
1 change: 1 addition & 0 deletions core/input/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ void Input::get_argument_options(const StringName &p_function, int p_idx, List<S
r_options->push_back(name.quote());
}
}
Object::get_argument_options(p_function, p_idx, r_options);
}

void Input::VelocityTrack::update(const Vector2 &p_delta_p) {
Expand Down
2 changes: 1 addition & 1 deletion core/io/file_access_pack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ uint64_t FileAccessPack::get_buffer(uint8_t *p_dst, uint64_t p_length) const {
to_read = (int64_t)pf.size - (int64_t)pos;
}

pos += p_length;
pos += to_read;

if (to_read <= 0) {
return 0;
Expand Down
6 changes: 4 additions & 2 deletions core/io/resource_format_binary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1454,8 +1454,10 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
fw.unref();

Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
da->remove(p_path);
da->rename(p_path + ".depren", p_path);
if (da->exists(p_path + ".depren")) {
da->remove(p_path);
da->rename(p_path + ".depren", p_path);
}
return OK;
}

Expand Down
6 changes: 3 additions & 3 deletions core/math/aabb.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,11 @@ inline bool AABB::encloses(const AABB &p_aabb) const {

return (
(src_min.x <= dst_min.x) &&
(src_max.x > dst_max.x) &&
(src_max.x >= dst_max.x) &&
(src_min.y <= dst_min.y) &&
(src_max.y > dst_max.y) &&
(src_max.y >= dst_max.y) &&
(src_min.z <= dst_min.z) &&
(src_max.z > dst_max.z));
(src_max.z >= dst_max.z));
}

Vector3 AABB::get_support(const Vector3 &p_normal) const {
Expand Down
1 change: 1 addition & 0 deletions core/variant/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ typedef Vector<int32_t> PackedInt32Array;
typedef Vector<int64_t> PackedInt64Array;
typedef Vector<float> PackedFloat32Array;
typedef Vector<double> PackedFloat64Array;
typedef Vector<real_t> PackedRealArray;
typedef Vector<String> PackedStringArray;
typedef Vector<Vector2> PackedVector2Array;
typedef Vector<Vector3> PackedVector3Array;
Expand Down
17 changes: 4 additions & 13 deletions doc/classes/@GlobalScope.xml
Original file line number Diff line number Diff line change
Expand Up @@ -234,20 +234,9 @@

var b = clamp(8.1, 0.9, 5.5)
# b is 5.5

var c = clamp(Vector2(-3.5, -4), Vector2(-3.2, -2), Vector2(2, 6.5))
# c is (-3.2, -2)

var d = clamp(Vector2i(7, 8), Vector2i(-3, -2), Vector2i(2, 6))
# d is (2, 6)

var e = clamp(Vector3(-7, 8.5, -3.8), Vector3(-3, -2, 5.4), Vector3(-2, 6, -4.1))
# e is (-3, -2, 5.4)

var f = clamp(Vector3i(-7, -8, -9), Vector3i(-1, 2, 3), Vector3i(-4, -5, -6))
# f is (-4, -5, -6)
[/codeblock]
[b]Note:[/b] For better type safety, use [method clampf], [method clampi], [method Vector2.clamp], [method Vector2i.clamp], [method Vector3.clamp], [method Vector3i.clamp], [method Vector4.clamp], [method Vector4i.clamp], or [method Color.clamp].
[b]Note:[/b] For better type safety, use [method clampf], [method clampi], [method Vector2.clamp], [method Vector2i.clamp], [method Vector3.clamp], [method Vector3i.clamp], [method Vector4.clamp], [method Vector4i.clamp], or [method Color.clamp] (not currently supported by this method).
[b]Note:[/b] When using this on vectors it will [i]not[/i] perform component-wise clamping, and will pick [param min] if [code]value &lt; min[/code] or [param max] if [code]value &gt; max[/code]. To perform component-wise clamping use the methods listed above.
</description>
</method>
<method name="clampf">
Expand Down Expand Up @@ -1439,13 +1428,15 @@
<description>
Encodes a [Variant] value to a byte array, without encoding objects. Deserialization can be done with [method bytes_to_var].
[b]Note:[/b] If you need object serialization, see [method var_to_bytes_with_objects].
[b]Note:[/b] Encoding [Callable] is not supported and will result in an empty value, regardless of the data.
</description>
</method>
<method name="var_to_bytes_with_objects">
<return type="PackedByteArray" />
<param index="0" name="variable" type="Variant" />
<description>
Encodes a [Variant] value to a byte array. Encoding objects is allowed (and can potentially include executable code). Deserialization can be done with [method bytes_to_var_with_objects].
[b]Note:[/b] Encoding [Callable] is not supported and will result in an empty value, regardless of the data.
</description>
</method>
<method name="var_to_str">
Expand Down
Loading

0 comments on commit 7ecb58d

Please sign in to comment.