summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/extension/gdnative_interface.cpp4
-rw-r--r--core/input/input.cpp6
-rw-r--r--core/math/basis.cpp4
-rw-r--r--core/math/math_funcs.h4
-rw-r--r--core/math/transform_2d.cpp6
-rw-r--r--core/math/vector2.cpp2
-rw-r--r--core/math/vector2.h2
-rw-r--r--core/math/vector3.h2
-rw-r--r--core/math/vector3i.h2
-rw-r--r--core/typedefs.h4
-rw-r--r--core/variant/variant_utility.cpp8
-rw-r--r--doc/classes/AABB.xml5
-rw-r--r--doc/classes/Animation.xml27
-rw-r--r--doc/classes/Basis.xml7
-rw-r--r--doc/classes/Color.xml15
-rw-r--r--doc/classes/Plane.xml6
-rw-r--r--doc/classes/Quaternion.xml15
-rw-r--r--doc/classes/Rect2.xml5
-rw-r--r--doc/classes/Rect2i.xml2
-rw-r--r--doc/classes/Transform2D.xml9
-rw-r--r--doc/classes/Transform3D.xml8
-rw-r--r--doc/classes/Vector2.xml32
-rw-r--r--doc/classes/Vector2i.xml43
-rw-r--r--doc/classes/Vector3.xml34
-rw-r--r--doc/classes/Vector3i.xml43
-rw-r--r--doc/classes/float.xml13
-rw-r--r--doc/classes/int.xml6
-rw-r--r--drivers/wasapi/audio_driver_wasapi.cpp19
-rw-r--r--editor/action_map_editor.cpp2
-rw-r--r--editor/animation_bezier_editor.cpp102
-rw-r--r--editor/animation_bezier_editor.h17
-rw-r--r--editor/animation_track_editor.cpp53
-rw-r--r--editor/debugger/script_editor_debugger.cpp48
-rw-r--r--editor/debugger/script_editor_debugger.h4
-rw-r--r--editor/project_manager.cpp6
-rw-r--r--misc/hooks/README.md2
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs33
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs41
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs172
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Colors.cs2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs6
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs31
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs100
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs22
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2i.cs14
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs39
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs39
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs171
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs182
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs167
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs194
-rw-r--r--platform/osx/crash_handler_osx.mm5
-rw-r--r--scene/2d/camera_2d.cpp1
-rw-r--r--scene/3d/gpu_particles_collision_3d.cpp6
-rw-r--r--scene/3d/reflection_probe.cpp4
-rw-r--r--scene/gui/scroll_container.cpp4
-rw-r--r--scene/gui/spin_box.cpp2
-rw-r--r--scene/gui/text_edit.cpp8
-rw-r--r--scene/gui/tree.cpp2
-rw-r--r--scene/main/canvas_item.cpp1
-rw-r--r--scene/resources/animation.cpp126
-rw-r--r--scene/resources/animation.h16
-rw-r--r--servers/physics_2d/godot_step_2d.cpp4
-rw-r--r--servers/physics_3d/godot_shape_3d.cpp2
-rw-r--r--servers/physics_3d/godot_step_3d.cpp4
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp1
-rw-r--r--servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp1
-rw-r--r--servers/rendering/renderer_rd/renderer_storage_rd.cpp2
-rw-r--r--servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl4
-rw-r--r--servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl4
72 files changed, 1741 insertions, 240 deletions
diff --git a/core/extension/gdnative_interface.cpp b/core/extension/gdnative_interface.cpp
index 4770c9c65f..a65408fdda 100644
--- a/core/extension/gdnative_interface.cpp
+++ b/core/extension/gdnative_interface.cpp
@@ -774,13 +774,13 @@ static GDNativeTypePtr gdnative_packed_vector3_array_operator_index_const(const
static GDNativeVariantPtr gdnative_array_operator_index(GDNativeTypePtr p_self, GDNativeInt p_index) {
Array *self = (Array *)p_self;
ERR_FAIL_INDEX_V(p_index, self->size(), nullptr);
- return (GDNativeTypePtr)&self[p_index];
+ return (GDNativeVariantPtr)&self->operator[](p_index);
}
static GDNativeVariantPtr gdnative_array_operator_index_const(const GDNativeTypePtr p_self, GDNativeInt p_index) {
const Array *self = (const Array *)p_self;
ERR_FAIL_INDEX_V(p_index, self->size(), nullptr);
- return (GDNativeTypePtr)&self[p_index];
+ return (GDNativeVariantPtr)&self->operator[](p_index);
}
/* OBJECT API */
diff --git a/core/input/input.cpp b/core/input/input.cpp
index 4b5a84f401..6fd8aca01b 100644
--- a/core/input/input.cpp
+++ b/core/input/input.cpp
@@ -714,11 +714,11 @@ Point2i Input::warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, con
// detect the warp: if the relative distance is greater than the half of the size of the relevant rect
// (checked per each axis), it will be considered as the consequence of a former pointer warp.
- const Point2i rel_sgn(p_motion->get_relative().x >= 0.0f ? 1 : -1, p_motion->get_relative().y >= 0.0 ? 1 : -1);
+ const Point2i rel_sign(p_motion->get_relative().x >= 0.0f ? 1 : -1, p_motion->get_relative().y >= 0.0 ? 1 : -1);
const Size2i warp_margin = p_rect.size * 0.5f;
const Point2i rel_warped(
- Math::fmod(p_motion->get_relative().x + rel_sgn.x * warp_margin.x, p_rect.size.x) - rel_sgn.x * warp_margin.x,
- Math::fmod(p_motion->get_relative().y + rel_sgn.y * warp_margin.y, p_rect.size.y) - rel_sgn.y * warp_margin.y);
+ Math::fmod(p_motion->get_relative().x + rel_sign.x * warp_margin.x, p_rect.size.x) - rel_sign.x * warp_margin.x,
+ Math::fmod(p_motion->get_relative().y + rel_sign.y * warp_margin.y, p_rect.size.y) - rel_sign.y * warp_margin.y);
const Point2i pos_local = p_motion->get_global_position() - p_rect.position;
const Point2i pos_warped(Math::fposmod(pos_local.x, p_rect.size.x), Math::fposmod(pos_local.y, p_rect.size.y));
diff --git a/core/math/basis.cpp b/core/math/basis.cpp
index 3d893afb4d..566300c716 100644
--- a/core/math/basis.cpp
+++ b/core/math/basis.cpp
@@ -261,7 +261,7 @@ Vector3 Basis::get_scale_abs() const {
}
Vector3 Basis::get_scale_local() const {
- real_t det_sign = SGN(determinant());
+ real_t det_sign = SIGN(determinant());
return det_sign * Vector3(elements[0].length(), elements[1].length(), elements[2].length());
}
@@ -287,7 +287,7 @@ Vector3 Basis::get_scale() const {
// matrix elements.
//
// The rotation part of this decomposition is returned by get_rotation* functions.
- real_t det_sign = SGN(determinant());
+ real_t det_sign = SIGN(determinant());
return det_sign * get_scale_abs();
}
diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h
index b3eabd3e7a..e3b990d48f 100644
--- a/core/math/math_funcs.h
+++ b/core/math/math_funcs.h
@@ -266,8 +266,8 @@ public:
float s = CLAMP((p_s - p_from) / (p_to - p_from), 0.0f, 1.0f);
return s * s * (3.0f - 2.0f * s);
}
- static _ALWAYS_INLINE_ double move_toward(double p_from, double p_to, double p_delta) { return abs(p_to - p_from) <= p_delta ? p_to : p_from + SGN(p_to - p_from) * p_delta; }
- static _ALWAYS_INLINE_ float move_toward(float p_from, float p_to, float p_delta) { return abs(p_to - p_from) <= p_delta ? p_to : p_from + SGN(p_to - p_from) * p_delta; }
+ static _ALWAYS_INLINE_ double move_toward(double p_from, double p_to, double p_delta) { return abs(p_to - p_from) <= p_delta ? p_to : p_from + SIGN(p_to - p_from) * p_delta; }
+ static _ALWAYS_INLINE_ float move_toward(float p_from, float p_to, float p_delta) { return abs(p_to - p_from) <= p_delta ? p_to : p_from + SIGN(p_to - p_from) * p_delta; }
static _ALWAYS_INLINE_ double linear2db(double p_linear) { return Math::log(p_linear) * 8.6858896380650365530225783783321; }
static _ALWAYS_INLINE_ float linear2db(float p_linear) { return Math::log(p_linear) * 8.6858896380650365530225783783321; }
diff --git a/core/math/transform_2d.cpp b/core/math/transform_2d.cpp
index df43c605f9..4bdeaa2a58 100644
--- a/core/math/transform_2d.cpp
+++ b/core/math/transform_2d.cpp
@@ -69,12 +69,12 @@ void Transform2D::rotate(const real_t p_phi) {
real_t Transform2D::get_skew() const {
real_t det = basis_determinant();
- return Math::acos(elements[0].normalized().dot(SGN(det) * elements[1].normalized())) - Math_PI * 0.5;
+ return Math::acos(elements[0].normalized().dot(SIGN(det) * elements[1].normalized())) - Math_PI * 0.5;
}
void Transform2D::set_skew(const real_t p_angle) {
real_t det = basis_determinant();
- elements[1] = SGN(det) * elements[0].rotated((Math_PI * 0.5 + p_angle)).normalized() * elements[1].length();
+ elements[1] = SIGN(det) * elements[0].rotated((Math_PI * 0.5 + p_angle)).normalized() * elements[1].length();
}
real_t Transform2D::get_rotation() const {
@@ -111,7 +111,7 @@ Transform2D::Transform2D(const real_t p_rot, const Size2 &p_scale, const real_t
}
Size2 Transform2D::get_scale() const {
- real_t det_sign = SGN(basis_determinant());
+ real_t det_sign = SIGN(basis_determinant());
return Size2(elements[0].length(), det_sign * elements[1].length());
}
diff --git a/core/math/vector2.cpp b/core/math/vector2.cpp
index 1d3f93848e..718e94eee4 100644
--- a/core/math/vector2.cpp
+++ b/core/math/vector2.cpp
@@ -91,7 +91,7 @@ real_t Vector2::cross(const Vector2 &p_other) const {
}
Vector2 Vector2::sign() const {
- return Vector2(SGN(x), SGN(y));
+ return Vector2(SIGN(x), SIGN(y));
}
Vector2 Vector2::floor() const {
diff --git a/core/math/vector2.h b/core/math/vector2.h
index 332c0475fa..0a7b9d3faf 100644
--- a/core/math/vector2.h
+++ b/core/math/vector2.h
@@ -345,7 +345,7 @@ struct Vector2i {
bool operator!=(const Vector2i &p_vec2) const;
real_t aspect() const { return width / (real_t)height; }
- Vector2i sign() const { return Vector2i(SGN(x), SGN(y)); }
+ Vector2i sign() const { return Vector2i(SIGN(x), SIGN(y)); }
Vector2i abs() const { return Vector2i(ABS(x), ABS(y)); }
Vector2i clamp(const Vector2i &p_min, const Vector2i &p_max) const;
diff --git a/core/math/vector3.h b/core/math/vector3.h
index dc9aa60458..02a56f684e 100644
--- a/core/math/vector3.h
+++ b/core/math/vector3.h
@@ -217,7 +217,7 @@ Vector3 Vector3::abs() const {
}
Vector3 Vector3::sign() const {
- return Vector3(SGN(x), SGN(y), SGN(z));
+ return Vector3(SIGN(x), SIGN(y), SIGN(z));
}
Vector3 Vector3::floor() const {
diff --git a/core/math/vector3i.h b/core/math/vector3i.h
index 9308d09045..10c28a5bb9 100644
--- a/core/math/vector3i.h
+++ b/core/math/vector3i.h
@@ -115,7 +115,7 @@ Vector3i Vector3i::abs() const {
}
Vector3i Vector3i::sign() const {
- return Vector3i(SGN(x), SGN(y), SGN(z));
+ return Vector3i(SIGN(x), SIGN(y), SIGN(z));
}
/* Operators */
diff --git a/core/typedefs.h b/core/typedefs.h
index 9ab874b2f0..95bd423817 100644
--- a/core/typedefs.h
+++ b/core/typedefs.h
@@ -91,8 +91,8 @@
#define ABS(m_v) (((m_v) < 0) ? (-(m_v)) : (m_v))
#endif
-#ifndef SGN
-#define SGN(m_v) (((m_v) == 0) ? (0.0) : (((m_v) < 0) ? (-1.0) : (+1.0)))
+#ifndef SIGN
+#define SIGN(m_v) (((m_v) == 0) ? (0.0) : (((m_v) < 0) ? (-1.0) : (+1.0)))
#endif
#ifndef MIN
diff --git a/core/variant/variant_utility.cpp b/core/variant/variant_utility.cpp
index e89bdd4faa..83fa4bde69 100644
--- a/core/variant/variant_utility.cpp
+++ b/core/variant/variant_utility.cpp
@@ -151,10 +151,10 @@ struct VariantUtilityFunctions {
r_error.error = Callable::CallError::CALL_OK;
switch (x.get_type()) {
case Variant::INT: {
- return SGN(VariantInternalAccessor<int64_t>::get(&x));
+ return SIGN(VariantInternalAccessor<int64_t>::get(&x));
} break;
case Variant::FLOAT: {
- return SGN(VariantInternalAccessor<double>::get(&x));
+ return SIGN(VariantInternalAccessor<double>::get(&x));
} break;
case Variant::VECTOR2: {
return VariantInternalAccessor<Vector2>::get(&x).sign();
@@ -176,11 +176,11 @@ struct VariantUtilityFunctions {
}
static inline double signf(double x) {
- return SGN(x);
+ return SIGN(x);
}
static inline int64_t signi(int64_t x) {
- return SGN(x);
+ return SIGN(x);
}
static inline double pow(double x, double y) {
diff --git a/doc/classes/AABB.xml b/doc/classes/AABB.xml
index 8f0b16c09d..170cfea6f9 100644
--- a/doc/classes/AABB.xml
+++ b/doc/classes/AABB.xml
@@ -233,12 +233,15 @@
<return type="bool" />
<argument index="0" name="right" type="AABB" />
<description>
+ Returns [code]true[/code] if the vectors are not equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator *">
<return type="AABB" />
<argument index="0" name="right" type="Transform3D" />
<description>
+ Inversely transforms (multiplies) the [AABB] by the given [Transform3D] transformation matrix.
</description>
</operator>
<operator name="operator ==">
@@ -250,6 +253,8 @@
<return type="bool" />
<argument index="0" name="right" type="AABB" />
<description>
+ Returns [code]true[/code] if the AABBs are exactly equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
</operators>
diff --git a/doc/classes/Animation.xml b/doc/classes/Animation.xml
index ac04149c81..bb4089d67e 100644
--- a/doc/classes/Animation.xml
+++ b/doc/classes/Animation.xml
@@ -130,6 +130,14 @@
Sets the stream of the key identified by [code]key_idx[/code] to value [code]stream[/code]. The [code]track_idx[/code] must be the index of an Audio Track.
</description>
</method>
+ <method name="bezier_track_get_key_handle_mode" qualifiers="const">
+ <return type="int" />
+ <argument index="0" name="track_idx" type="int" />
+ <argument index="1" name="key_idx" type="int" />
+ <description>
+ Returns the handle mode of the key identified by [code]index[/code]. See [enum HandleMode] for possible values. The [code]track_idx[/code] must be the index of a Bezier Track.
+ </description>
+ </method>
<method name="bezier_track_get_key_in_handle" qualifiers="const">
<return type="Vector2" />
<argument index="0" name="track_idx" type="int" />
@@ -161,6 +169,7 @@
<argument index="2" name="value" type="float" />
<argument index="3" name="in_handle" type="Vector2" default="Vector2(0, 0)" />
<argument index="4" name="out_handle" type="Vector2" default="Vector2(0, 0)" />
+ <argument index="5" name="handle_mode" type="int" enum="Animation.HandleMode" default="1" />
<description>
Inserts a Bezier Track key at the given [code]time[/code] in seconds. The [code]track_idx[/code] must be the index of a Bezier Track.
[code]in_handle[/code] is the left-side weight of the added Bezier curve point, [code]out_handle[/code] is the right-side one, while [code]value[/code] is the actual value at this point.
@@ -174,11 +183,22 @@
Returns the interpolated value at the given [code]time[/code] (in seconds). The [code]track_idx[/code] must be the index of a Bezier Track.
</description>
</method>
+ <method name="bezier_track_set_key_handle_mode">
+ <return type="void" />
+ <argument index="0" name="track_idx" type="int" />
+ <argument index="1" name="key_idx" type="int" />
+ <argument index="2" name="key_handle_mode" type="int" enum="Animation.HandleMode" />
+ <argument index="3" name="balanced_value_time_ratio" type="float" default="1.0" />
+ <description>
+ Changes the handle mode of the keyframe at the given [code]index[/code]. See [enum HandleMode] for possible values. The [code]track_idx[/code] must be the index of a Bezier Track.
+ </description>
+ </method>
<method name="bezier_track_set_key_in_handle">
<return type="void" />
<argument index="0" name="track_idx" type="int" />
<argument index="1" name="key_idx" type="int" />
<argument index="2" name="in_handle" type="Vector2" />
+ <argument index="3" name="balanced_value_time_ratio" type="float" default="1.0" />
<description>
Sets the in handle of the key identified by [code]key_idx[/code] to value [code]in_handle[/code]. The [code]track_idx[/code] must be the index of a Bezier Track.
</description>
@@ -188,6 +208,7 @@
<argument index="0" name="track_idx" type="int" />
<argument index="1" name="key_idx" type="int" />
<argument index="2" name="out_handle" type="Vector2" />
+ <argument index="3" name="balanced_value_time_ratio" type="float" default="1.0" />
<description>
Sets the out handle of the key identified by [code]key_idx[/code] to value [code]out_handle[/code]. The [code]track_idx[/code] must be the index of a Bezier Track.
</description>
@@ -619,5 +640,11 @@
<constant name="LOOP_PINGPONG" value="2" enum="LoopMode">
Repeats playback and reverse playback at both ends of the animation.
</constant>
+ <constant name="HANDLE_MODE_FREE" value="0" enum="HandleMode">
+ Assigning the free handle mode to a Bezier Track's keyframe allows you to edit the keyframe's left and right handles independently from one another.
+ </constant>
+ <constant name="HANDLE_MODE_BALANCED" value="1" enum="HandleMode">
+ Assigning the balanced handle mode to a Bezier Track's keyframe makes it so the two handles of the keyframe always stay aligned when changing either the keyframe's left or right handle.
+ </constant>
</constants>
</class>
diff --git a/doc/classes/Basis.xml b/doc/classes/Basis.xml
index 389e115e85..bf3d20c11c 100644
--- a/doc/classes/Basis.xml
+++ b/doc/classes/Basis.xml
@@ -232,18 +232,22 @@
<return type="bool" />
<argument index="0" name="right" type="Basis" />
<description>
+ Returns [code]true[/code] if the [Basis] matrices are not equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator *">
<return type="Basis" />
<argument index="0" name="right" type="Basis" />
<description>
+ Composes these two basis matrices by multiplying them together. This has the effect of transforming the second basis (the child) by the first basis (the parent).
</description>
</operator>
<operator name="operator *">
<return type="Vector3" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Transforms (multiplies) the [Vector3] by the given [Basis] matrix.
</description>
</operator>
<operator name="operator *">
@@ -269,12 +273,15 @@
<return type="bool" />
<argument index="0" name="right" type="Basis" />
<description>
+ Returns [code]true[/code] if the [Basis] matrices are exactly equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator []">
<return type="Vector3" />
<argument index="0" name="index" type="int" />
<description>
+ Access basis components using their index. [code]b[0][/code] is equivalent to [code]b.x[/code], [code]b[1][/code] is equivalent to [code]b.y[/code], and [code]b[2][/code] is equivalent to [code]b.z[/code].
</description>
</operator>
</operators>
diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml
index 650f10a97f..22fb853b40 100644
--- a/doc/classes/Color.xml
+++ b/doc/classes/Color.xml
@@ -881,54 +881,64 @@
<return type="bool" />
<argument index="0" name="right" type="Color" />
<description>
+ Returns [code]true[/code] if the colors are not equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator *">
<return type="Color" />
<argument index="0" name="right" type="Color" />
<description>
+ Multiplies each component of the [Color] by the components of the given [Color].
</description>
</operator>
<operator name="operator *">
<return type="Color" />
<argument index="0" name="right" type="float" />
<description>
+ Multiplies each component of the [Color] by the given [float].
</description>
</operator>
<operator name="operator *">
<return type="Color" />
<argument index="0" name="right" type="int" />
<description>
+ Multiplies each component of the [Color] by the given [int].
</description>
</operator>
<operator name="operator +">
<return type="Color" />
<argument index="0" name="right" type="Color" />
<description>
+ Adds each component of the [Color] with the components of the given [Color].
</description>
</operator>
<operator name="operator -">
<return type="Color" />
<argument index="0" name="right" type="Color" />
<description>
+ Subtracts each component of the [Color] by the components of the given [Color].
</description>
</operator>
<operator name="operator /">
<return type="Color" />
<argument index="0" name="right" type="Color" />
<description>
+ Divides each component of the [Color] by the components of the given [Color].
</description>
</operator>
<operator name="operator /">
<return type="Color" />
<argument index="0" name="right" type="float" />
<description>
+ Divides each component of the [Color] by the given [float].
</description>
</operator>
<operator name="operator /">
<return type="Color" />
<argument index="0" name="right" type="int" />
<description>
+ Divides each component of the [Color] by the given [int].
</description>
</operator>
<operator name="operator ==">
@@ -940,22 +950,27 @@
<return type="bool" />
<argument index="0" name="right" type="Color" />
<description>
+ Returns [code]true[/code] if the colors are exactly equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator []">
<return type="float" />
<argument index="0" name="index" type="int" />
<description>
+ Access color components using their index. [code]c[0][/code] is equivalent to [code]c.r[/code], [code]c[1][/code] is equivalent to [code]c.g[/code], [code]c[2][/code] is equivalent to [code]c.b[/code], and [code]c[3][/code] is equivalent to [code]c.a[/code].
</description>
</operator>
<operator name="operator unary+">
<return type="Color" />
<description>
+ Returns the same value as if the [code]+[/code] was not there. Unary [code]+[/code] does nothing, but sometimes it can make your code more readable.
</description>
</operator>
<operator name="operator unary-">
<return type="Color" />
<description>
+ Inverts the given color. This is equivalent to [code]Color.WHITE - c[/code] or [code]Color(1 - c.r, 1 - c.g, 1 - c.b, 1 - c.a)[/code].
</description>
</operator>
</operators>
diff --git a/doc/classes/Plane.xml b/doc/classes/Plane.xml
index 1f741a19d9..37a8e00b49 100644
--- a/doc/classes/Plane.xml
+++ b/doc/classes/Plane.xml
@@ -180,6 +180,8 @@
<return type="bool" />
<argument index="0" name="right" type="Plane" />
<description>
+ Returns [code]true[/code] if the planes are not equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator ==">
@@ -191,16 +193,20 @@
<return type="bool" />
<argument index="0" name="right" type="Plane" />
<description>
+ Returns [code]true[/code] if the planes are exactly equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator unary+">
<return type="Plane" />
<description>
+ Returns the same value as if the [code]+[/code] was not there. Unary [code]+[/code] does nothing, but sometimes it can make your code more readable.
</description>
</operator>
<operator name="operator unary-">
<return type="Plane" />
<description>
+ Returns the negative value of the [Plane]. This is the same as writing [code]Plane(-p.normal, -p.d)[/code]. This operation flips the direction of the normal vector and also flips the distance value, resulting in a Plane that is in the same place, but facing the opposite direction.
</description>
</operator>
</operators>
diff --git a/doc/classes/Quaternion.xml b/doc/classes/Quaternion.xml
index 542b58f50b..9fa2d9b60b 100644
--- a/doc/classes/Quaternion.xml
+++ b/doc/classes/Quaternion.xml
@@ -195,54 +195,64 @@
<return type="bool" />
<argument index="0" name="right" type="Quaternion" />
<description>
+ Returns [code]true[/code] if the quaternions are not equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator *">
<return type="Quaternion" />
<argument index="0" name="right" type="Quaternion" />
<description>
+ Composes these two quaternions by multiplying them together. This has the effect of rotating the second quaternion (the child) by the first quaternion (the parent).
</description>
</operator>
<operator name="operator *">
<return type="Vector3" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Rotates (multiplies) the [Vector3] by the given [Quaternion].
</description>
</operator>
<operator name="operator *">
<return type="Quaternion" />
<argument index="0" name="right" type="float" />
<description>
+ Multiplies each component of the [Quaternion] by the given value. This operation is not meaningful on its own, but it can be used as a part of a larger expression.
</description>
</operator>
<operator name="operator *">
<return type="Quaternion" />
<argument index="0" name="right" type="int" />
<description>
+ Multiplies each component of the [Quaternion] by the given value. This operation is not meaningful on its own, but it can be used as a part of a larger expression.
</description>
</operator>
<operator name="operator +">
<return type="Quaternion" />
<argument index="0" name="right" type="Quaternion" />
<description>
+ Adds each component of the left [Quaternion] to the right [Quaternion]. This operation is not meaningful on its own, but it can be used as a part of a larger expression, such as approximating an intermediate rotation between two nearby rotations.
</description>
</operator>
<operator name="operator -">
<return type="Quaternion" />
<argument index="0" name="right" type="Quaternion" />
<description>
+ Subtracts each component of the left [Quaternion] by the right [Quaternion]. This operation is not meaningful on its own, but it can be used as a part of a larger expression.
</description>
</operator>
<operator name="operator /">
<return type="Quaternion" />
<argument index="0" name="right" type="float" />
<description>
+ Divides each component of the [Quaternion] by the given value. This operation is not meaningful on its own, but it can be used as a part of a larger expression.
</description>
</operator>
<operator name="operator /">
<return type="Quaternion" />
<argument index="0" name="right" type="int" />
<description>
+ Divides each component of the [Quaternion] by the given value. This operation is not meaningful on its own, but it can be used as a part of a larger expression.
</description>
</operator>
<operator name="operator ==">
@@ -254,22 +264,27 @@
<return type="bool" />
<argument index="0" name="right" type="Quaternion" />
<description>
+ Returns [code]true[/code] if the quaternions are exactly equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator []">
<return type="float" />
<argument index="0" name="index" type="int" />
<description>
+ Access quaternion components using their index. [code]q[0][/code] is equivalent to [code]q.x[/code], [code]q[1][/code] is equivalent to [code]q.y[/code], [code]q[2][/code] is equivalent to [code]q.z[/code], and [code]q[3][/code] is equivalent to [code]q.w[/code].
</description>
</operator>
<operator name="operator unary+">
<return type="Quaternion" />
<description>
+ Returns the same value as if the [code]+[/code] was not there. Unary [code]+[/code] does nothing, but sometimes it can make your code more readable.
</description>
</operator>
<operator name="operator unary-">
<return type="Quaternion" />
<description>
+ Returns the negative value of the [Quaternion]. This is the same as writing [code]Quaternion(-q.x, -q.y, -q.z, -q.w)[/code]. This operation results in a quaternion that represents the same rotation.
</description>
</operator>
</operators>
diff --git a/doc/classes/Rect2.xml b/doc/classes/Rect2.xml
index 22cec9f75a..4dc3859ca5 100644
--- a/doc/classes/Rect2.xml
+++ b/doc/classes/Rect2.xml
@@ -194,12 +194,15 @@
<return type="bool" />
<argument index="0" name="right" type="Rect2" />
<description>
+ Returns [code]true[/code] if the rectangles are not equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator *">
<return type="Rect2" />
<argument index="0" name="right" type="Transform2D" />
<description>
+ Inversely transforms (multiplies) the [Rect2] by the given [Transform2D] transformation matrix.
</description>
</operator>
<operator name="operator ==">
@@ -211,6 +214,8 @@
<return type="bool" />
<argument index="0" name="right" type="Rect2" />
<description>
+ Returns [code]true[/code] if the rectangles are exactly equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
</operators>
diff --git a/doc/classes/Rect2i.xml b/doc/classes/Rect2i.xml
index 42f9e9f208..d66b589ec1 100644
--- a/doc/classes/Rect2i.xml
+++ b/doc/classes/Rect2i.xml
@@ -184,6 +184,7 @@
<return type="bool" />
<argument index="0" name="right" type="Rect2i" />
<description>
+ Returns [code]true[/code] if the rectangles are not equal.
</description>
</operator>
<operator name="operator ==">
@@ -195,6 +196,7 @@
<return type="bool" />
<argument index="0" name="right" type="Rect2i" />
<description>
+ Returns [code]true[/code] if the rectangles are equal.
</description>
</operator>
</operators>
diff --git a/doc/classes/Transform2D.xml b/doc/classes/Transform2D.xml
index 92122beb9d..be41cdde99 100644
--- a/doc/classes/Transform2D.xml
+++ b/doc/classes/Transform2D.xml
@@ -213,30 +213,36 @@
<return type="bool" />
<argument index="0" name="right" type="Transform2D" />
<description>
+ Returns [code]true[/code] if the transforms are not equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator *">
<return type="PackedVector2Array" />
<argument index="0" name="right" type="PackedVector2Array" />
<description>
+ Transforms (multiplies) each element of the [Vector2] array by the given [Transform2D] matrix.
</description>
</operator>
<operator name="operator *">
<return type="Transform2D" />
<argument index="0" name="right" type="Transform2D" />
<description>
+ Composes these two transformation matrices by multiplying them together. This has the effect of transforming the second transform (the child) by the first transform (the parent).
</description>
</operator>
<operator name="operator *">
<return type="Rect2" />
<argument index="0" name="right" type="Rect2" />
<description>
+ Transforms (multiplies) the [Rect2] by the given [Transform2D] matrix.
</description>
</operator>
<operator name="operator *">
<return type="Vector2" />
<argument index="0" name="right" type="Vector2" />
<description>
+ Transforms (multiplies) the [Vector2] by the given [Transform2D] matrix.
</description>
</operator>
<operator name="operator *">
@@ -262,12 +268,15 @@
<return type="bool" />
<argument index="0" name="right" type="Transform2D" />
<description>
+ Returns [code]true[/code] if the transforms are exactly equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator []">
<return type="Vector2" />
<argument index="0" name="index" type="int" />
<description>
+ Access transform components using their index. [code]t[0][/code] is equivalent to [code]t.x[/code], [code]t[1][/code] is equivalent to [code]t.y[/code], and [code]t[2][/code] is equivalent to [code]t.origin[/code].
</description>
</operator>
</operators>
diff --git a/doc/classes/Transform3D.xml b/doc/classes/Transform3D.xml
index 13df85c786..511574f6aa 100644
--- a/doc/classes/Transform3D.xml
+++ b/doc/classes/Transform3D.xml
@@ -147,30 +147,36 @@
<return type="bool" />
<argument index="0" name="right" type="Transform3D" />
<description>
+ Returns [code]true[/code] if the transforms are not equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator *">
<return type="PackedVector3Array" />
<argument index="0" name="right" type="PackedVector3Array" />
<description>
+ Transforms (multiplies) each element of the [Vector3] array by the given [Transform3D] matrix.
</description>
</operator>
<operator name="operator *">
<return type="Transform3D" />
<argument index="0" name="right" type="Transform3D" />
<description>
+ Composes these two transformation matrices by multiplying them together. This has the effect of transforming the second transform (the child) by the first transform (the parent).
</description>
</operator>
<operator name="operator *">
<return type="AABB" />
<argument index="0" name="right" type="AABB" />
<description>
+ Transforms (multiplies) the [AABB] by the given [Transform3D] matrix.
</description>
</operator>
<operator name="operator *">
<return type="Vector3" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Transforms (multiplies) the [Vector3] by the given [Transform3D] matrix.
</description>
</operator>
<operator name="operator *">
@@ -196,6 +202,8 @@
<return type="bool" />
<argument index="0" name="right" type="Transform3D" />
<description>
+ Returns [code]true[/code] if the transforms are exactly equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
</operators>
diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml
index 52f8f327f0..595af6222c 100644
--- a/doc/classes/Vector2.xml
+++ b/doc/classes/Vector2.xml
@@ -352,72 +352,97 @@
<return type="bool" />
<argument index="0" name="right" type="Vector2" />
<description>
+ Returns [code]true[/code] if the vectors are not equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator *">
<return type="Vector2" />
<argument index="0" name="right" type="Vector2" />
<description>
+ Multiplies each component of the [Vector2] by the components of the given [Vector2].
+ [codeblock]
+ print(Vector2(10, 20) * Vector2(3, 4)) # Prints "(30, 80)"
+ [/codeblock]
</description>
</operator>
<operator name="operator *">
<return type="Vector2" />
<argument index="0" name="right" type="Transform2D" />
<description>
+ Inversely transforms (multiplies) the [Vector2] by the given [Transform2D] transformation matrix.
</description>
</operator>
<operator name="operator *">
<return type="Vector2" />
<argument index="0" name="right" type="float" />
<description>
+ Multiplies each component of the [Vector2] by the given [float].
</description>
</operator>
<operator name="operator *">
<return type="Vector2" />
<argument index="0" name="right" type="int" />
<description>
+ Multiplies each component of the [Vector2] by the given [int].
</description>
</operator>
<operator name="operator +">
<return type="Vector2" />
<argument index="0" name="right" type="Vector2" />
<description>
+ Adds each component of the [Vector2] by the components of the given [Vector2].
+ [codeblock]
+ print(Vector2(10, 20) + Vector2(3, 4)) # Prints "(13, 24)"
+ [/codeblock]
</description>
</operator>
<operator name="operator -">
<return type="Vector2" />
<argument index="0" name="right" type="Vector2" />
<description>
+ Subtracts each component of the [Vector2] by the components of the given [Vector2].
+ [codeblock]
+ print(Vector2(10, 20) - Vector2(3, 4)) # Prints "(7, 16)"
+ [/codeblock]
</description>
</operator>
<operator name="operator /">
<return type="Vector2" />
<argument index="0" name="right" type="Vector2" />
<description>
+ Divides each component of the [Vector2] by the components of the given [Vector2].
+ [codeblock]
+ print(Vector2(10, 20) / Vector2(2, 5)) # Prints "(5, 4)"
+ [/codeblock]
</description>
</operator>
<operator name="operator /">
<return type="Vector2" />
<argument index="0" name="right" type="float" />
<description>
+ Divides each component of the [Vector2] by the given [float].
</description>
</operator>
<operator name="operator /">
<return type="Vector2" />
<argument index="0" name="right" type="int" />
<description>
+ Divides each component of the [Vector2] by the given [int].
</description>
</operator>
<operator name="operator &lt;">
<return type="bool" />
<argument index="0" name="right" type="Vector2" />
<description>
+ Compares two [Vector2] vectors by first checking if the X value of the left vector is less than the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator &lt;=">
<return type="bool" />
<argument index="0" name="right" type="Vector2" />
<description>
+ Compares two [Vector2] vectors by first checking if the X value of the left vector is less than or equal to the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator ==">
@@ -429,34 +454,41 @@
<return type="bool" />
<argument index="0" name="right" type="Vector2" />
<description>
+ Returns [code]true[/code] if the vectors are exactly equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator &gt;">
<return type="bool" />
<argument index="0" name="right" type="Vector2" />
<description>
+ Compares two [Vector2] vectors by first checking if the X value of the left vector is greater than the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator &gt;=">
<return type="bool" />
<argument index="0" name="right" type="Vector2" />
<description>
+ Compares two [Vector2] vectors by first checking if the X value of the left vector is greater than or equal to the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator []">
<return type="float" />
<argument index="0" name="index" type="int" />
<description>
+ Access vector components using their index. [code]v[0][/code] is equivalent to [code]v.x[/code], and [code]v[1][/code] is equivalent to [code]v.y[/code].
</description>
</operator>
<operator name="operator unary+">
<return type="Vector2" />
<description>
+ Returns the same value as if the [code]+[/code] was not there. Unary [code]+[/code] does nothing, but sometimes it can make your code more readable.
</description>
</operator>
<operator name="operator unary-">
<return type="Vector2" />
<description>
+ Returns the negative value of the [Vector2]. This is the same as writing [code]Vector2(-v.x, -v.y)[/code]. This operation flips the direction of the vector while keeping the same magnitude. With floats, the number zero can be either positive or negative.
</description>
</operator>
</operators>
diff --git a/doc/classes/Vector2i.xml b/doc/classes/Vector2i.xml
index 7179b6196e..62362409a5 100644
--- a/doc/classes/Vector2i.xml
+++ b/doc/classes/Vector2i.xml
@@ -115,78 +115,115 @@
<return type="bool" />
<argument index="0" name="right" type="Vector2i" />
<description>
+ Returns [code]true[/code] if the vectors are not equal.
</description>
</operator>
<operator name="operator %">
<return type="Vector2i" />
<argument index="0" name="right" type="Vector2i" />
<description>
+ Gets the remainder of each component of the [Vector2i] with the components of the given [Vector2i]. This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using [method @GlobalScope.posmod] instead if you want to handle negative numbers.
+ [codeblock]
+ print(Vector2i(10, -20) % Vector2i(7, 8)) # Prints "(3, -4)"
+ [/codeblock]
</description>
</operator>
<operator name="operator %">
<return type="Vector2i" />
<argument index="0" name="right" type="int" />
<description>
+ Gets the remainder of each component of the [Vector2i] with the the given [int]. This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using [method @GlobalScope.posmod] instead if you want to handle negative numbers.
+ [codeblock]
+ print(Vector2i(10, -20) % 7) # Prints "(3, -6)"
+ [/codeblock]
</description>
</operator>
<operator name="operator *">
<return type="Vector2i" />
<argument index="0" name="right" type="Vector2i" />
<description>
+ Multiplies each component of the [Vector2i] by the components of the given [Vector2i].
+ [codeblock]
+ print(Vector2i(10, 20) * Vector2i(3, 4)) # Prints "(30, 80)"
+ [/codeblock]
</description>
</operator>
<operator name="operator *">
<return type="Vector2i" />
<argument index="0" name="right" type="float" />
<description>
+ Multiplies each component of the [Vector2i] by the given [float] truncated to an integer.
+ [codeblock]
+ print(Vector2i(10, 20) * 0.9) # Prints "(0, 0)"
+ [/codeblock]
</description>
</operator>
<operator name="operator *">
<return type="Vector2i" />
<argument index="0" name="right" type="int" />
<description>
+ Multiplies each component of the [Vector2i] by the given [int].
</description>
</operator>
<operator name="operator +">
<return type="Vector2i" />
<argument index="0" name="right" type="Vector2i" />
<description>
+ Adds each component of the [Vector2i] by the components of the given [Vector2i].
+ [codeblock]
+ print(Vector2i(10, 20) + Vector2i(3, 4)) # Prints "(13, 24)"
+ [/codeblock]
</description>
</operator>
<operator name="operator -">
<return type="Vector2i" />
<argument index="0" name="right" type="Vector2i" />
<description>
+ Subtracts each component of the [Vector2i] by the components of the given [Vector2i].
+ [codeblock]
+ print(Vector2i(10, 20) - Vector2i(3, 4)) # Prints "(7, 16)"
+ [/codeblock]
</description>
</operator>
<operator name="operator /">
<return type="Vector2i" />
<argument index="0" name="right" type="Vector2i" />
<description>
+ Divides each component of the [Vector2i] by the components of the given [Vector2i].
+ [codeblock]
+ print(Vector2i(10, 20) / Vector2i(2, 5)) # Prints "(5, 4)"
+ [/codeblock]
</description>
</operator>
<operator name="operator /">
<return type="Vector2i" />
<argument index="0" name="right" type="float" />
<description>
+ Divides each component of the [Vector2i] by the given [float] truncated to an integer.
+ [codeblock]
+ print(Vector2i(10, 20) / 2.9) # Prints "(5, 10)"
+ [/codeblock]
</description>
</operator>
<operator name="operator /">
<return type="Vector2i" />
<argument index="0" name="right" type="int" />
<description>
+ Divides each component of the [Vector2i] by the given [int].
</description>
</operator>
<operator name="operator &lt;">
<return type="bool" />
<argument index="0" name="right" type="Vector2i" />
<description>
+ Compares two [Vector2i] vectors by first checking if the X value of the left vector is less than the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator &lt;=">
<return type="bool" />
<argument index="0" name="right" type="Vector2i" />
<description>
+ Compares two [Vector2i] vectors by first checking if the X value of the left vector is less than or equal to the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator ==">
@@ -198,34 +235,40 @@
<return type="bool" />
<argument index="0" name="right" type="Vector2i" />
<description>
+ Returns [code]true[/code] if the vectors are equal.
</description>
</operator>
<operator name="operator &gt;">
<return type="bool" />
<argument index="0" name="right" type="Vector2i" />
<description>
+ Compares two [Vector2i] vectors by first checking if the X value of the left vector is greater than the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator &gt;=">
<return type="bool" />
<argument index="0" name="right" type="Vector2i" />
<description>
+ Compares two [Vector2i] vectors by first checking if the X value of the left vector is greater than or equal to the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator []">
<return type="int" />
<argument index="0" name="index" type="int" />
<description>
+ Access vector components using their index. [code]v[0][/code] is equivalent to [code]v.x[/code], and [code]v[1][/code] is equivalent to [code]v.y[/code].
</description>
</operator>
<operator name="operator unary+">
<return type="Vector2i" />
<description>
+ Returns the same value as if the [code]+[/code] was not there. Unary [code]+[/code] does nothing, but sometimes it can make your code more readable.
</description>
</operator>
<operator name="operator unary-">
<return type="Vector2i" />
<description>
+ Returns the negative value of the [Vector2i]. This is the same as writing [code]Vector2i(-v.x, -v.y)[/code]. This operation flips the direction of the vector while keeping the same magnitude.
</description>
</operator>
</operators>
diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml
index 309fe08aa2..62d467c505 100644
--- a/doc/classes/Vector3.xml
+++ b/doc/classes/Vector3.xml
@@ -367,84 +367,111 @@
<return type="bool" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Returns [code]true[/code] if the vectors are not equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator *">
<return type="Vector3" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Multiplies each component of the [Vector3] by the components of the given [Vector3].
+ [codeblock]
+ print(Vector3(10, 20, 30) * Vector3(3, 4, 5)) # Prints "(30, 80, 150)"
+ [/codeblock]
</description>
</operator>
<operator name="operator *">
<return type="Vector3" />
<argument index="0" name="right" type="Basis" />
<description>
+ Inversely transforms (multiplies) the [Vector3] by the given [Basis] matrix.
</description>
</operator>
<operator name="operator *">
<return type="Vector3" />
<argument index="0" name="right" type="Quaternion" />
<description>
+ Inversely transforms (multiplies) the [Vector3] by the given [Quaternion].
</description>
</operator>
<operator name="operator *">
<return type="Vector3" />
<argument index="0" name="right" type="Transform3D" />
<description>
+ Inversely transforms (multiplies) the [Vector3] by the given [Transform3D] transformation matrix.
</description>
</operator>
<operator name="operator *">
<return type="Vector3" />
<argument index="0" name="right" type="float" />
<description>
+ Multiplies each component of the [Vector3] by the given [float].
</description>
</operator>
<operator name="operator *">
<return type="Vector3" />
<argument index="0" name="right" type="int" />
<description>
+ Multiplies each component of the [Vector3] by the given [int].
</description>
</operator>
<operator name="operator +">
<return type="Vector3" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Adds each component of the [Vector3] by the components of the given [Vector3].
+ [codeblock]
+ print(Vector3(10, 20, 30) + Vector3(3, 4, 5)) # Prints "(13, 24, 35)"
+ [/codeblock]
</description>
</operator>
<operator name="operator -">
<return type="Vector3" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Subtracts each component of the [Vector3] by the components of the given [Vector3].
+ [codeblock]
+ print(Vector3(10, 20, 30) - Vector3(3, 4, 5)) # Prints "(7, 16, 25)"
+ [/codeblock]
</description>
</operator>
<operator name="operator /">
<return type="Vector3" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Divides each component of the [Vector3] by the components of the given [Vector3].
+ [codeblock]
+ print(Vector3(10, 20, 30) / Vector3(2, 5, 3)) # Prints "(5, 4, 10)"
+ [/codeblock]
</description>
</operator>
<operator name="operator /">
<return type="Vector3" />
<argument index="0" name="right" type="float" />
<description>
+ Divides each component of the [Vector3] by the given [float].
</description>
</operator>
<operator name="operator /">
<return type="Vector3" />
<argument index="0" name="right" type="int" />
<description>
+ Divides each component of the [Vector3] by the given [int].
</description>
</operator>
<operator name="operator &lt;">
<return type="bool" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Compares two [Vector3] vectors by first checking if the X value of the left vector is less than the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator &lt;=">
<return type="bool" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Compares two [Vector3] vectors by first checking if the X value of the left vector is less than or equal to the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator ==">
@@ -456,34 +483,41 @@
<return type="bool" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Returns [code]true[/code] if the vectors are exactly equal.
+ [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
</description>
</operator>
<operator name="operator &gt;">
<return type="bool" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Compares two [Vector3] vectors by first checking if the X value of the left vector is greater than the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator &gt;=">
<return type="bool" />
<argument index="0" name="right" type="Vector3" />
<description>
+ Compares two [Vector3] vectors by first checking if the X value of the left vector is greater than or equal to the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator []">
<return type="float" />
<argument index="0" name="index" type="int" />
<description>
+ Access vector components using their index. [code]v[0][/code] is equivalent to [code]v.x[/code], [code]v[1][/code] is equivalent to [code]v.y[/code], and [code]v[2][/code] is equivalent to [code]v.z[/code].
</description>
</operator>
<operator name="operator unary+">
<return type="Vector3" />
<description>
+ Returns the same value as if the [code]+[/code] was not there. Unary [code]+[/code] does nothing, but sometimes it can make your code more readable.
</description>
</operator>
<operator name="operator unary-">
<return type="Vector3" />
<description>
+ Returns the negative value of the [Vector3]. This is the same as writing [code]Vector3(-v.x, -v.y, -v.z)[/code]. This operation flips the direction of the vector while keeping the same magnitude. With floats, the number zero can be either positive or negative.
</description>
</operator>
</operators>
diff --git a/doc/classes/Vector3i.xml b/doc/classes/Vector3i.xml
index 0500ab9a00..17febdea83 100644
--- a/doc/classes/Vector3i.xml
+++ b/doc/classes/Vector3i.xml
@@ -133,78 +133,115 @@
<return type="bool" />
<argument index="0" name="right" type="Vector3i" />
<description>
+ Returns [code]true[/code] if the vectors are not equal.
</description>
</operator>
<operator name="operator %">
<return type="Vector3i" />
<argument index="0" name="right" type="Vector3i" />
<description>
+ Gets the remainder of each component of the [Vector3i] with the components of the given [Vector3i]. This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using [method @GlobalScope.posmod] instead if you want to handle negative numbers.
+ [codeblock]
+ print(Vector3i(10, -20, 30) % Vector3i(7, 8, 9)) # Prints "(3, -4, 3)"
+ [/codeblock]
</description>
</operator>
<operator name="operator %">
<return type="Vector3i" />
<argument index="0" name="right" type="int" />
<description>
+ Gets the remainder of each component of the [Vector3i] with the the given [int]. This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using [method @GlobalScope.posmod] instead if you want to handle negative numbers.
+ [codeblock]
+ print(Vector2i(10, -20, 30) % 7) # Prints "(3, -6, 2)"
+ [/codeblock]
</description>
</operator>
<operator name="operator *">
<return type="Vector3i" />
<argument index="0" name="right" type="Vector3i" />
<description>
+ Multiplies each component of the [Vector3i] by the components of the given [Vector3i].
+ [codeblock]
+ print(Vector3i(10, 20, 30) * Vector3i(3, 4, 5)) # Prints "(30, 80, 150)"
+ [/codeblock]
</description>
</operator>
<operator name="operator *">
<return type="Vector3i" />
<argument index="0" name="right" type="float" />
<description>
+ Multiplies each component of the [Vector3i] by the given [float] truncated to an integer.
+ [codeblock]
+ print(Vector3i(10, 20, 30) * 0.9) # Prints "(0, 0, 0)"
+ [/codeblock]
</description>
</operator>
<operator name="operator *">
<return type="Vector3i" />
<argument index="0" name="right" type="int" />
<description>
+ Multiplies each component of the [Vector3i] by the given [int].
</description>
</operator>
<operator name="operator +">
<return type="Vector3i" />
<argument index="0" name="right" type="Vector3i" />
<description>
+ Adds each component of the [Vector3i] by the components of the given [Vector3i].
+ [codeblock]
+ print(Vector3i(10, 20, 30) + Vector3i(3, 4, 5)) # Prints "(13, 24, 35)"
+ [/codeblock]
</description>
</operator>
<operator name="operator -">
<return type="Vector3i" />
<argument index="0" name="right" type="Vector3i" />
<description>
+ Subtracts each component of the [Vector3i] by the components of the given [Vector3i].
+ [codeblock]
+ print(Vector3i(10, 20, 30) - Vector3i(3, 4, 5)) # Prints "(7, 16, 25)"
+ [/codeblock]
</description>
</operator>
<operator name="operator /">
<return type="Vector3i" />
<argument index="0" name="right" type="Vector3i" />
<description>
+ Divides each component of the [Vector3i] by the components of the given [Vector3i].
+ [codeblock]
+ print(Vector3i(10, 20, 30) / Vector3i(2, 5, 3)) # Prints "(5, 4, 10)"
+ [/codeblock]
</description>
</operator>
<operator name="operator /">
<return type="Vector3i" />
<argument index="0" name="right" type="float" />
<description>
+ Divides each component of the [Vector3i] by the given [float] truncated to an integer.
+ [codeblock]
+ print(Vector3i(10, 20, 30) / 2.9) # Prints "(5, 10, 15)"
+ [/codeblock]
</description>
</operator>
<operator name="operator /">
<return type="Vector3i" />
<argument index="0" name="right" type="int" />
<description>
+ Divides each component of the [Vector3i] by the given [int].
</description>
</operator>
<operator name="operator &lt;">
<return type="bool" />
<argument index="0" name="right" type="Vector3i" />
<description>
+ Compares two [Vector3i] vectors by first checking if the X value of the left vector is less than the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator &lt;=">
<return type="bool" />
<argument index="0" name="right" type="Vector3i" />
<description>
+ Compares two [Vector3i] vectors by first checking if the X value of the left vector is less than or equal to the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator ==">
@@ -216,34 +253,40 @@
<return type="bool" />
<argument index="0" name="right" type="Vector3i" />
<description>
+ Returns [code]true[/code] if the vectors are equal.
</description>
</operator>
<operator name="operator &gt;">
<return type="bool" />
<argument index="0" name="right" type="Vector3i" />
<description>
+ Compares two [Vector3i] vectors by first checking if the X value of the left vector is greater than the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator &gt;=">
<return type="bool" />
<argument index="0" name="right" type="Vector3i" />
<description>
+ Compares two [Vector3i] vectors by first checking if the X value of the left vector is greater than or equal to the X value of the [code]right[/code] vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors.
</description>
</operator>
<operator name="operator []">
<return type="int" />
<argument index="0" name="index" type="int" />
<description>
+ Access vector components using their index. [code]v[0][/code] is equivalent to [code]v.x[/code], [code]v[1][/code] is equivalent to [code]v.y[/code], and [code]v[2][/code] is equivalent to [code]v.z[/code].
</description>
</operator>
<operator name="operator unary+">
<return type="Vector3i" />
<description>
+ Returns the same value as if the [code]+[/code] was not there. Unary [code]+[/code] does nothing, but sometimes it can make your code more readable.
</description>
</operator>
<operator name="operator unary-">
<return type="Vector3i" />
<description>
+ Returns the negative value of the [Vector3i]. This is the same as writing [code]Vector3i(-v.x, -v.y, -v.z)[/code]. This operation flips the direction of the vector while keeping the same magnitude.
</description>
</operator>
</operators>
diff --git a/doc/classes/float.xml b/doc/classes/float.xml
index 8231173bac..c96360e6ba 100644
--- a/doc/classes/float.xml
+++ b/doc/classes/float.xml
@@ -72,7 +72,7 @@
<return type="Quaternion" />
<argument index="0" name="right" type="Quaternion" />
<description>
- Multiplies each component of the [Quaternion] by the given [float].
+ Multiplies each component of the [Quaternion] by the given [float]. This operation is not meaningful on its own, but it can be used as a part of a larger expression.
</description>
</operator>
<operator name="operator *">
@@ -81,7 +81,7 @@
<description>
Multiplies each component of the [Vector2] by the given [float].
[codeblock]
- print(2.5 * Vector2(1, 1)) # Vector2(2.5, 2.5)
+ print(2.5 * Vector2(1, 3)) # Prints "(2.5, 7.5)"
[/codeblock]
</description>
</operator>
@@ -89,9 +89,9 @@
<return type="Vector2i" />
<argument index="0" name="right" type="Vector2i" />
<description>
- Multiplies each component of the [Vector2i] by the given [float].
+ Multiplies each component of the [Vector2i] by the given [float] truncated to an integer.
[codeblock]
- print(2.0 * Vector2i(1, 1)) # Vector2i(2.0, 2.0)
+ print(0.9 * Vector2i(10, 20)) # Prints "(0, 0)"
[/codeblock]
</description>
</operator>
@@ -106,7 +106,10 @@
<return type="Vector3i" />
<argument index="0" name="right" type="Vector3i" />
<description>
- Multiplies each component of the [Vector3i] by the given [float].
+ Multiplies each component of the [Vector3i] by the given [float] truncated to an integer.
+ [codeblock]
+ print(0.9 * Vector3i(10, 20, 30)) # Prints "(0, 0, 0)"
+ [/codeblock]
</description>
</operator>
<operator name="operator *">
diff --git a/doc/classes/int.xml b/doc/classes/int.xml
index 94c2601e4a..bb36d83741 100644
--- a/doc/classes/int.xml
+++ b/doc/classes/int.xml
@@ -91,11 +91,11 @@
<return type="int" />
<argument index="0" name="right" type="int" />
<description>
- Returns the result of the modulo operator for two integers, i.e. the remainder after dividing both numbers.
+ Returns the remainder after dividing two integers. This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using [method @GlobalScope.posmod] instead if you want to handle negative numbers.
[codeblock]
print(5 % 2) # 1
print(12 % 4) # 0
- print(12 % 2) # 2
+ print(-5 % 3) # -2
[/codeblock]
</description>
</operator>
@@ -121,12 +121,14 @@
<return type="Color" />
<argument index="0" name="right" type="Color" />
<description>
+ Multiplies each component of the [Color] by the given [int].
</description>
</operator>
<operator name="operator *">
<return type="Quaternion" />
<argument index="0" name="right" type="Quaternion" />
<description>
+ Multiplies each component of the [Quaternion] by the given [int]. This operation is not meaningful on its own, but it can be used as a part of a larger expression.
</description>
</operator>
<operator name="operator *">
diff --git a/drivers/wasapi/audio_driver_wasapi.cpp b/drivers/wasapi/audio_driver_wasapi.cpp
index 520d4808fb..403feb149e 100644
--- a/drivers/wasapi/audio_driver_wasapi.cpp
+++ b/drivers/wasapi/audio_driver_wasapi.cpp
@@ -387,14 +387,17 @@ Error AudioDriverWASAPI::audio_device_init(AudioDeviceWASAPI *p_device, bool p_c
ERR_FAIL_COND_V(hr != S_OK, ERR_CANT_OPEN);
// Due to WASAPI Shared Mode we have no control of the buffer size
- buffer_frames = max_frames;
-
- int64_t latency = 0;
- audio_output.audio_client->GetStreamLatency(&latency);
- // WASAPI REFERENCE_TIME units are 100 nanoseconds per unit
- // https://docs.microsoft.com/en-us/windows/win32/directshow/reference-time
- // Convert REFTIME to seconds as godot uses for latency
- real_latency = (float)latency / (float)REFTIMES_PER_SEC;
+ if (!p_capture) {
+ buffer_frames = max_frames;
+
+ int64_t latency = 0;
+ audio_output.audio_client->GetStreamLatency(&latency);
+ // WASAPI REFERENCE_TIME units are 100 nanoseconds per unit
+ // https://docs.microsoft.com/en-us/windows/win32/directshow/reference-time
+ // Convert REFTIME to seconds as godot uses for latency
+ real_latency = (float)latency / (float)REFTIMES_PER_SEC;
+ }
+
} else {
IAudioClient3 *device_audio_client_3 = (IAudioClient3 *)p_device->audio_client;
diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp
index 9581c3cd45..3ca3576de6 100644
--- a/editor/action_map_editor.cpp
+++ b/editor/action_map_editor.cpp
@@ -260,7 +260,7 @@ void InputEventConfigurationDialog::_listen_window_input(const Ref<InputEvent> &
return;
} else {
// Always make the value 1 or -1 for display consistency
- joym->set_axis_value(SGN(axis_value));
+ joym->set_axis_value(SIGN(axis_value));
}
}
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp
index e9cf22af85..f7f88ad0d5 100644
--- a/editor/animation_bezier_editor.cpp
+++ b/editor/animation_bezier_editor.cpp
@@ -187,7 +187,7 @@ void AnimationBezierTrackEdit::_draw_line_clipped(const Vector2 &p_from, const V
Vector2 from = p_from;
Vector2 to = p_to;
- if (from.x == to.x) {
+ if (from.x == to.x && from.y == to.y) {
return;
}
if (to.x < from.x) {
@@ -222,11 +222,6 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
bezier_icon = get_theme_icon(SNAME("KeyBezierPoint"), SNAME("EditorIcons"));
bezier_handle_icon = get_theme_icon(SNAME("KeyBezierHandle"), SNAME("EditorIcons"));
selected_icon = get_theme_icon(SNAME("KeyBezierSelected"), SNAME("EditorIcons"));
- if (handle_mode_option->get_item_count() == 0) {
- handle_mode_option->add_icon_item(get_theme_icon(SNAME("BezierHandlesFree"), SNAME("EditorIcons")), TTR("Free"), HANDLE_MODE_FREE);
- handle_mode_option->add_icon_item(get_theme_icon(SNAME("BezierHandlesBalanced"), SNAME("EditorIcons")), TTR("Balanced"), HANDLE_MODE_BALANCED);
- handle_mode_option->add_icon_item(get_theme_icon(SNAME("BezierHandlesMirror"), SNAME("EditorIcons")), TTR("Mirror"), HANDLE_MODE_MIRROR);
- }
}
if (p_what == NOTIFICATION_RESIZED) {
int right_limit = get_size().width - timeline->get_buttons_width();
@@ -420,9 +415,9 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
//draw editor handles
{
- float scale = timeline->get_zoom_scale();
edit_points.clear();
+ float scale = timeline->get_zoom_scale();
for (int i = 0; i < animation->track_get_key_count(track); i++) {
float offset = animation->track_get_key_time(track, i);
float value = animation->bezier_track_get_key_value(track, i);
@@ -438,7 +433,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
if (moving_handle != 0 && moving_handle_key == i) {
in_vec = moving_handle_left;
}
- Vector2 pos_in = Vector2(((offset + in_vec.x) - timeline->get_value()) * scale + limit, _bezier_h_to_pixel(value + in_vec.y));
+ Vector2 pos_in(((offset + in_vec.x) - timeline->get_value()) * scale + limit, _bezier_h_to_pixel(value + in_vec.y));
Vector2 out_vec = animation->bezier_track_get_key_out_handle(track, i);
@@ -446,7 +441,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
out_vec = moving_handle_right;
}
- Vector2 pos_out = Vector2(((offset + out_vec.x) - timeline->get_value()) * scale + limit, _bezier_h_to_pixel(value + out_vec.y));
+ Vector2 pos_out(((offset + out_vec.x) - timeline->get_value()) * scale + limit, _bezier_h_to_pixel(value + out_vec.y));
_draw_line_clipped(pos, pos_in, accent, limit, right_limit);
_draw_line_clipped(pos, pos_out, accent, limit, right_limit);
@@ -581,11 +576,21 @@ void AnimationBezierTrackEdit::_clear_selection() {
update();
}
+void AnimationBezierTrackEdit::_change_selected_keys_handle_mode(Animation::HandleMode p_mode) {
+ undo_redo->create_action(TTR("Update Selected Key Handles"));
+ double ratio = timeline->get_zoom_scale() * v_zoom;
+ for (Set<int>::Element *E = selection.back(); E; E = E->prev()) {
+ const int key_index = E->get();
+ undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_handle_mode", track, key_index, animation->bezier_track_get_key_handle_mode(track, key_index), ratio);
+ undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_handle_mode", track, key_index, p_mode, ratio);
+ }
+ undo_redo->commit_action();
+}
+
void AnimationBezierTrackEdit::_clear_selection_for_anim(const Ref<Animation> &p_anim) {
if (!(animation == p_anim)) {
return;
}
- //selection.clear();
_clear_selection();
}
@@ -667,6 +672,9 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
menu->add_icon_item(get_theme_icon(SNAME("Duplicate"), SNAME("EditorIcons")), TTR("Duplicate Selected Key(s)"), MENU_KEY_DUPLICATE);
menu->add_separator();
menu->add_icon_item(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), TTR("Delete Selected Key(s)"), MENU_KEY_DELETE);
+ menu->add_separator();
+ menu->add_icon_item(get_theme_icon(SNAME("BezierHandlesFree"), SNAME("EditorIcons")), TTR("Make Handles Free"), MENU_KEY_SET_HANDLE_FREE);
+ menu->add_icon_item(get_theme_icon(SNAME("BezierHandlesBalanced"), SNAME("EditorIcons")), TTR("Make Handles Balanced"), MENU_KEY_SET_HANDLE_BALANCED);
}
menu->set_as_minsize();
@@ -676,10 +684,6 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
}
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
- if (close_icon_rect.has_point(mb->get_position())) {
- emit_signal(SNAME("close_request"));
- return;
- }
for (const KeyValue<int, Rect2> &E : subtracks) {
if (E.value.has_point(mb->get_position())) {
set_animation_and_track(animation, E.key);
@@ -746,7 +750,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
//insert new point
if (mb->is_command_pressed() && mb->get_position().x >= timeline->get_name_limit() && mb->get_position().x < get_size().width - timeline->get_buttons_width()) {
Array new_point;
- new_point.resize(5);
+ new_point.resize(6);
float h = (get_size().height / 2 - mb->get_position().y) * v_zoom + v_scroll;
@@ -755,6 +759,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
new_point[2] = 0;
new_point[3] = 0.25;
new_point[4] = 0;
+ new_point[5] = 0;
float time = ((mb->get_position().x - timeline->get_name_limit()) / timeline->get_zoom_scale()) + timeline->get_value();
while (animation->track_find_key(track, time, true) != -1) {
@@ -986,33 +991,49 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
if (moving_handle == -1) {
moving_handle_left = moving_handle_value;
- if (moving_handle_left.x > 0) {
- moving_handle_left.x = 0;
- }
- if (handle_mode_option->get_selected() == HANDLE_MODE_BALANCED) {
- Vector2 scale = Vector2(timeline->get_zoom_scale(), v_zoom);
- moving_handle_right = (-(moving_handle_left * scale).normalized() * (moving_handle_right * scale).length()) / scale;
+ if (animation->bezier_track_get_key_handle_mode(track, moving_handle_key) == Animation::HANDLE_MODE_BALANCED) {
+ double ratio = timeline->get_zoom_scale() * v_zoom;
+ Transform2D xform;
+ xform.set_scale(Vector2(1.0, 1.0 / ratio));
- } else if (handle_mode_option->get_selected() == HANDLE_MODE_MIRROR) {
- moving_handle_right = -moving_handle_left;
- }
- }
+ Vector2 vec_out = xform.xform(moving_handle_right);
+ Vector2 vec_in = xform.xform(moving_handle_left);
- if (moving_handle == 1) {
- moving_handle_right = moving_handle_value;
- if (moving_handle_right.x < 0) {
- moving_handle_right.x = 0;
+ moving_handle_right = xform.affine_inverse().xform(-vec_in.normalized() * vec_out.length());
}
+ } else if (moving_handle == 1) {
+ moving_handle_right = moving_handle_value;
+
+ if (animation->bezier_track_get_key_handle_mode(track, moving_handle_key) == Animation::HANDLE_MODE_BALANCED) {
+ double ratio = timeline->get_zoom_scale() * v_zoom;
+ Transform2D xform;
+ xform.set_scale(Vector2(1.0, 1.0 / ratio));
- if (handle_mode_option->get_selected() == HANDLE_MODE_BALANCED) {
- Vector2 scale = Vector2(timeline->get_zoom_scale(), v_zoom);
- moving_handle_left = (-(moving_handle_right * scale).normalized() * (moving_handle_left * scale).length()) / scale;
- } else if (handle_mode_option->get_selected() == HANDLE_MODE_MIRROR) {
- moving_handle_left = -moving_handle_right;
+ Vector2 vec_in = xform.xform(moving_handle_left);
+ Vector2 vec_out = xform.xform(moving_handle_right);
+
+ moving_handle_left = xform.affine_inverse().xform(-vec_out.normalized() * vec_in.length());
}
}
+ update();
+ }
+
+ bool is_finishing_key_handle_drag = moving_handle != 0 && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT;
+ if (is_finishing_key_handle_drag) {
+ undo_redo->create_action(TTR("Move Bezier Points"));
+ if (moving_handle == -1) {
+ double ratio = timeline->get_zoom_scale() * v_zoom;
+ undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_in_handle", track, moving_handle_key, moving_handle_left, ratio);
+ undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_in_handle", track, moving_handle_key, animation->bezier_track_get_key_in_handle(track, moving_handle_key), ratio);
+ } else if (moving_handle == 1) {
+ double ratio = timeline->get_zoom_scale() * v_zoom;
+ undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_out_handle", track, moving_handle_key, moving_handle_right, ratio);
+ undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_out_handle", track, moving_handle_key, animation->bezier_track_get_key_out_handle(track, moving_handle_key), ratio);
+ }
+ undo_redo->commit_action();
+ moving_handle = 0;
update();
}
}
@@ -1021,7 +1042,7 @@ void AnimationBezierTrackEdit::_menu_selected(int p_index) {
switch (p_index) {
case MENU_KEY_INSERT: {
Array new_point;
- new_point.resize(5);
+ new_point.resize(6);
float h = (get_size().height / 2 - menu_insert_key.y) * v_zoom + v_scroll;
@@ -1030,6 +1051,7 @@ void AnimationBezierTrackEdit::_menu_selected(int p_index) {
new_point[2] = 0;
new_point[3] = 0.25;
new_point[4] = 0;
+ new_point[5] = Animation::HANDLE_MODE_BALANCED;
float time = ((menu_insert_key.x - timeline->get_name_limit()) / timeline->get_zoom_scale()) + timeline->get_value();
while (animation->track_find_key(track, time, true) != -1) {
@@ -1048,6 +1070,12 @@ void AnimationBezierTrackEdit::_menu_selected(int p_index) {
case MENU_KEY_DELETE: {
delete_selection();
} break;
+ case MENU_KEY_SET_HANDLE_FREE: {
+ _change_selected_keys_handle_mode(Animation::HANDLE_MODE_FREE);
+ } break;
+ case MENU_KEY_SET_HANDLE_BALANCED: {
+ _change_selected_keys_handle_mode(Animation::HANDLE_MODE_BALANCED);
+ } break;
}
}
@@ -1118,6 +1146,7 @@ void AnimationBezierTrackEdit::delete_selection() {
undo_redo->add_do_method(this, "_clear_selection_for_anim", animation);
undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
undo_redo->commit_action();
+
//selection.clear();
}
}
@@ -1150,8 +1179,6 @@ AnimationBezierTrackEdit::AnimationBezierTrackEdit() {
set_focus_mode(FOCUS_CLICK);
set_clip_contents(true);
- handle_mode = HANDLE_MODE_FREE;
- handle_mode_option = memnew(OptionButton);
close_button = memnew(Button);
close_button->connect("pressed", Callable(this, SNAME("emit_signal")), varray(SNAME("close_request")));
@@ -1160,7 +1187,6 @@ AnimationBezierTrackEdit::AnimationBezierTrackEdit() {
right_column = memnew(VBoxContainer);
right_column->add_child(close_button);
right_column->add_spacer();
- right_column->add_child(handle_mode_option);
add_child(right_column);
menu = memnew(PopupMenu);
diff --git a/editor/animation_bezier_editor.h b/editor/animation_bezier_editor.h
index 578c6f9337..4b46777cfe 100644
--- a/editor/animation_bezier_editor.h
+++ b/editor/animation_bezier_editor.h
@@ -36,21 +36,14 @@
class AnimationBezierTrackEdit : public Control {
GDCLASS(AnimationBezierTrackEdit, Control);
- enum HandleMode {
- HANDLE_MODE_FREE,
- HANDLE_MODE_BALANCED,
- HANDLE_MODE_MIRROR
- };
-
enum {
MENU_KEY_INSERT,
MENU_KEY_DUPLICATE,
- MENU_KEY_DELETE
+ MENU_KEY_DELETE,
+ MENU_KEY_SET_HANDLE_FREE,
+ MENU_KEY_SET_HANDLE_BALANCED,
};
- HandleMode handle_mode;
- OptionButton *handle_mode_option;
-
VBoxContainer *right_column;
Button *close_button;
@@ -69,8 +62,6 @@ class AnimationBezierTrackEdit : public Control {
Ref<Texture2D> bezier_handle_icon;
Ref<Texture2D> selected_icon;
- Rect2 close_icon_rect;
-
Map<int, Rect2> subtracks;
float v_scroll = 0;
@@ -104,10 +95,12 @@ class AnimationBezierTrackEdit : public Control {
int moving_handle_key = 0;
Vector2 moving_handle_left;
Vector2 moving_handle_right;
+ int moving_handle_mode; // value from Animation::HandleMode
void _clear_selection();
void _clear_selection_for_anim(const Ref<Animation> &p_anim);
void _select_at_anim(const Ref<Animation> &p_anim, int p_track, float p_pos);
+ void _change_selected_keys_handle_mode(Animation::HandleMode p_mode);
Vector2 menu_insert_key;
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index f8f66d08d4..6fce55f8e3 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -334,6 +334,22 @@ public:
setting = false;
return true;
}
+
+ if (name == "handle_mode") {
+ const Variant &value = p_value;
+
+ setting = true;
+ undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
+ int prev = animation->bezier_track_get_key_handle_mode(track, key);
+ undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_handle_mode", track, key, value);
+ undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_handle_mode", track, key, prev);
+ undo_redo->add_do_method(this, "_update_obj", animation);
+ undo_redo->add_undo_method(this, "_update_obj", animation);
+ undo_redo->commit_action();
+
+ setting = false;
+ return true;
+ }
} break;
case Animation::TYPE_AUDIO: {
if (name == "stream") {
@@ -498,6 +514,11 @@ public:
return true;
}
+ if (name == "handle_mode") {
+ r_ret = animation->bezier_track_get_key_handle_mode(track, key);
+ return true;
+ }
+
} break;
case Animation::TYPE_AUDIO: {
if (name == "stream") {
@@ -610,6 +631,7 @@ public:
p_list->push_back(PropertyInfo(Variant::FLOAT, "value"));
p_list->push_back(PropertyInfo(Variant::VECTOR2, "in_handle"));
p_list->push_back(PropertyInfo(Variant::VECTOR2, "out_handle"));
+ p_list->push_back(PropertyInfo(Variant::INT, "handle_mode", PROPERTY_HINT_ENUM, "Free,Balanced"));
} break;
case Animation::TYPE_AUDIO: {
@@ -949,6 +971,17 @@ public:
undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_out_handle", track, key, value);
undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_out_handle", track, key, prev);
update_obj = true;
+ } else if (name == "handle_mode") {
+ const Variant &value = p_value;
+
+ if (!setting) {
+ setting = true;
+ undo_redo->create_action(TTR("Anim Multi Change Keyframe Value"), UndoRedo::MERGE_ENDS);
+ }
+ int prev = animation->bezier_track_get_key_handle_mode(track, key);
+ undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_handle_mode", track, key, value);
+ undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_handle_mode", track, key, prev);
+ update_obj = true;
}
} break;
case Animation::TYPE_AUDIO: {
@@ -1120,6 +1153,11 @@ public:
return true;
}
+ if (name == "handle_mode") {
+ r_ret = animation->bezier_track_get_key_handle_mode(track, key);
+ return true;
+ }
+
} break;
case Animation::TYPE_AUDIO: {
if (name == "stream") {
@@ -1273,6 +1311,7 @@ public:
p_list->push_back(PropertyInfo(Variant::FLOAT, "value"));
p_list->push_back(PropertyInfo(Variant::VECTOR2, "in_handle"));
p_list->push_back(PropertyInfo(Variant::VECTOR2, "out_handle"));
+ p_list->push_back(PropertyInfo(Variant::INT, "handle_mode", PROPERTY_HINT_ENUM, "Free,Balanced"));
} break;
case Animation::TYPE_AUDIO: {
p_list->push_back(PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE, "AudioStream"));
@@ -2607,6 +2646,17 @@ String AnimationTrackEdit::get_tooltip(const Point2 &p_pos) const {
text += "In-Handle: " + ih + "\n";
Vector2 oh = animation->bezier_track_get_key_out_handle(track, key_idx);
text += "Out-Handle: " + oh + "\n";
+ int hm = animation->bezier_track_get_key_handle_mode(track, key_idx);
+ text += "Handle mode: ";
+ switch (hm) {
+ case Animation::HANDLE_MODE_FREE: {
+ text += "Free";
+ } break;
+ case Animation::HANDLE_MODE_BALANCED: {
+ text += "Balanced";
+ } break;
+ }
+ text += "\n";
} break;
case Animation::TYPE_AUDIO: {
String stream_name = "null";
@@ -4796,12 +4846,13 @@ void AnimationTrackEditor::_insert_key_from_track(float p_ofs, int p_track) {
Variant value;
_find_hint_for_track(p_track, bp, &value);
Array arr;
- arr.resize(5);
+ arr.resize(6);
arr[0] = value;
arr[1] = -0.25;
arr[2] = 0;
arr[3] = 0.25;
arr[4] = 0;
+ arr[5] = 0;
undo_redo->create_action(TTR("Add Track Key"));
undo_redo->add_do_method(animation.ptr(), "track_insert_key", p_track, p_ofs, arr);
diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp
index a312c161a8..e0d32756ca 100644
--- a/editor/debugger/script_editor_debugger.cpp
+++ b/editor/debugger/script_editor_debugger.cpp
@@ -578,6 +578,12 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
error->set_tooltip(0, tooltip);
error->set_tooltip(1, tooltip);
+ if (warning_count == 0 && error_count == 0) {
+ expand_all_button->set_disabled(false);
+ collapse_all_button->set_disabled(false);
+ clear_button->set_disabled(false);
+ }
+
if (oe.warning) {
warning_count++;
} else {
@@ -1404,6 +1410,11 @@ void ScriptEditorDebugger::_clear_errors_list() {
error_tree->clear();
error_count = 0;
warning_count = 0;
+ update_tabs();
+
+ expand_all_button->set_disabled(true);
+ collapse_all_button->set_disabled(true);
+ clear_button->set_disabled(true);
}
// Right click on specific file(s) or folder(s).
@@ -1662,28 +1673,31 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
errors_tab = memnew(VBoxContainer);
errors_tab->set_name(TTR("Errors"));
- HBoxContainer *errhb = memnew(HBoxContainer);
- errors_tab->add_child(errhb);
+ HBoxContainer *error_hbox = memnew(HBoxContainer);
+ errors_tab->add_child(error_hbox);
- Button *expand_all = memnew(Button);
- expand_all->set_text(TTR("Expand All"));
- expand_all->connect("pressed", callable_mp(this, &ScriptEditorDebugger::_expand_errors_list));
- errhb->add_child(expand_all);
+ expand_all_button = memnew(Button);
+ expand_all_button->set_text(TTR("Expand All"));
+ expand_all_button->set_disabled(true);
+ expand_all_button->connect("pressed", callable_mp(this, &ScriptEditorDebugger::_expand_errors_list));
+ error_hbox->add_child(expand_all_button);
- Button *collapse_all = memnew(Button);
- collapse_all->set_text(TTR("Collapse All"));
- collapse_all->connect("pressed", callable_mp(this, &ScriptEditorDebugger::_collapse_errors_list));
- errhb->add_child(collapse_all);
+ collapse_all_button = memnew(Button);
+ collapse_all_button->set_text(TTR("Collapse All"));
+ collapse_all_button->set_disabled(true);
+ collapse_all_button->connect("pressed", callable_mp(this, &ScriptEditorDebugger::_collapse_errors_list));
+ error_hbox->add_child(collapse_all_button);
Control *space = memnew(Control);
space->set_h_size_flags(SIZE_EXPAND_FILL);
- errhb->add_child(space);
-
- clearbutton = memnew(Button);
- clearbutton->set_text(TTR("Clear"));
- clearbutton->set_h_size_flags(0);
- clearbutton->connect("pressed", callable_mp(this, &ScriptEditorDebugger::_clear_errors_list));
- errhb->add_child(clearbutton);
+ error_hbox->add_child(space);
+
+ clear_button = memnew(Button);
+ clear_button->set_text(TTR("Clear"));
+ clear_button->set_h_size_flags(0);
+ clear_button->set_disabled(true);
+ clear_button->connect("pressed", callable_mp(this, &ScriptEditorDebugger::_clear_errors_list));
+ error_hbox->add_child(clear_button);
error_tree = memnew(Tree);
error_tree->set_columns(2);
diff --git a/editor/debugger/script_editor_debugger.h b/editor/debugger/script_editor_debugger.h
index 1c1c0fd3e5..76209aef46 100644
--- a/editor/debugger/script_editor_debugger.h
+++ b/editor/debugger/script_editor_debugger.h
@@ -94,7 +94,9 @@ private:
VBoxContainer *errors_tab;
Tree *error_tree;
- Button *clearbutton;
+ Button *expand_all_button;
+ Button *collapse_all_button;
+ Button *clear_button;
PopupMenu *item_menu;
EditorFileDialog *file_dialog;
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 5c57c0d65c..7b942adb54 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -52,6 +52,7 @@
#include "scene/gui/texture_rect.h"
#include "scene/main/window.h"
#include "servers/display_server.h"
+#include "servers/navigation_server_3d.h"
static inline String get_project_key_from_path(const String &dir) {
return dir.replace("/", "::");
@@ -2382,6 +2383,11 @@ ProjectManager::ProjectManager() {
EditorSettings::create();
}
+ // Turn off some servers we aren't going to be using in the Project Manager.
+ NavigationServer3D::get_singleton()->set_active(false);
+ PhysicsServer3D::get_singleton()->set_active(false);
+ PhysicsServer2D::get_singleton()->set_active(false);
+
EditorSettings::get_singleton()->set_optimize_save(false); //just write settings as they came
{
diff --git a/misc/hooks/README.md b/misc/hooks/README.md
index e420c6cb5c..8732237244 100644
--- a/misc/hooks/README.md
+++ b/misc/hooks/README.md
@@ -28,7 +28,7 @@ so they should work out of the box on Linux/macOS.
#### Windows
##### clang-format
-- Download LLVM for Windows (version 8 or later) from
+- Download LLVM for Windows (version 13 or later) from
<https://releases.llvm.org/download.html>
- Make sure LLVM is added to the `PATH` during installation
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index ccd2b0d473..d827ce2fb0 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -759,7 +759,7 @@ EditorPlugin::AfterGUIInput GridMapEditor::forward_spatial_input_event(Camera3D
accumulated_floor_delta += delta;
int step = 0;
if (ABS(accumulated_floor_delta) > 1.0) {
- step = SGN(accumulated_floor_delta);
+ step = SIGN(accumulated_floor_delta);
accumulated_floor_delta -= step;
}
if (step) {
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs
index 70a2cf5695..850ae7fc3b 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs
@@ -666,21 +666,40 @@ namespace Godot
_size = new Vector3(width, height, depth);
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the AABBs are exactly equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
+ /// </summary>
+ /// <param name="left">The left AABB.</param>
+ /// <param name="right">The right AABB.</param>
+ /// <returns>Whether or not the AABBs are exactly equal.</returns>
public static bool operator ==(AABB left, AABB right)
{
return left.Equals(right);
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the AABBs are not equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
+ /// </summary>
+ /// <param name="left">The left AABB.</param>
+ /// <param name="right">The right AABB.</param>
+ /// <returns>Whether or not the AABBs are not equal.</returns>
public static bool operator !=(AABB left, AABB right)
{
return !left.Equals(right);
}
/// <summary>
- /// Returns <see langword="true"/> if this AABB and <paramref name="obj"/> are equal.
+ /// Returns <see langword="true"/> if the AABB is exactly equal
+ /// to the given object (<see paramref="obj"/>).
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
/// </summary>
- /// <param name="obj">The other object to compare.</param>
- /// <returns>Whether or not the AABB structure and the other object are equal.</returns>
+ /// <param name="obj">The object to compare with.</param>
+ /// <returns>Whether or not the AABB and the object are equal.</returns>
public override bool Equals(object obj)
{
if (obj is AABB)
@@ -692,10 +711,12 @@ namespace Godot
}
/// <summary>
- /// Returns <see langword="true"/> if this AABB and <paramref name="other"/> are equal
+ /// Returns <see langword="true"/> if the AABBs are exactly equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
/// </summary>
- /// <param name="other">The other AABB to compare.</param>
- /// <returns>Whether or not the AABBs are equal.</returns>
+ /// <param name="other">The other AABB.</param>
+ /// <returns>Whether or not the AABBs are exactly equal.</returns>
public bool Equals(AABB other)
{
return _position == other._position && _size == other._size;
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
index 0fb1df6c2f..bfbf1a097e 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
@@ -827,6 +827,14 @@ namespace Godot
Row2 = new Vector3(xz, yz, zz);
}
+ /// <summary>
+ /// Composes these two basis matrices by multiplying them
+ /// together. This has the effect of transforming the second basis
+ /// (the child) by the first basis (the parent).
+ /// </summary>
+ /// <param name="left">The parent basis.</param>
+ /// <param name="right">The child basis.</param>
+ /// <returns>The composed basis.</returns>
public static Basis operator *(Basis left, Basis right)
{
return new Basis
@@ -837,21 +845,40 @@ namespace Godot
);
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the basis matrices are exactly
+ /// equal. Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
+ /// </summary>
+ /// <param name="left">The left basis.</param>
+ /// <param name="right">The right basis.</param>
+ /// <returns>Whether or not the basis matrices are exactly equal.</returns>
public static bool operator ==(Basis left, Basis right)
{
return left.Equals(right);
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the basis matrices are not equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
+ /// </summary>
+ /// <param name="left">The left basis.</param>
+ /// <param name="right">The right basis.</param>
+ /// <returns>Whether or not the basis matrices are not equal.</returns>
public static bool operator !=(Basis left, Basis right)
{
return !left.Equals(right);
}
/// <summary>
- /// Returns <see langword="true"/> if this basis and <paramref name="obj"/> are equal.
+ /// Returns <see langword="true"/> if the <see cref="Basis"/> is
+ /// exactly equal to the given object (<see paramref="obj"/>).
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
/// </summary>
- /// <param name="obj">The other object to compare.</param>
- /// <returns>Whether or not the basis and the other object are equal.</returns>
+ /// <param name="obj">The object to compare with.</param>
+ /// <returns>Whether or not the basis matrix and the object are exactly equal.</returns>
public override bool Equals(object obj)
{
if (obj is Basis)
@@ -863,10 +890,12 @@ namespace Godot
}
/// <summary>
- /// Returns <see langword="true"/> if this basis and <paramref name="other"/> are equal
+ /// Returns <see langword="true"/> if the basis matrices are exactly
+ /// equal. Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
/// </summary>
- /// <param name="other">The other basis to compare.</param>
- /// <returns>Whether or not the bases are equal.</returns>
+ /// <param name="other">The other basis.</param>
+ /// <returns>Whether or not the basis matrices are exactly equal.</returns>
public bool Equals(Basis other)
{
return Row0.Equals(other.Row0) && Row1.Equals(other.Row1) && Row2.Equals(other.Row2);
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs
index 2a869bc335..fc9d40ca48 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs
@@ -878,6 +878,13 @@ namespace Godot
return true;
}
+ /// <summary>
+ /// Adds each component of the <see cref="Color"/>
+ /// with the components of the given <see cref="Color"/>.
+ /// </summary>
+ /// <param name="left">The left color.</param>
+ /// <param name="right">The right color.</param>
+ /// <returns>The added color.</returns>
public static Color operator +(Color left, Color right)
{
left.r += right.r;
@@ -887,6 +894,13 @@ namespace Godot
return left;
}
+ /// <summary>
+ /// Subtracts each component of the <see cref="Color"/>
+ /// by the components of the given <see cref="Color"/>.
+ /// </summary>
+ /// <param name="left">The left color.</param>
+ /// <param name="right">The right color.</param>
+ /// <returns>The subtracted color.</returns>
public static Color operator -(Color left, Color right)
{
left.r -= right.r;
@@ -896,11 +910,25 @@ namespace Godot
return left;
}
+ /// <summary>
+ /// Inverts the given color. This is equivalent to
+ /// <c>Colors.White - c</c> or
+ /// <c>new Color(1 - c.r, 1 - c.g, 1 - c.b, 1 - c.a)</c>.
+ /// </summary>
+ /// <param name="color">The color to invert.</param>
+ /// <returns>The inverted color</returns>
public static Color operator -(Color color)
{
return Colors.White - color;
}
+ /// <summary>
+ /// Multiplies each component of the <see cref="Color"/>
+ /// by the given <see langword="float"/>.
+ /// </summary>
+ /// <param name="color">The color to multiply.</param>
+ /// <param name="scale">The value to multiply by.</param>
+ /// <returns>The multiplied color.</returns>
public static Color operator *(Color color, float scale)
{
color.r *= scale;
@@ -910,6 +938,13 @@ namespace Godot
return color;
}
+ /// <summary>
+ /// Multiplies each component of the <see cref="Color"/>
+ /// by the given <see langword="float"/>.
+ /// </summary>
+ /// <param name="scale">The value to multiply by.</param>
+ /// <param name="color">The color to multiply.</param>
+ /// <returns>The multiplied color.</returns>
public static Color operator *(float scale, Color color)
{
color.r *= scale;
@@ -919,6 +954,13 @@ namespace Godot
return color;
}
+ /// <summary>
+ /// Multiplies each component of the <see cref="Color"/>
+ /// by the components of the given <see cref="Color"/>.
+ /// </summary>
+ /// <param name="left">The left color.</param>
+ /// <param name="right">The right color.</param>
+ /// <returns>The multiplied color.</returns>
public static Color operator *(Color left, Color right)
{
left.r *= right.r;
@@ -928,6 +970,13 @@ namespace Godot
return left;
}
+ /// <summary>
+ /// Divides each component of the <see cref="Color"/>
+ /// by the given <see langword="float"/>.
+ /// </summary>
+ /// <param name="color">The dividend vector.</param>
+ /// <param name="scale">The divisor value.</param>
+ /// <returns>The divided color.</returns>
public static Color operator /(Color color, float scale)
{
color.r /= scale;
@@ -937,6 +986,13 @@ namespace Godot
return color;
}
+ /// <summary>
+ /// Divides each component of the <see cref="Color"/>
+ /// by the components of the given <see cref="Color"/>.
+ /// </summary>
+ /// <param name="left">The dividend color.</param>
+ /// <param name="right">The divisor color.</param>
+ /// <returns>The divided color.</returns>
public static Color operator /(Color left, Color right)
{
left.r /= right.r;
@@ -946,23 +1002,51 @@ namespace Godot
return left;
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the colors are exactly equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
+ /// </summary>
+ /// <param name="left">The left color.</param>
+ /// <param name="right">The right color.</param>
+ /// <returns>Whether or not the colors are equal.</returns>
public static bool operator ==(Color left, Color right)
{
return left.Equals(right);
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the colors are not equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
+ /// </summary>
+ /// <param name="left">The left color.</param>
+ /// <param name="right">The right color.</param>
+ /// <returns>Whether or not the colors are equal.</returns>
public static bool operator !=(Color left, Color right)
{
return !left.Equals(right);
}
+ /// <summary>
+ /// Compares two <see cref="Color"/>s by first checking if
+ /// the red value of the <paramref name="left"/> color is less than
+ /// the red value of the <paramref name="right"/> color.
+ /// If the red values are exactly equal, then it repeats this check
+ /// with the green values of the two colors, then with the blue values,
+ /// and then with the alpha value.
+ /// This operator is useful for sorting colors.
+ /// </summary>
+ /// <param name="left">The left color.</param>
+ /// <param name="right">The right color.</param>
+ /// <returns>Whether or not the left is less than the right.</returns>
public static bool operator <(Color left, Color right)
{
- if (Mathf.IsEqualApprox(left.r, right.r))
+ if (left.r == right.r)
{
- if (Mathf.IsEqualApprox(left.g, right.g))
+ if (left.g == right.g)
{
- if (Mathf.IsEqualApprox(left.b, right.b))
+ if (left.b == right.b)
{
return left.a < right.a;
}
@@ -973,13 +1057,25 @@ namespace Godot
return left.r < right.r;
}
+ /// <summary>
+ /// Compares two <see cref="Color"/>s by first checking if
+ /// the red value of the <paramref name="left"/> color is greater than
+ /// the red value of the <paramref name="right"/> color.
+ /// If the red values are exactly equal, then it repeats this check
+ /// with the green values of the two colors, then with the blue values,
+ /// and then with the alpha value.
+ /// This operator is useful for sorting colors.
+ /// </summary>
+ /// <param name="left">The left color.</param>
+ /// <param name="right">The right color.</param>
+ /// <returns>Whether or not the left is greater than the right.</returns>
public static bool operator >(Color left, Color right)
{
- if (Mathf.IsEqualApprox(left.r, right.r))
+ if (left.r == right.r)
{
- if (Mathf.IsEqualApprox(left.g, right.g))
+ if (left.g == right.g)
{
- if (Mathf.IsEqualApprox(left.b, right.b))
+ if (left.b == right.b)
{
return left.a > right.a;
}
@@ -991,6 +1087,64 @@ namespace Godot
}
/// <summary>
+ /// Compares two <see cref="Color"/>s by first checking if
+ /// the red value of the <paramref name="left"/> color is less than
+ /// or equal to the red value of the <paramref name="right"/> color.
+ /// If the red values are exactly equal, then it repeats this check
+ /// with the green values of the two colors, then with the blue values,
+ /// and then with the alpha value.
+ /// This operator is useful for sorting colors.
+ /// </summary>
+ /// <param name="left">The left color.</param>
+ /// <param name="right">The right color.</param>
+ /// <returns>Whether or not the left is less than or equal to the right.</returns>
+ public static bool operator <=(Color left, Color right)
+ {
+ if (left.r == right.r)
+ {
+ if (left.g == right.g)
+ {
+ if (left.b == right.b)
+ {
+ return left.a <= right.a;
+ }
+ return left.b < right.b;
+ }
+ return left.g < right.g;
+ }
+ return left.r < right.r;
+ }
+
+ /// <summary>
+ /// Compares two <see cref="Color"/>s by first checking if
+ /// the red value of the <paramref name="left"/> color is greater than
+ /// or equal to the red value of the <paramref name="right"/> color.
+ /// If the red values are exactly equal, then it repeats this check
+ /// with the green values of the two colors, then with the blue values,
+ /// and then with the alpha value.
+ /// This operator is useful for sorting colors.
+ /// </summary>
+ /// <param name="left">The left color.</param>
+ /// <param name="right">The right color.</param>
+ /// <returns>Whether or not the left is greater than or equal to the right.</returns>
+ public static bool operator >=(Color left, Color right)
+ {
+ if (left.r == right.r)
+ {
+ if (left.g == right.g)
+ {
+ if (left.b == right.b)
+ {
+ return left.a >= right.a;
+ }
+ return left.b > right.b;
+ }
+ return left.g > right.g;
+ }
+ return left.r > right.r;
+ }
+
+ /// <summary>
/// Returns <see langword="true"/> if this color and <paramref name="obj"/> are equal.
/// </summary>
/// <param name="obj">The other object to compare.</param>
@@ -1006,9 +1160,11 @@ namespace Godot
}
/// <summary>
- /// Returns <see langword="true"/> if this color and <paramref name="other"/> are equal
+ /// Returns <see langword="true"/> if the colors are exactly equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
/// </summary>
- /// <param name="other">The other color to compare.</param>
+ /// <param name="other">The other color.</param>
/// <returns>Whether or not the colors are equal.</returns>
public bool Equals(Color other)
{
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Colors.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Colors.cs
index d64c8b563e..68c821b447 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Colors.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Colors.cs
@@ -158,6 +158,7 @@ namespace Godot
{"YELLOWGREEN", new Color(0.60f, 0.80f, 0.20f)},
};
+#pragma warning disable CS1591 // Disable warning: "Missing XML comment for publicly visible type or member"
public static Color AliceBlue { get { return namedColors["ALICEBLUE"]; } }
public static Color AntiqueWhite { get { return namedColors["ANTIQUEWHITE"]; } }
public static Color Aqua { get { return namedColors["AQUA"]; } }
@@ -304,5 +305,6 @@ namespace Godot
public static Color WhiteSmoke { get { return namedColors["WHITESMOKE"]; } }
public static Color Yellow { get { return namedColors["YELLOW"]; } }
public static Color YellowGreen { get { return namedColors["YELLOWGREEN"]; } }
+#pragma warning restore CS1591
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs
index 2dfe304aaa..75240b0c09 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs
@@ -314,13 +314,13 @@ namespace Godot.Collections
internal static extern int godot_icall_Dictionary_Count(IntPtr ptr);
[MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static int godot_icall_Dictionary_KeyValuePairs(IntPtr ptr, out IntPtr keys, out IntPtr values);
+ internal static extern int godot_icall_Dictionary_KeyValuePairs(IntPtr ptr, out IntPtr keys, out IntPtr values);
[MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static void godot_icall_Dictionary_KeyValuePairAt(IntPtr ptr, int index, out object key, out object value);
+ internal static extern void godot_icall_Dictionary_KeyValuePairAt(IntPtr ptr, int index, out object key, out object value);
[MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static void godot_icall_Dictionary_Add(IntPtr ptr, object key, object value);
+ internal static extern void godot_icall_Dictionary_Add(IntPtr ptr, object key, object value);
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern void godot_icall_Dictionary_Clear(IntPtr ptr);
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs
index 66f7b745f7..63af1c5892 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs
@@ -309,16 +309,43 @@ namespace Godot
D = _normal.Dot(v1);
}
+ /// <summary>
+ /// Returns the negative value of the <see cref="Plane"/>.
+ /// This is the same as writing <c>new Plane(-p.Normal, -p.D)</c>.
+ /// This operation flips the direction of the normal vector and
+ /// also flips the distance value, resulting in a Plane that is
+ /// in the same place, but facing the opposite direction.
+ /// </summary>
+ /// <param name="plane">The plane to negate/flip.</param>
+ /// <returns>The negated/flipped plane.</returns>
public static Plane operator -(Plane plane)
{
return new Plane(-plane._normal, -plane.D);
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the
+ /// <see cref="Plane"/>s are exactly equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
+ /// </summary>
+ /// <param name="left">The left rect.</param>
+ /// <param name="right">The right rect.</param>
+ /// <returns>Whether or not the planes are exactly equal.</returns>
public static bool operator ==(Plane left, Plane right)
{
return left.Equals(right);
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the
+ /// <see cref="Plane"/>s are not equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
+ /// </summary>
+ /// <param name="left">The left rect.</param>
+ /// <param name="right">The right rect.</param>
+ /// <returns>Whether or not the planes are not equal.</returns>
public static bool operator !=(Plane left, Plane right)
{
return !left.Equals(right);
@@ -328,7 +355,7 @@ namespace Godot
/// Returns <see langword="true"/> if this plane and <paramref name="obj"/> are equal.
/// </summary>
/// <param name="obj">The other object to compare.</param>
- /// <returns>Whether or not the plane and the other object are equal.</returns>
+ /// <returns>Whether or not the plane and the other object are exactly equal.</returns>
public override bool Equals(object obj)
{
if (obj is Plane)
@@ -343,7 +370,7 @@ namespace Godot
/// Returns <see langword="true"/> if this plane and <paramref name="other"/> are equal.
/// </summary>
/// <param name="other">The other plane to compare.</param>
- /// <returns>Whether or not the planes are equal.</returns>
+ /// <returns>Whether or not the planes are exactly equal.</returns>
public bool Equals(Plane other)
{
return _normal == other._normal && D == other.D;
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs
index c18f818ed2..dfb8e87bce 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs
@@ -446,6 +446,14 @@ namespace Godot
}
}
+ /// <summary>
+ /// Composes these two quaternions by multiplying them together.
+ /// This has the effect of rotating the second quaternion
+ /// (the child) by the first quaternion (the parent).
+ /// </summary>
+ /// <param name="left">The parent quaternion.</param>
+ /// <param name="right">The child quaternion.</param>
+ /// <returns>The composed quaternion.</returns>
public static Quaternion operator *(Quaternion left, Quaternion right)
{
return new Quaternion
@@ -457,21 +465,55 @@ namespace Godot
);
}
+ /// <summary>
+ /// Adds each component of the left <see cref="Quaternion"/>
+ /// to the right <see cref="Quaternion"/>. This operation is not
+ /// meaningful on its own, but it can be used as a part of a
+ /// larger expression, such as approximating an intermediate
+ /// rotation between two nearby rotations.
+ /// </summary>
+ /// <param name="left">The left quaternion to add.</param>
+ /// <param name="right">The right quaternion to add.</param>
+ /// <returns>The added quaternion.</returns>
public static Quaternion operator +(Quaternion left, Quaternion right)
{
return new Quaternion(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w);
}
+ /// <summary>
+ /// Subtracts each component of the left <see cref="Quaternion"/>
+ /// by the right <see cref="Quaternion"/>. This operation is not
+ /// meaningful on its own, but it can be used as a part of a
+ /// larger expression.
+ /// </summary>
+ /// <param name="left">The left quaternion to subtract.</param>
+ /// <param name="right">The right quaternion to subtract.</param>
+ /// <returns>The subtracted quaternion.</returns>
public static Quaternion operator -(Quaternion left, Quaternion right)
{
return new Quaternion(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w);
}
- public static Quaternion operator -(Quaternion left)
+ /// <summary>
+ /// Returns the negative value of the <see cref="Quaternion"/>.
+ /// This is the same as writing
+ /// <c>new Quaternion(-q.x, -q.y, -q.z, -q.w)</c>. This operation
+ /// results in a quaternion that represents the same rotation.
+ /// </summary>
+ /// <param name="quat">The quaternion to negate.</param>
+ /// <returns>The negated quaternion.</returns>
+ public static Quaternion operator -(Quaternion quat)
{
- return new Quaternion(-left.x, -left.y, -left.z, -left.w);
+ return new Quaternion(-quat.x, -quat.y, -quat.z, -quat.w);
}
+ /// <summary>
+ /// Rotates (multiplies) the <see cref="Vector3"/>
+ /// by the given <see cref="Quaternion"/>.
+ /// </summary>
+ /// <param name="quat">The quaternion to rotate by.</param>
+ /// <param name="vec">The vector to rotate.</param>
+ /// <returns>The rotated vector.</returns>
public static Vector3 operator *(Quaternion quat, Vector3 vec)
{
#if DEBUG
@@ -485,31 +527,81 @@ namespace Godot
return vec + (((uv * quat.w) + u.Cross(uv)) * 2);
}
+ /// <summary>
+ /// Inversely rotates (multiplies) the <see cref="Vector3"/>
+ /// by the given <see cref="Quaternion"/>.
+ /// </summary>
+ /// <param name="vec">The vector to rotate.</param>
+ /// <param name="quat">The quaternion to rotate by.</param>
+ /// <returns>The inversely rotated vector.</returns>
public static Vector3 operator *(Vector3 vec, Quaternion quat)
{
return quat.Inverse() * vec;
}
+ /// <summary>
+ /// Multiplies each component of the <see cref="Quaternion"/>
+ /// by the given <see cref="real_t"/>. This operation is not
+ /// meaningful on its own, but it can be used as a part of a
+ /// larger expression.
+ /// </summary>
+ /// <param name="left">The quaternion to multiply.</param>
+ /// <param name="right">The value to multiply by.</param>
+ /// <returns>The multiplied quaternion.</returns>
public static Quaternion operator *(Quaternion left, real_t right)
{
return new Quaternion(left.x * right, left.y * right, left.z * right, left.w * right);
}
+ /// <summary>
+ /// Multiplies each component of the <see cref="Quaternion"/>
+ /// by the given <see cref="real_t"/>. This operation is not
+ /// meaningful on its own, but it can be used as a part of a
+ /// larger expression.
+ /// </summary>
+ /// <param name="left">The value to multiply by.</param>
+ /// <param name="right">The quaternion to multiply.</param>
+ /// <returns>The multiplied quaternion.</returns>
public static Quaternion operator *(real_t left, Quaternion right)
{
return new Quaternion(right.x * left, right.y * left, right.z * left, right.w * left);
}
+ /// <summary>
+ /// Divides each component of the <see cref="Quaternion"/>
+ /// by the given <see cref="real_t"/>. This operation is not
+ /// meaningful on its own, but it can be used as a part of a
+ /// larger expression.
+ /// </summary>
+ /// <param name="left">The quaternion to divide.</param>
+ /// <param name="right">The value to divide by.</param>
+ /// <returns>The divided quaternion.</returns>
public static Quaternion operator /(Quaternion left, real_t right)
{
return left * (1.0f / right);
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the quaternions are exactly equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
+ /// </summary>
+ /// <param name="left">The left quaternion.</param>
+ /// <param name="right">The right quaternion.</param>
+ /// <returns>Whether or not the quaternions are exactly equal.</returns>
public static bool operator ==(Quaternion left, Quaternion right)
{
return left.Equals(right);
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the quaternions are not equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
+ /// </summary>
+ /// <param name="left">The left quaternion.</param>
+ /// <param name="right">The right quaternion.</param>
+ /// <returns>Whether or not the quaternions are not equal.</returns>
public static bool operator !=(Quaternion left, Quaternion right)
{
return !left.Equals(right);
@@ -519,7 +611,7 @@ namespace Godot
/// Returns <see langword="true"/> if this quaternion and <paramref name="obj"/> are equal.
/// </summary>
/// <param name="obj">The other object to compare.</param>
- /// <returns>Whether or not the quaternion and the other object are equal.</returns>
+ /// <returns>Whether or not the quaternion and the other object are exactly equal.</returns>
public override bool Equals(object obj)
{
if (obj is Quaternion)
@@ -534,7 +626,7 @@ namespace Godot
/// Returns <see langword="true"/> if this quaternion and <paramref name="other"/> are equal.
/// </summary>
/// <param name="other">The other quaternion to compare.</param>
- /// <returns>Whether or not the quaternions are equal.</returns>
+ /// <returns>Whether or not the quaternions are exactly equal.</returns>
public bool Equals(Quaternion other)
{
return x == other.x && y == other.y && z == other.z && w == other.w;
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs
index af94484577..ec16920fed 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs
@@ -396,11 +396,29 @@ namespace Godot
_size = new Vector2(width, height);
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the
+ /// <see cref="Rect2"/>s are exactly equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
+ /// </summary>
+ /// <param name="left">The left rect.</param>
+ /// <param name="right">The right rect.</param>
+ /// <returns>Whether or not the rects are exactly equal.</returns>
public static bool operator ==(Rect2 left, Rect2 right)
{
return left.Equals(right);
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the
+ /// <see cref="Rect2"/>s are not equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
+ /// </summary>
+ /// <param name="left">The left rect.</param>
+ /// <param name="right">The right rect.</param>
+ /// <returns>Whether or not the rects are not equal.</returns>
public static bool operator !=(Rect2 left, Rect2 right)
{
return !left.Equals(right);
@@ -410,7 +428,7 @@ namespace Godot
/// Returns <see langword="true"/> if this rect and <paramref name="obj"/> are equal.
/// </summary>
/// <param name="obj">The other object to compare.</param>
- /// <returns>Whether or not the rect and the other object are equal.</returns>
+ /// <returns>Whether or not the rect and the other object are exactly equal.</returns>
public override bool Equals(object obj)
{
if (obj is Rect2)
@@ -425,7 +443,7 @@ namespace Godot
/// Returns <see langword="true"/> if this rect and <paramref name="other"/> are equal.
/// </summary>
/// <param name="other">The other rect to compare.</param>
- /// <returns>Whether or not the rects are equal.</returns>
+ /// <returns>Whether or not the rects are exactly equal.</returns>
public bool Equals(Rect2 other)
{
return _position.Equals(other._position) && _size.Equals(other._size);
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2i.cs
index 03f406a910..5d53b8330e 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2i.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2i.cs
@@ -377,11 +377,25 @@ namespace Godot
_size = new Vector2i(width, height);
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the
+ /// <see cref="Rect2i"/>s are exactly equal.
+ /// </summary>
+ /// <param name="left">The left rect.</param>
+ /// <param name="right">The right rect.</param>
+ /// <returns>Whether or not the rects are equal.</returns>
public static bool operator ==(Rect2i left, Rect2i right)
{
return left.Equals(right);
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the
+ /// <see cref="Rect2i"/>s are not equal.
+ /// </summary>
+ /// <param name="left">The left rect.</param>
+ /// <param name="right">The right rect.</param>
+ /// <returns>Whether or not the rects are not equal.</returns>
public static bool operator !=(Rect2i left, Rect2i right)
{
return !left.Equals(right);
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs
index 6b3eb09581..d9ee684c5b 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs
@@ -1345,7 +1345,7 @@ namespace Godot
}
[MethodImpl(MethodImplOptions.InternalCall)]
- internal extern static string godot_icall_String_simplify_path(string str);
+ internal static extern string godot_icall_String_simplify_path(string str);
/// <summary>
/// Split the string by a divisor string, return an array of the substrings.
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
index c82c5f4588..6f1d9574a8 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
@@ -447,6 +447,14 @@ namespace Godot
this.origin = origin;
}
+ /// <summary>
+ /// Composes these two transformation matrices by multiplying them
+ /// together. This has the effect of transforming the second transform
+ /// (the child) by the first transform (the parent).
+ /// </summary>
+ /// <param name="left">The parent transform.</param>
+ /// <param name="right">The child transform.</param>
+ /// <returns>The composed transform.</returns>
public static Transform2D operator *(Transform2D left, Transform2D right)
{
left.origin = left * right.origin;
@@ -554,31 +562,52 @@ namespace Godot
return newArray;
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the transforms are exactly equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
+ /// </summary>
+ /// <param name="left">The left transform.</param>
+ /// <param name="right">The right transform.</param>
+ /// <returns>Whether or not the transforms are exactly equal.</returns>
public static bool operator ==(Transform2D left, Transform2D right)
{
return left.Equals(right);
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the transforms are not equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
+ /// </summary>
+ /// <param name="left">The left transform.</param>
+ /// <param name="right">The right transform.</param>
+ /// <returns>Whether or not the transforms are not equal.</returns>
public static bool operator !=(Transform2D left, Transform2D right)
{
return !left.Equals(right);
}
/// <summary>
- /// Returns <see langword="true"/> if this transform and <paramref name="obj"/> are equal.
+ /// Returns <see langword="true"/> if the transform is exactly equal
+ /// to the given object (<see paramref="obj"/>).
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
/// </summary>
- /// <param name="obj">The other object to compare.</param>
- /// <returns>Whether or not the transform and the other object are equal.</returns>
+ /// <param name="obj">The object to compare with.</param>
+ /// <returns>Whether or not the transform and the object are exactly equal.</returns>
public override bool Equals(object obj)
{
return obj is Transform2D transform2D && Equals(transform2D);
}
/// <summary>
- /// Returns <see langword="true"/> if this transform and <paramref name="other"/> are equal.
+ /// Returns <see langword="true"/> if the transforms are exactly equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
/// </summary>
/// <param name="other">The other transform to compare.</param>
- /// <returns>Whether or not the matrices are equal.</returns>
+ /// <returns>Whether or not the matrices are exactly equal.</returns>
public bool Equals(Transform2D other)
{
return x.Equals(other.x) && y.Equals(other.y) && origin.Equals(other.origin);
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
index 7176cd60dc..4bb8308c12 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
@@ -352,6 +352,14 @@ namespace Godot
this.origin = origin;
}
+ /// <summary>
+ /// Composes these two transformation matrices by multiplying them
+ /// together. This has the effect of transforming the second transform
+ /// (the child) by the first transform (the parent).
+ /// </summary>
+ /// <param name="left">The parent transform.</param>
+ /// <param name="right">The child transform.</param>
+ /// <returns>The composed transform.</returns>
public static Transform3D operator *(Transform3D left, Transform3D right)
{
left.origin = left.Xform(right.origin);
@@ -359,21 +367,40 @@ namespace Godot
return left;
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the transforms are exactly equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
+ /// </summary>
+ /// <param name="left">The left transform.</param>
+ /// <param name="right">The right transform.</param>
+ /// <returns>Whether or not the transforms are exactly equal.</returns>
public static bool operator ==(Transform3D left, Transform3D right)
{
return left.Equals(right);
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the transforms are not equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
+ /// </summary>
+ /// <param name="left">The left transform.</param>
+ /// <param name="right">The right transform.</param>
+ /// <returns>Whether or not the transforms are not equal.</returns>
public static bool operator !=(Transform3D left, Transform3D right)
{
return !left.Equals(right);
}
/// <summary>
- /// Returns <see langword="true"/> if this transform and <paramref name="obj"/> are equal.
+ /// Returns <see langword="true"/> if the transform is exactly equal
+ /// to the given object (<see paramref="obj"/>).
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
/// </summary>
- /// <param name="obj">The other object to compare.</param>
- /// <returns>Whether or not the transform and the other object are equal.</returns>
+ /// <param name="obj">The object to compare with.</param>
+ /// <returns>Whether or not the transform and the object are exactly equal.</returns>
public override bool Equals(object obj)
{
if (obj is Transform3D)
@@ -385,10 +412,12 @@ namespace Godot
}
/// <summary>
- /// Returns <see langword="true"/> if this transform and <paramref name="other"/> are equal.
+ /// Returns <see langword="true"/> if the transforms are exactly equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
/// </summary>
/// <param name="other">The other transform to compare.</param>
- /// <returns>Whether or not the matrices are equal.</returns>
+ /// <returns>Whether or not the matrices are exactly equal.</returns>
public bool Equals(Transform3D other)
{
return basis.Equals(other.basis) && origin.Equals(other.origin);
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
index fe70d71cce..0c3331900a 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
@@ -642,6 +642,13 @@ namespace Godot
return new Vector2(Mathf.Cos(angle), Mathf.Sin(angle));
}
+ /// <summary>
+ /// Adds each component of the <see cref="Vector2"/>
+ /// with the components of the given <see cref="Vector2"/>.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>The added vector.</returns>
public static Vector2 operator +(Vector2 left, Vector2 right)
{
left.x += right.x;
@@ -649,6 +656,13 @@ namespace Godot
return left;
}
+ /// <summary>
+ /// Subtracts each component of the <see cref="Vector2"/>
+ /// by the components of the given <see cref="Vector2"/>.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>The subtracted vector.</returns>
public static Vector2 operator -(Vector2 left, Vector2 right)
{
left.x -= right.x;
@@ -656,6 +670,15 @@ namespace Godot
return left;
}
+ /// <summary>
+ /// Returns the negative value of the <see cref="Vector2"/>.
+ /// This is the same as writing <c>new Vector2(-v.x, -v.y)</c>.
+ /// This operation flips the direction of the vector while
+ /// keeping the same magnitude.
+ /// With floats, the number zero can be either positive or negative.
+ /// </summary>
+ /// <param name="vec">The vector to negate/flip.</param>
+ /// <returns>The negated/flipped vector.</returns>
public static Vector2 operator -(Vector2 vec)
{
vec.x = -vec.x;
@@ -663,6 +686,13 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Multiplies each component of the <see cref="Vector2"/>
+ /// by the given <see cref="real_t"/>.
+ /// </summary>
+ /// <param name="vec">The vector to multiply.</param>
+ /// <param name="scale">The scale to multiply by.</param>
+ /// <returns>The multiplied vector.</returns>
public static Vector2 operator *(Vector2 vec, real_t scale)
{
vec.x *= scale;
@@ -670,6 +700,13 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Multiplies each component of the <see cref="Vector2"/>
+ /// by the given <see cref="real_t"/>.
+ /// </summary>
+ /// <param name="scale">The scale to multiply by.</param>
+ /// <param name="vec">The vector to multiply.</param>
+ /// <returns>The multiplied vector.</returns>
public static Vector2 operator *(real_t scale, Vector2 vec)
{
vec.x *= scale;
@@ -677,6 +714,13 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Multiplies each component of the <see cref="Vector2"/>
+ /// by the components of the given <see cref="Vector2"/>.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>The multiplied vector.</returns>
public static Vector2 operator *(Vector2 left, Vector2 right)
{
left.x *= right.x;
@@ -684,6 +728,13 @@ namespace Godot
return left;
}
+ /// <summary>
+ /// Multiplies each component of the <see cref="Vector2"/>
+ /// by the given <see cref="real_t"/>.
+ /// </summary>
+ /// <param name="vec">The dividend vector.</param>
+ /// <param name="divisor">The divisor value.</param>
+ /// <returns>The divided vector.</returns>
public static Vector2 operator /(Vector2 vec, real_t divisor)
{
vec.x /= divisor;
@@ -691,6 +742,13 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Divides each component of the <see cref="Vector2"/>
+ /// by the components of the given <see cref="Vector2"/>.
+ /// </summary>
+ /// <param name="vec">The dividend vector.</param>
+ /// <param name="divisorv">The divisor vector.</param>
+ /// <returns>The divided vector.</returns>
public static Vector2 operator /(Vector2 vec, Vector2 divisorv)
{
vec.x /= divisorv.x;
@@ -698,6 +756,22 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Gets the remainder of each component of the <see cref="Vector2"/>
+ /// with the components of the given <see cref="real_t"/>.
+ /// This operation uses truncated division, which is often not desired
+ /// as it does not work well with negative numbers.
+ /// Consider using <see cref="PosMod(real_t)"/> instead
+ /// if you want to handle negative numbers.
+ /// </summary>
+ /// <example>
+ /// <code>
+ /// GD.Print(new Vector2(10, -20) % 7); // Prints "(3, -6)"
+ /// </code>
+ /// </example>
+ /// <param name="vec">The dividend vector.</param>
+ /// <param name="divisor">The divisor value.</param>
+ /// <returns>The remainder vector.</returns>
public static Vector2 operator %(Vector2 vec, real_t divisor)
{
vec.x %= divisor;
@@ -705,6 +779,22 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Gets the remainder of each component of the <see cref="Vector2"/>
+ /// with the components of the given <see cref="Vector2"/>.
+ /// This operation uses truncated division, which is often not desired
+ /// as it does not work well with negative numbers.
+ /// Consider using <see cref="PosMod(Vector2)"/> instead
+ /// if you want to handle negative numbers.
+ /// </summary>
+ /// <example>
+ /// <code>
+ /// GD.Print(new Vector2(10, -20) % new Vector2(7, 8)); // Prints "(3, -4)"
+ /// </code>
+ /// </example>
+ /// <param name="vec">The dividend vector.</param>
+ /// <param name="divisorv">The divisor vector.</param>
+ /// <returns>The remainder vector.</returns>
public static Vector2 operator %(Vector2 vec, Vector2 divisorv)
{
vec.x %= divisorv.x;
@@ -712,16 +802,43 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the vectors are exactly equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the vectors are exactly equal.</returns>
public static bool operator ==(Vector2 left, Vector2 right)
{
return left.Equals(right);
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the vectors are not equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the vectors are not equal.</returns>
public static bool operator !=(Vector2 left, Vector2 right)
{
return !left.Equals(right);
}
+ /// <summary>
+ /// Compares two <see cref="Vector2"/> vectors by first checking if
+ /// the X value of the <paramref name="left"/> vector is less than
+ /// the X value of the <paramref name="right"/> vector.
+ /// If the X values are exactly equal, then it repeats this check
+ /// with the Y values of the two vectors.
+ /// This operator is useful for sorting vectors.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the left is less than the right.</returns>
public static bool operator <(Vector2 left, Vector2 right)
{
if (left.x == right.x)
@@ -731,6 +848,17 @@ namespace Godot
return left.x < right.x;
}
+ /// <summary>
+ /// Compares two <see cref="Vector2"/> vectors by first checking if
+ /// the X value of the <paramref name="left"/> vector is greater than
+ /// the X value of the <paramref name="right"/> vector.
+ /// If the X values are exactly equal, then it repeats this check
+ /// with the Y values of the two vectors.
+ /// This operator is useful for sorting vectors.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the left is greater than the right.</returns>
public static bool operator >(Vector2 left, Vector2 right)
{
if (left.x == right.x)
@@ -740,29 +868,54 @@ namespace Godot
return left.x > right.x;
}
+ /// <summary>
+ /// Compares two <see cref="Vector2"/> vectors by first checking if
+ /// the X value of the <paramref name="left"/> vector is less than
+ /// or equal to the X value of the <paramref name="right"/> vector.
+ /// If the X values are exactly equal, then it repeats this check
+ /// with the Y values of the two vectors.
+ /// This operator is useful for sorting vectors.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the left is less than or equal to the right.</returns>
public static bool operator <=(Vector2 left, Vector2 right)
{
if (left.x == right.x)
{
return left.y <= right.y;
}
- return left.x <= right.x;
+ return left.x < right.x;
}
+ /// <summary>
+ /// Compares two <see cref="Vector2"/> vectors by first checking if
+ /// the X value of the <paramref name="left"/> vector is greater than
+ /// or equal to the X value of the <paramref name="right"/> vector.
+ /// If the X values are exactly equal, then it repeats this check
+ /// with the Y values of the two vectors.
+ /// This operator is useful for sorting vectors.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the left is greater than or equal to the right.</returns>
public static bool operator >=(Vector2 left, Vector2 right)
{
if (left.x == right.x)
{
return left.y >= right.y;
}
- return left.x >= right.x;
+ return left.x > right.x;
}
/// <summary>
- /// Returns <see langword="true"/> if this vector and <paramref name="obj"/> are equal.
+ /// Returns <see langword="true"/> if the vector is exactly equal
+ /// to the given object (<see paramref="obj"/>).
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
/// </summary>
- /// <param name="obj">The other object to compare.</param>
- /// <returns>Whether or not the vector and the other object are equal.</returns>
+ /// <param name="obj">The object to compare with.</param>
+ /// <returns>Whether or not the vector and the object are equal.</returns>
public override bool Equals(object obj)
{
if (obj is Vector2)
@@ -773,10 +926,12 @@ namespace Godot
}
/// <summary>
- /// Returns <see langword="true"/> if this vector and <paramref name="other"/> are equal.
+ /// Returns <see langword="true"/> if the vectors are exactly equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
/// </summary>
- /// <param name="other">The other vector to compare.</param>
- /// <returns>Whether or not the vectors are equal.</returns>
+ /// <param name="other">The other vector.</param>
+ /// <returns>Whether or not the vectors are exactly equal.</returns>
public bool Equals(Vector2 other)
{
return x == other.x && y == other.y;
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs
index ca4531d885..6cac16d53b 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs
@@ -366,6 +366,13 @@ namespace Godot
this.y = Mathf.RoundToInt(v.y);
}
+ /// <summary>
+ /// Adds each component of the <see cref="Vector2i"/>
+ /// with the components of the given <see cref="Vector2i"/>.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>The added vector.</returns>
public static Vector2i operator +(Vector2i left, Vector2i right)
{
left.x += right.x;
@@ -373,6 +380,13 @@ namespace Godot
return left;
}
+ /// <summary>
+ /// Subtracts each component of the <see cref="Vector2i"/>
+ /// by the components of the given <see cref="Vector2i"/>.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>The subtracted vector.</returns>
public static Vector2i operator -(Vector2i left, Vector2i right)
{
left.x -= right.x;
@@ -380,6 +394,14 @@ namespace Godot
return left;
}
+ /// <summary>
+ /// Returns the negative value of the <see cref="Vector2i"/>.
+ /// This is the same as writing <c>new Vector2i(-v.x, -v.y)</c>.
+ /// This operation flips the direction of the vector while
+ /// keeping the same magnitude.
+ /// </summary>
+ /// <param name="vec">The vector to negate/flip.</param>
+ /// <returns>The negated/flipped vector.</returns>
public static Vector2i operator -(Vector2i vec)
{
vec.x = -vec.x;
@@ -387,6 +409,13 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Multiplies each component of the <see cref="Vector2i"/>
+ /// by the given <see langword="int"/>.
+ /// </summary>
+ /// <param name="vec">The vector to multiply.</param>
+ /// <param name="scale">The scale to multiply by.</param>
+ /// <returns>The multiplied vector.</returns>
public static Vector2i operator *(Vector2i vec, int scale)
{
vec.x *= scale;
@@ -394,6 +423,13 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Multiplies each component of the <see cref="Vector2i"/>
+ /// by the given <see langword="int"/>.
+ /// </summary>
+ /// <param name="scale">The scale to multiply by.</param>
+ /// <param name="vec">The vector to multiply.</param>
+ /// <returns>The multiplied vector.</returns>
public static Vector2i operator *(int scale, Vector2i vec)
{
vec.x *= scale;
@@ -401,6 +437,13 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Multiplies each component of the <see cref="Vector2i"/>
+ /// by the components of the given <see cref="Vector2i"/>.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>The multiplied vector.</returns>
public static Vector2i operator *(Vector2i left, Vector2i right)
{
left.x *= right.x;
@@ -408,6 +451,13 @@ namespace Godot
return left;
}
+ /// <summary>
+ /// Multiplies each component of the <see cref="Vector2i"/>
+ /// by the given <see langword="int"/>.
+ /// </summary>
+ /// <param name="vec">The dividend vector.</param>
+ /// <param name="divisor">The divisor value.</param>
+ /// <returns>The divided vector.</returns>
public static Vector2i operator /(Vector2i vec, int divisor)
{
vec.x /= divisor;
@@ -415,6 +465,13 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Divides each component of the <see cref="Vector2i"/>
+ /// by the components of the given <see cref="Vector2i"/>.
+ /// </summary>
+ /// <param name="vec">The dividend vector.</param>
+ /// <param name="divisorv">The divisor vector.</param>
+ /// <returns>The divided vector.</returns>
public static Vector2i operator /(Vector2i vec, Vector2i divisorv)
{
vec.x /= divisorv.x;
@@ -422,6 +479,22 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Gets the remainder of each component of the <see cref="Vector2i"/>
+ /// with the components of the given <see langword="int"/>.
+ /// This operation uses truncated division, which is often not desired
+ /// as it does not work well with negative numbers.
+ /// Consider using <see cref="PosMod(int)"/> instead
+ /// if you want to handle negative numbers.
+ /// </summary>
+ /// <example>
+ /// <code>
+ /// GD.Print(new Vector2i(10, -20) % 7); // Prints "(3, -6)"
+ /// </code>
+ /// </example>
+ /// <param name="vec">The dividend vector.</param>
+ /// <param name="divisor">The divisor value.</param>
+ /// <returns>The remainder vector.</returns>
public static Vector2i operator %(Vector2i vec, int divisor)
{
vec.x %= divisor;
@@ -429,6 +502,22 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Gets the remainder of each component of the <see cref="Vector2i"/>
+ /// with the components of the given <see cref="Vector2i"/>.
+ /// This operation uses truncated division, which is often not desired
+ /// as it does not work well with negative numbers.
+ /// Consider using <see cref="PosMod(Vector2i)"/> instead
+ /// if you want to handle negative numbers.
+ /// </summary>
+ /// <example>
+ /// <code>
+ /// GD.Print(new Vector2i(10, -20) % new Vector2i(7, 8)); // Prints "(3, -4)"
+ /// </code>
+ /// </example>
+ /// <param name="vec">The dividend vector.</param>
+ /// <param name="divisorv">The divisor vector.</param>
+ /// <returns>The remainder vector.</returns>
public static Vector2i operator %(Vector2i vec, Vector2i divisorv)
{
vec.x %= divisorv.x;
@@ -436,6 +525,13 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Performs a bitwise AND operation with this <see cref="Vector2i"/>
+ /// and the given <see langword="int"/>.
+ /// </summary>
+ /// <param name="vec">The vector to AND with.</param>
+ /// <param name="and">The integer to AND with.</param>
+ /// <returns>The result of the bitwise AND.</returns>
public static Vector2i operator &(Vector2i vec, int and)
{
vec.x &= and;
@@ -443,6 +539,13 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Performs a bitwise AND operation with this <see cref="Vector2i"/>
+ /// and the given <see cref="Vector2i"/>.
+ /// </summary>
+ /// <param name="vec">The left vector to AND with.</param>
+ /// <param name="andv">The right vector to AND with.</param>
+ /// <returns>The result of the bitwise AND.</returns>
public static Vector2i operator &(Vector2i vec, Vector2i andv)
{
vec.x &= andv.x;
@@ -450,50 +553,106 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the vectors are equal.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the vectors are equal.</returns>
public static bool operator ==(Vector2i left, Vector2i right)
{
return left.Equals(right);
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the vectors are not equal.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the vectors are not equal.</returns>
public static bool operator !=(Vector2i left, Vector2i right)
{
return !left.Equals(right);
}
+ /// <summary>
+ /// Compares two <see cref="Vector2i"/> vectors by first checking if
+ /// the X value of the <paramref name="left"/> vector is less than
+ /// the X value of the <paramref name="right"/> vector.
+ /// If the X values are exactly equal, then it repeats this check
+ /// with the Y values of the two vectors.
+ /// This operator is useful for sorting vectors.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the left is less than the right.</returns>
public static bool operator <(Vector2i left, Vector2i right)
{
- if (left.x.Equals(right.x))
+ if (left.x == right.x)
{
return left.y < right.y;
}
return left.x < right.x;
}
+ /// <summary>
+ /// Compares two <see cref="Vector2i"/> vectors by first checking if
+ /// the X value of the <paramref name="left"/> vector is greater than
+ /// the X value of the <paramref name="right"/> vector.
+ /// If the X values are exactly equal, then it repeats this check
+ /// with the Y values of the two vectors.
+ /// This operator is useful for sorting vectors.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the left is greater than the right.</returns>
public static bool operator >(Vector2i left, Vector2i right)
{
- if (left.x.Equals(right.x))
+ if (left.x == right.x)
{
return left.y > right.y;
}
return left.x > right.x;
}
+ /// <summary>
+ /// Compares two <see cref="Vector2i"/> vectors by first checking if
+ /// the X value of the <paramref name="left"/> vector is less than
+ /// or equal to the X value of the <paramref name="right"/> vector.
+ /// If the X values are exactly equal, then it repeats this check
+ /// with the Y values of the two vectors.
+ /// This operator is useful for sorting vectors.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the left is less than or equal to the right.</returns>
public static bool operator <=(Vector2i left, Vector2i right)
{
- if (left.x.Equals(right.x))
+ if (left.x == right.x)
{
return left.y <= right.y;
}
- return left.x <= right.x;
+ return left.x < right.x;
}
+ /// <summary>
+ /// Compares two <see cref="Vector2i"/> vectors by first checking if
+ /// the X value of the <paramref name="left"/> vector is greater than
+ /// or equal to the X value of the <paramref name="right"/> vector.
+ /// If the X values are exactly equal, then it repeats this check
+ /// with the Y values of the two vectors.
+ /// This operator is useful for sorting vectors.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the left is greater than or equal to the right.</returns>
public static bool operator >=(Vector2i left, Vector2i right)
{
- if (left.x.Equals(right.x))
+ if (left.x == right.x)
{
return left.y >= right.y;
}
- return left.x >= right.x;
+ return left.x > right.x;
}
/// <summary>
@@ -515,10 +674,11 @@ namespace Godot
}
/// <summary>
- /// Returns <see langword="true"/> if this vector and <paramref name="obj"/> are equal.
+ /// Returns <see langword="true"/> if the vector is equal
+ /// to the given object (<see paramref="obj"/>).
/// </summary>
- /// <param name="obj">The other object to compare.</param>
- /// <returns>Whether or not the vector and the other object are equal.</returns>
+ /// <param name="obj">The object to compare with.</param>
+ /// <returns>Whether or not the vector and the object are equal.</returns>
public override bool Equals(object obj)
{
if (obj is Vector2i)
@@ -530,9 +690,9 @@ namespace Godot
}
/// <summary>
- /// Returns <see langword="true"/> if this vector and <paramref name="other"/> are equal.
+ /// Returns <see langword="true"/> if the vectors are equal.
/// </summary>
- /// <param name="other">The other vector to compare.</param>
+ /// <param name="other">The other vector.</param>
/// <returns>Whether or not the vectors are equal.</returns>
public bool Equals(Vector2i other)
{
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
index 01e3a71bcb..63d9be0a6d 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
@@ -699,6 +699,13 @@ namespace Godot
z = v.z;
}
+ /// <summary>
+ /// Adds each component of the <see cref="Vector3"/>
+ /// with the components of the given <see cref="Vector3"/>.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>The added vector.</returns>
public static Vector3 operator +(Vector3 left, Vector3 right)
{
left.x += right.x;
@@ -707,6 +714,13 @@ namespace Godot
return left;
}
+ /// <summary>
+ /// Subtracts each component of the <see cref="Vector3"/>
+ /// by the components of the given <see cref="Vector3"/>.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>The subtracted vector.</returns>
public static Vector3 operator -(Vector3 left, Vector3 right)
{
left.x -= right.x;
@@ -715,6 +729,15 @@ namespace Godot
return left;
}
+ /// <summary>
+ /// Returns the negative value of the <see cref="Vector3"/>.
+ /// This is the same as writing <c>new Vector3(-v.x, -v.y, -v.z)</c>.
+ /// This operation flips the direction of the vector while
+ /// keeping the same magnitude.
+ /// With floats, the number zero can be either positive or negative.
+ /// </summary>
+ /// <param name="vec">The vector to negate/flip.</param>
+ /// <returns>The negated/flipped vector.</returns>
public static Vector3 operator -(Vector3 vec)
{
vec.x = -vec.x;
@@ -723,6 +746,13 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Multiplies each component of the <see cref="Vector3"/>
+ /// by the given <see cref="real_t"/>.
+ /// </summary>
+ /// <param name="vec">The vector to multiply.</param>
+ /// <param name="scale">The scale to multiply by.</param>
+ /// <returns>The multiplied vector.</returns>
public static Vector3 operator *(Vector3 vec, real_t scale)
{
vec.x *= scale;
@@ -731,6 +761,13 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Multiplies each component of the <see cref="Vector3"/>
+ /// by the given <see cref="real_t"/>.
+ /// </summary>
+ /// <param name="scale">The scale to multiply by.</param>
+ /// <param name="vec">The vector to multiply.</param>
+ /// <returns>The multiplied vector.</returns>
public static Vector3 operator *(real_t scale, Vector3 vec)
{
vec.x *= scale;
@@ -739,6 +776,13 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Multiplies each component of the <see cref="Vector3"/>
+ /// by the components of the given <see cref="Vector3"/>.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>The multiplied vector.</returns>
public static Vector3 operator *(Vector3 left, Vector3 right)
{
left.x *= right.x;
@@ -747,6 +791,13 @@ namespace Godot
return left;
}
+ /// <summary>
+ /// Divides each component of the <see cref="Vector3"/>
+ /// by the given <see cref="real_t"/>.
+ /// </summary>
+ /// <param name="vec">The dividend vector.</param>
+ /// <param name="divisor">The divisor value.</param>
+ /// <returns>The divided vector.</returns>
public static Vector3 operator /(Vector3 vec, real_t divisor)
{
vec.x /= divisor;
@@ -755,6 +806,13 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Divides each component of the <see cref="Vector3"/>
+ /// by the components of the given <see cref="Vector3"/>.
+ /// </summary>
+ /// <param name="vec">The dividend vector.</param>
+ /// <param name="divisorv">The divisor vector.</param>
+ /// <returns>The divided vector.</returns>
public static Vector3 operator /(Vector3 vec, Vector3 divisorv)
{
vec.x /= divisorv.x;
@@ -763,6 +821,22 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Gets the remainder of each component of the <see cref="Vector3"/>
+ /// with the components of the given <see cref="real_t"/>.
+ /// This operation uses truncated division, which is often not desired
+ /// as it does not work well with negative numbers.
+ /// Consider using <see cref="PosMod(real_t)"/> instead
+ /// if you want to handle negative numbers.
+ /// </summary>
+ /// <example>
+ /// <code>
+ /// GD.Print(new Vector3(10, -20, 30) % 7); // Prints "(3, -6, 2)"
+ /// </code>
+ /// </example>
+ /// <param name="vec">The dividend vector.</param>
+ /// <param name="divisor">The divisor value.</param>
+ /// <returns>The remainder vector.</returns>
public static Vector3 operator %(Vector3 vec, real_t divisor)
{
vec.x %= divisor;
@@ -771,6 +845,22 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Gets the remainder of each component of the <see cref="Vector3"/>
+ /// with the components of the given <see cref="Vector3"/>.
+ /// This operation uses truncated division, which is often not desired
+ /// as it does not work well with negative numbers.
+ /// Consider using <see cref="PosMod(Vector3)"/> instead
+ /// if you want to handle negative numbers.
+ /// </summary>
+ /// <example>
+ /// <code>
+ /// GD.Print(new Vector3(10, -20, 30) % new Vector3(7, 8, 9)); // Prints "(3, -4, 3)"
+ /// </code>
+ /// </example>
+ /// <param name="vec">The dividend vector.</param>
+ /// <param name="divisorv">The divisor vector.</param>
+ /// <returns>The remainder vector.</returns>
public static Vector3 operator %(Vector3 vec, Vector3 divisorv)
{
vec.x %= divisorv.x;
@@ -779,16 +869,43 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the vectors are exactly equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the vectors are exactly equal.</returns>
public static bool operator ==(Vector3 left, Vector3 right)
{
return left.Equals(right);
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the vectors are not equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the vectors are not equal.</returns>
public static bool operator !=(Vector3 left, Vector3 right)
{
return !left.Equals(right);
}
+ /// <summary>
+ /// Compares two <see cref="Vector3"/> vectors by first checking if
+ /// the X value of the <paramref name="left"/> vector is less than
+ /// the X value of the <paramref name="right"/> vector.
+ /// If the X values are exactly equal, then it repeats this check
+ /// with the Y values of the two vectors, and then with the Z values.
+ /// This operator is useful for sorting vectors.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the left is less than the right.</returns>
public static bool operator <(Vector3 left, Vector3 right)
{
if (left.x == right.x)
@@ -802,6 +919,17 @@ namespace Godot
return left.x < right.x;
}
+ /// <summary>
+ /// Compares two <see cref="Vector3"/> vectors by first checking if
+ /// the X value of the <paramref name="left"/> vector is greater than
+ /// the X value of the <paramref name="right"/> vector.
+ /// If the X values are exactly equal, then it repeats this check
+ /// with the Y values of the two vectors, and then with the Z values.
+ /// This operator is useful for sorting vectors.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the left is greater than the right.</returns>
public static bool operator >(Vector3 left, Vector3 right)
{
if (left.x == right.x)
@@ -815,6 +943,17 @@ namespace Godot
return left.x > right.x;
}
+ /// <summary>
+ /// Compares two <see cref="Vector3"/> vectors by first checking if
+ /// the X value of the <paramref name="left"/> vector is less than
+ /// or equal to the X value of the <paramref name="right"/> vector.
+ /// If the X values are exactly equal, then it repeats this check
+ /// with the Y values of the two vectors, and then with the Z values.
+ /// This operator is useful for sorting vectors.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the left is less than or equal to the right.</returns>
public static bool operator <=(Vector3 left, Vector3 right)
{
if (left.x == right.x)
@@ -828,6 +967,17 @@ namespace Godot
return left.x < right.x;
}
+ /// <summary>
+ /// Compares two <see cref="Vector3"/> vectors by first checking if
+ /// the X value of the <paramref name="left"/> vector is greater than
+ /// or equal to the X value of the <paramref name="right"/> vector.
+ /// If the X values are exactly equal, then it repeats this check
+ /// with the Y values of the two vectors, and then with the Z values.
+ /// This operator is useful for sorting vectors.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the left is greater than or equal to the right.</returns>
public static bool operator >=(Vector3 left, Vector3 right)
{
if (left.x == right.x)
@@ -842,10 +992,13 @@ namespace Godot
}
/// <summary>
- /// Returns <see langword="true"/> if this vector and <paramref name="obj"/> are equal.
+ /// Returns <see langword="true"/> if the vector is exactly equal
+ /// to the given object (<see paramref="obj"/>).
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
/// </summary>
- /// <param name="obj">The other object to compare.</param>
- /// <returns>Whether or not the vector and the other object are equal.</returns>
+ /// <param name="obj">The object to compare with.</param>
+ /// <returns>Whether or not the vector and the object are equal.</returns>
public override bool Equals(object obj)
{
if (obj is Vector3)
@@ -857,10 +1010,12 @@ namespace Godot
}
/// <summary>
- /// Returns <see langword="true"/> if this vector and <paramref name="other"/> are equal
+ /// Returns <see langword="true"/> if the vectors are exactly equal.
+ /// Note: Due to floating-point precision errors, consider using
+ /// <see cref="IsEqualApprox"/> instead, which is more reliable.
/// </summary>
- /// <param name="other">The other vector to compare.</param>
- /// <returns>Whether or not the vectors are equal.</returns>
+ /// <param name="other">The other vector.</param>
+ /// <returns>Whether or not the vectors are exactly equal.</returns>
public bool Equals(Vector3 other)
{
return x == other.x && y == other.y && z == other.z;
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs
index 2a7771cdfc..474876fc91 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs
@@ -347,6 +347,13 @@ namespace Godot
this.z = Mathf.RoundToInt(v.z);
}
+ /// <summary>
+ /// Adds each component of the <see cref="Vector3i"/>
+ /// with the components of the given <see cref="Vector3i"/>.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>The added vector.</returns>
public static Vector3i operator +(Vector3i left, Vector3i right)
{
left.x += right.x;
@@ -355,6 +362,13 @@ namespace Godot
return left;
}
+ /// <summary>
+ /// Subtracts each component of the <see cref="Vector3i"/>
+ /// by the components of the given <see cref="Vector3i"/>.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>The subtracted vector.</returns>
public static Vector3i operator -(Vector3i left, Vector3i right)
{
left.x -= right.x;
@@ -363,6 +377,14 @@ namespace Godot
return left;
}
+ /// <summary>
+ /// Returns the negative value of the <see cref="Vector3i"/>.
+ /// This is the same as writing <c>new Vector3i(-v.x, -v.y, -v.z)</c>.
+ /// This operation flips the direction of the vector while
+ /// keeping the same magnitude.
+ /// </summary>
+ /// <param name="vec">The vector to negate/flip.</param>
+ /// <returns>The negated/flipped vector.</returns>
public static Vector3i operator -(Vector3i vec)
{
vec.x = -vec.x;
@@ -371,6 +393,13 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Multiplies each component of the <see cref="Vector3i"/>
+ /// by the given <see langword="int"/>.
+ /// </summary>
+ /// <param name="vec">The vector to multiply.</param>
+ /// <param name="scale">The scale to multiply by.</param>
+ /// <returns>The multiplied vector.</returns>
public static Vector3i operator *(Vector3i vec, int scale)
{
vec.x *= scale;
@@ -379,6 +408,13 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Multiplies each component of the <see cref="Vector3i"/>
+ /// by the given <see langword="int"/>.
+ /// </summary>
+ /// <param name="scale">The scale to multiply by.</param>
+ /// <param name="vec">The vector to multiply.</param>
+ /// <returns>The multiplied vector.</returns>
public static Vector3i operator *(int scale, Vector3i vec)
{
vec.x *= scale;
@@ -387,6 +423,13 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Multiplies each component of the <see cref="Vector3i"/>
+ /// by the components of the given <see cref="Vector3i"/>.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>The multiplied vector.</returns>
public static Vector3i operator *(Vector3i left, Vector3i right)
{
left.x *= right.x;
@@ -395,6 +438,13 @@ namespace Godot
return left;
}
+ /// <summary>
+ /// Multiplies each component of the <see cref="Vector3i"/>
+ /// by the given <see langword="int"/>.
+ /// </summary>
+ /// <param name="vec">The dividend vector.</param>
+ /// <param name="divisor">The divisor value.</param>
+ /// <returns>The divided vector.</returns>
public static Vector3i operator /(Vector3i vec, int divisor)
{
vec.x /= divisor;
@@ -403,6 +453,13 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Divides each component of the <see cref="Vector3i"/>
+ /// by the components of the given <see cref="Vector3i"/>.
+ /// </summary>
+ /// <param name="vec">The dividend vector.</param>
+ /// <param name="divisorv">The divisor vector.</param>
+ /// <returns>The divided vector.</returns>
public static Vector3i operator /(Vector3i vec, Vector3i divisorv)
{
vec.x /= divisorv.x;
@@ -411,6 +468,22 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Gets the remainder of each component of the <see cref="Vector3i"/>
+ /// with the components of the given <see langword="int"/>.
+ /// This operation uses truncated division, which is often not desired
+ /// as it does not work well with negative numbers.
+ /// Consider using <see cref="PosMod(int)"/> instead
+ /// if you want to handle negative numbers.
+ /// </summary>
+ /// <example>
+ /// <code>
+ /// GD.Print(new Vector3i(10, -20, 30) % 7); // Prints "(3, -6, 2)"
+ /// </code>
+ /// </example>
+ /// <param name="vec">The dividend vector.</param>
+ /// <param name="divisor">The divisor value.</param>
+ /// <returns>The remainder vector.</returns>
public static Vector3i operator %(Vector3i vec, int divisor)
{
vec.x %= divisor;
@@ -419,6 +492,22 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Gets the remainder of each component of the <see cref="Vector3i"/>
+ /// with the components of the given <see cref="Vector3i"/>.
+ /// This operation uses truncated division, which is often not desired
+ /// as it does not work well with negative numbers.
+ /// Consider using <see cref="PosMod(Vector3i)"/> instead
+ /// if you want to handle negative numbers.
+ /// </summary>
+ /// <example>
+ /// <code>
+ /// GD.Print(new Vector3i(10, -20, 30) % new Vector3i(7, 8, 9)); // Prints "(3, -4, 3)"
+ /// </code>
+ /// </example>
+ /// <param name="vec">The dividend vector.</param>
+ /// <param name="divisorv">The divisor vector.</param>
+ /// <returns>The remainder vector.</returns>
public static Vector3i operator %(Vector3i vec, Vector3i divisorv)
{
vec.x %= divisorv.x;
@@ -427,6 +516,13 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Performs a bitwise AND operation with this <see cref="Vector3i"/>
+ /// and the given <see langword="int"/>.
+ /// </summary>
+ /// <param name="vec">The vector to AND with.</param>
+ /// <param name="and">The integer to AND with.</param>
+ /// <returns>The result of the bitwise AND.</returns>
public static Vector3i operator &(Vector3i vec, int and)
{
vec.x &= and;
@@ -435,6 +531,13 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Performs a bitwise AND operation with this <see cref="Vector3i"/>
+ /// and the given <see cref="Vector3i"/>.
+ /// </summary>
+ /// <param name="vec">The left vector to AND with.</param>
+ /// <param name="andv">The right vector to AND with.</param>
+ /// <returns>The result of the bitwise AND.</returns>
public static Vector3i operator &(Vector3i vec, Vector3i andv)
{
vec.x &= andv.x;
@@ -443,65 +546,121 @@ namespace Godot
return vec;
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the vectors are equal.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the vectors are equal.</returns>
public static bool operator ==(Vector3i left, Vector3i right)
{
return left.Equals(right);
}
+ /// <summary>
+ /// Returns <see langword="true"/> if the vectors are not equal.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the vectors are not equal.</returns>
public static bool operator !=(Vector3i left, Vector3i right)
{
return !left.Equals(right);
}
+ /// <summary>
+ /// Compares two <see cref="Vector3i"/> vectors by first checking if
+ /// the X value of the <paramref name="left"/> vector is less than
+ /// the X value of the <paramref name="right"/> vector.
+ /// If the X values are exactly equal, then it repeats this check
+ /// with the Y values of the two vectors, and then with the Z values.
+ /// This operator is useful for sorting vectors.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the left is less than the right.</returns>
public static bool operator <(Vector3i left, Vector3i right)
{
if (left.x == right.x)
{
if (left.y == right.y)
+ {
return left.z < right.z;
- else
- return left.y < right.y;
+ }
+ return left.y < right.y;
}
-
return left.x < right.x;
}
+ /// <summary>
+ /// Compares two <see cref="Vector3i"/> vectors by first checking if
+ /// the X value of the <paramref name="left"/> vector is greater than
+ /// the X value of the <paramref name="right"/> vector.
+ /// If the X values are exactly equal, then it repeats this check
+ /// with the Y values of the two vectors, and then with the Z values.
+ /// This operator is useful for sorting vectors.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the left is greater than the right.</returns>
public static bool operator >(Vector3i left, Vector3i right)
{
if (left.x == right.x)
{
if (left.y == right.y)
+ {
return left.z > right.z;
- else
- return left.y > right.y;
+ }
+ return left.y > right.y;
}
-
return left.x > right.x;
}
+ /// <summary>
+ /// Compares two <see cref="Vector3i"/> vectors by first checking if
+ /// the X value of the <paramref name="left"/> vector is less than
+ /// or equal to the X value of the <paramref name="right"/> vector.
+ /// If the X values are exactly equal, then it repeats this check
+ /// with the Y values of the two vectors, and then with the Z values.
+ /// This operator is useful for sorting vectors.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the left is less than or equal to the right.</returns>
public static bool operator <=(Vector3i left, Vector3i right)
{
if (left.x == right.x)
{
if (left.y == right.y)
+ {
return left.z <= right.z;
- else
- return left.y < right.y;
+ }
+ return left.y < right.y;
}
-
return left.x < right.x;
}
+ /// <summary>
+ /// Compares two <see cref="Vector3i"/> vectors by first checking if
+ /// the X value of the <paramref name="left"/> vector is greater than
+ /// or equal to the X value of the <paramref name="right"/> vector.
+ /// If the X values are exactly equal, then it repeats this check
+ /// with the Y values of the two vectors, and then with the Z values.
+ /// This operator is useful for sorting vectors.
+ /// </summary>
+ /// <param name="left">The left vector.</param>
+ /// <param name="right">The right vector.</param>
+ /// <returns>Whether or not the left is greater than or equal to the right.</returns>
public static bool operator >=(Vector3i left, Vector3i right)
{
if (left.x == right.x)
{
if (left.y == right.y)
+ {
return left.z >= right.z;
- else
- return left.y > right.y;
+ }
+ return left.y > right.y;
}
-
return left.x > right.x;
}
@@ -524,10 +683,11 @@ namespace Godot
}
/// <summary>
- /// Returns <see langword="true"/> if this vector and <paramref name="obj"/> are equal.
+ /// Returns <see langword="true"/> if the vector is equal
+ /// to the given object (<see paramref="obj"/>).
/// </summary>
- /// <param name="obj">The other object to compare.</param>
- /// <returns>Whether or not the vector and the other object are equal.</returns>
+ /// <param name="obj">The object to compare with.</param>
+ /// <returns>Whether or not the vector and the object are equal.</returns>
public override bool Equals(object obj)
{
if (obj is Vector3i)
@@ -539,9 +699,9 @@ namespace Godot
}
/// <summary>
- /// Returns <see langword="true"/> if this vector and <paramref name="other"/> are equal
+ /// Returns <see langword="true"/> if the vectors are equal.
/// </summary>
- /// <param name="other">The other vector to compare.</param>
+ /// <param name="other">The other vector.</param>
/// <returns>Whether or not the vectors are equal.</returns>
public bool Equals(Vector3i other)
{
diff --git a/platform/osx/crash_handler_osx.mm b/platform/osx/crash_handler_osx.mm
index 2252d5eb4f..57bca7a5b9 100644
--- a/platform/osx/crash_handler_osx.mm
+++ b/platform/osx/crash_handler_osx.mm
@@ -134,8 +134,13 @@ static void handle_crash(int sig) {
args.push_back("-o");
args.push_back(_execpath);
+#if defined(__x86_64) || defined(__x86_64__) || defined(__amd64__)
args.push_back("-arch");
args.push_back("x86_64");
+#elif defined(__aarch64__)
+ args.push_back("-arch");
+ args.push_back("arm64");
+#endif
args.push_back("-l");
snprintf(str, 1024, "%p", load_addr);
args.push_back(str);
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index b4ee85120e..bf5671be19 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -232,6 +232,7 @@ void Camera2D::_notification(int p_what) {
} break;
case NOTIFICATION_ENTER_TREE: {
+ ERR_FAIL_COND(!is_inside_tree());
if (custom_viewport && ObjectDB::get_instance(custom_viewport_id)) {
viewport = custom_viewport;
} else {
diff --git a/scene/3d/gpu_particles_collision_3d.cpp b/scene/3d/gpu_particles_collision_3d.cpp
index 6ac9364b1a..2235de1599 100644
--- a/scene/3d/gpu_particles_collision_3d.cpp
+++ b/scene/3d/gpu_particles_collision_3d.cpp
@@ -256,10 +256,10 @@ void GPUParticlesCollisionSDF::_find_closest_distance(const Vector3 &p_pos, cons
Vector2 pq1 = v1 - e1 * CLAMP(v1.dot(e1) / e1.dot(e1), 0.0, 1.0);
Vector2 pq2 = v2 - e2 * CLAMP(v2.dot(e2) / e2.dot(e2), 0.0, 1.0);
- float s = SGN(e0.x * e2.y - e0.y * e2.x);
+ float s = SIGN(e0.x * e2.y - e0.y * e2.x);
Vector2 d2 = Vector2(pq0.dot(pq0), s * (v0.x * e0.y - v0.y * e0.x)).min(Vector2(pq1.dot(pq1), s * (v1.x * e1.y - v1.y * e1.x))).min(Vector2(pq2.dot(pq2), s * (v2.x * e2.y - v2.y * e2.x)));
- inside_d = -Math::sqrt(d2.x) * SGN(d2.y);
+ inside_d = -Math::sqrt(d2.x) * SIGN(d2.y);
}
//make sure distance to planes is not shorter if inside
@@ -288,7 +288,7 @@ void GPUParticlesCollisionSDF::_find_closest_distance(const Vector3 &p_pos, cons
Vector3 nor = ba.cross(ac);
inside_d = Math::sqrt(
- (SGN(ba.cross(nor).dot(pa)) + SGN(cb.cross(nor).dot(pb)) + SGN(ac.cross(nor).dot(pc)) < 2.0)
+ (SIGN(ba.cross(nor).dot(pa)) + SIGN(cb.cross(nor).dot(pb)) + SIGN(ac.cross(nor).dot(pc)) < 2.0)
? MIN(MIN(
Vector3_dot2(ba * CLAMP(ba.dot(pa) / Vector3_dot2(ba), 0.0, 1.0) - pa),
Vector3_dot2(cb * CLAMP(cb.dot(pb) / Vector3_dot2(cb), 0.0, 1.0) - pb)),
diff --git a/scene/3d/reflection_probe.cpp b/scene/3d/reflection_probe.cpp
index 40d4d822c9..f7f19596a7 100644
--- a/scene/3d/reflection_probe.cpp
+++ b/scene/3d/reflection_probe.cpp
@@ -94,7 +94,7 @@ void ReflectionProbe::set_extents(const Vector3 &p_extents) {
}
if (extents[i] - 0.01 < ABS(origin_offset[i])) {
- origin_offset[i] = SGN(origin_offset[i]) * (extents[i] - 0.01);
+ origin_offset[i] = SIGN(origin_offset[i]) * (extents[i] - 0.01);
}
}
@@ -113,7 +113,7 @@ void ReflectionProbe::set_origin_offset(const Vector3 &p_extents) {
for (int i = 0; i < 3; i++) {
if (extents[i] - 0.01 < ABS(origin_offset[i])) {
- origin_offset[i] = SGN(origin_offset[i]) * (extents[i] - 0.01);
+ origin_offset[i] = SIGN(origin_offset[i]) * (extents[i] - 0.01);
}
}
RS::get_singleton()->reflection_probe_set_extents(probe, extents);
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index 013358e75c..7b2ea46e17 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -320,7 +320,9 @@ void ScrollContainer::_notification(int p_what) {
};
if (p_what == NOTIFICATION_READY) {
- get_viewport()->connect("gui_focus_changed", callable_mp(this, &ScrollContainer::_gui_focus_changed));
+ Viewport *viewport = get_viewport();
+ ERR_FAIL_COND(!viewport);
+ viewport->connect("gui_focus_changed", callable_mp(this, &ScrollContainer::_gui_focus_changed));
_update_dimensions();
}
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index 4497c20772..f30206c943 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -166,7 +166,7 @@ void SpinBox::gui_input(const Ref<InputEvent> &p_event) {
if (mm.is_valid() && (mm->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE) {
if (drag.enabled) {
drag.diff_y += mm->get_relative().y;
- float diff_y = -0.01 * Math::pow(ABS(drag.diff_y), 1.8f) * SGN(drag.diff_y);
+ float diff_y = -0.01 * Math::pow(ABS(drag.diff_y), 1.8f) * SIGN(drag.diff_y);
set_value(CLAMP(drag.base_val + get_step() * diff_y, get_min(), get_max()));
} else if (drag.allowed && drag.capture_pos.distance_to(mm->get_position()) > 2) {
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_CAPTURED);
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 8ffbe479be..fbfeea5722 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -3396,7 +3396,7 @@ Point2i TextEdit::get_line_column_at_pos(const Point2i &p_pos) const {
int wrap_index = 0;
if (get_line_wrapping_mode() != LineWrappingMode::LINE_WRAPPING_NONE || _is_hiding_enabled()) {
- Point2i f_ofs = get_next_visible_line_index_offset_from(first_vis_line, caret.wrap_ofs, rows + (1 * SGN(rows)));
+ Point2i f_ofs = get_next_visible_line_index_offset_from(first_vis_line, caret.wrap_ofs, rows + (1 * SIGN(rows)));
wrap_index = f_ofs.y;
if (rows < 0) {
row = first_vis_line - (f_ofs.x - 1);
@@ -3471,7 +3471,7 @@ int TextEdit::get_minimap_line_at_pos(const Point2i &p_pos) const {
int row = minimap_line + Math::floor(rows);
if (get_line_wrapping_mode() != LineWrappingMode::LINE_WRAPPING_NONE || _is_hiding_enabled()) {
- int f_ofs = get_next_visible_line_index_offset_from(minimap_line, caret.wrap_ofs, rows + (1 * SGN(rows))).x - 1;
+ int f_ofs = get_next_visible_line_index_offset_from(minimap_line, caret.wrap_ofs, rows + (1 * SIGN(rows))).x - 1;
if (rows < 0) {
row = minimap_line - f_ofs;
} else {
@@ -5762,7 +5762,7 @@ double TextEdit::_get_v_scroll_offset() const {
}
void TextEdit::_scroll_up(real_t p_delta) {
- if (scrolling && smooth_scroll_enabled && SGN(target_v_scroll - v_scroll->get_value()) != SGN(-p_delta)) {
+ if (scrolling && smooth_scroll_enabled && SIGN(target_v_scroll - v_scroll->get_value()) != SIGN(-p_delta)) {
scrolling = false;
minimap_clicked = false;
}
@@ -5789,7 +5789,7 @@ void TextEdit::_scroll_up(real_t p_delta) {
}
void TextEdit::_scroll_down(real_t p_delta) {
- if (scrolling && smooth_scroll_enabled && SGN(target_v_scroll - v_scroll->get_value()) != SGN(p_delta)) {
+ if (scrolling && smooth_scroll_enabled && SIGN(target_v_scroll - v_scroll->get_value()) != SIGN(p_delta)) {
scrolling = false;
minimap_clicked = false;
}
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 7c4cdf828b..27e617bdd0 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -3164,7 +3164,7 @@ void Tree::gui_input(const Ref<InputEvent> &p_event) {
} else {
const TreeItem::Cell &c = popup_edited_item->cells[popup_edited_item_col];
float diff_y = -mm->get_relative().y;
- diff_y = Math::pow(ABS(diff_y), 1.8f) * SGN(diff_y);
+ diff_y = Math::pow(ABS(diff_y), 1.8f) * SIGN(diff_y);
diff_y *= 0.1;
range_drag_base = CLAMP(range_drag_base + c.step * diff_y, c.min, c.max);
popup_edited_item->set_range(popup_edited_item_col, range_drag_base);
diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp
index 5065684839..22e3c3bf24 100644
--- a/scene/main/canvas_item.cpp
+++ b/scene/main/canvas_item.cpp
@@ -274,6 +274,7 @@ void CanvasItem::_exit_canvas() {
void CanvasItem::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
+ ERR_FAIL_COND(!is_inside_tree());
_update_texture_filter_changed(false);
_update_texture_repeat_changed(false);
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index 3700e87839..29aca6b321 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -317,7 +317,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
Vector<real_t> times = d["times"];
Vector<real_t> values = d["points"];
- ERR_FAIL_COND_V(times.size() * 5 != values.size(), false);
+ ERR_FAIL_COND_V(times.size() * 6 != values.size(), false);
if (times.size()) {
int valcount = times.size();
@@ -330,11 +330,12 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
for (int i = 0; i < valcount; i++) {
bt->values.write[i].time = rt[i];
bt->values.write[i].transition = 0; //unused in bezier
- bt->values.write[i].value.value = rv[i * 5 + 0];
- bt->values.write[i].value.in_handle.x = rv[i * 5 + 1];
- bt->values.write[i].value.in_handle.y = rv[i * 5 + 2];
- bt->values.write[i].value.out_handle.x = rv[i * 5 + 3];
- bt->values.write[i].value.out_handle.y = rv[i * 5 + 4];
+ bt->values.write[i].value.value = rv[i * 6 + 0];
+ bt->values.write[i].value.in_handle.x = rv[i * 6 + 1];
+ bt->values.write[i].value.in_handle.y = rv[i * 6 + 2];
+ bt->values.write[i].value.out_handle.x = rv[i * 6 + 3];
+ bt->values.write[i].value.out_handle.y = rv[i * 6 + 4];
+ bt->values.write[i].value.handle_mode = (HandleMode)rv[i * 6 + 5];
}
}
@@ -698,7 +699,7 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
int kk = bt->values.size();
key_times.resize(kk);
- key_points.resize(kk * 5);
+ key_points.resize(kk * 6);
real_t *wti = key_times.ptrw();
real_t *wpo = key_points.ptrw();
@@ -709,11 +710,12 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
for (int i = 0; i < kk; i++) {
wti[idx] = vls[i].time;
- wpo[idx * 5 + 0] = vls[i].value.value;
- wpo[idx * 5 + 1] = vls[i].value.in_handle.x;
- wpo[idx * 5 + 2] = vls[i].value.in_handle.y;
- wpo[idx * 5 + 3] = vls[i].value.out_handle.x;
- wpo[idx * 5 + 4] = vls[i].value.out_handle.y;
+ wpo[idx * 6 + 0] = vls[i].value.value;
+ wpo[idx * 6 + 1] = vls[i].value.in_handle.x;
+ wpo[idx * 6 + 2] = vls[i].value.in_handle.y;
+ wpo[idx * 6 + 3] = vls[i].value.out_handle.x;
+ wpo[idx * 6 + 4] = vls[i].value.out_handle.y;
+ wpo[idx * 6 + 5] = (double)vls[i].value.handle_mode;
idx++;
}
@@ -1623,7 +1625,7 @@ void Animation::track_insert_key(int p_track, double p_time, const Variant &p_ke
BezierTrack *bt = static_cast<BezierTrack *>(t);
Array arr = p_key;
- ERR_FAIL_COND(arr.size() != 5);
+ ERR_FAIL_COND(arr.size() != 6);
TKey<BezierKey> k;
k.time = p_time;
@@ -1632,6 +1634,7 @@ void Animation::track_insert_key(int p_track, double p_time, const Variant &p_ke
k.value.in_handle.y = arr[2];
k.value.out_handle.x = arr[3];
k.value.out_handle.y = arr[4];
+ k.value.handle_mode = (HandleMode) int(arr[5]);
_insert(p_time, bt->values, k);
} break;
@@ -1770,12 +1773,13 @@ Variant Animation::track_get_key_value(int p_track, int p_key_idx) const {
ERR_FAIL_INDEX_V(p_key_idx, bt->values.size(), Variant());
Array arr;
- arr.resize(5);
+ arr.resize(6);
arr[0] = bt->values[p_key_idx].value.value;
arr[1] = bt->values[p_key_idx].value.in_handle.x;
arr[2] = bt->values[p_key_idx].value.in_handle.y;
arr[3] = bt->values[p_key_idx].value.out_handle.x;
arr[4] = bt->values[p_key_idx].value.out_handle.y;
+ arr[5] = (double)bt->values[p_key_idx].value.handle_mode;
return arr;
} break;
@@ -2144,13 +2148,14 @@ void Animation::track_set_key_value(int p_track, int p_key_idx, const Variant &p
ERR_FAIL_INDEX(p_key_idx, bt->values.size());
Array arr = p_value;
- ERR_FAIL_COND(arr.size() != 5);
+ ERR_FAIL_COND(arr.size() != 6);
bt->values.write[p_key_idx].value.value = arr[0];
bt->values.write[p_key_idx].value.in_handle.x = arr[1];
bt->values.write[p_key_idx].value.in_handle.y = arr[2];
bt->values.write[p_key_idx].value.out_handle.x = arr[3];
bt->values.write[p_key_idx].value.out_handle.y = arr[4];
+ bt->values.write[p_key_idx].value.handle_mode = (HandleMode) int(arr[5]);
} break;
case TYPE_AUDIO: {
@@ -3203,7 +3208,7 @@ StringName Animation::method_track_get_name(int p_track, int p_key_idx) const {
return pm->methods[p_key_idx].method;
}
-int Animation::bezier_track_insert_key(int p_track, double p_time, real_t p_value, const Vector2 &p_in_handle, const Vector2 &p_out_handle) {
+int Animation::bezier_track_insert_key(int p_track, double p_time, real_t p_value, const Vector2 &p_in_handle, const Vector2 &p_out_handle, const HandleMode p_handle_mode) {
ERR_FAIL_INDEX_V(p_track, tracks.size(), -1);
Track *t = tracks[p_track];
ERR_FAIL_COND_V(t->type != TYPE_BEZIER, -1);
@@ -3221,6 +3226,7 @@ int Animation::bezier_track_insert_key(int p_track, double p_time, real_t p_valu
if (k.value.out_handle.x < 0) {
k.value.out_handle.x = 0;
}
+ k.value.handle_mode = p_handle_mode;
int key = _insert(p_time, bt->values, k);
@@ -3229,6 +3235,30 @@ int Animation::bezier_track_insert_key(int p_track, double p_time, real_t p_valu
return key;
}
+void Animation::bezier_track_set_key_handle_mode(int p_track, int p_index, HandleMode p_mode, double p_balanced_value_time_ratio) {
+ ERR_FAIL_INDEX(p_track, tracks.size());
+ Track *t = tracks[p_track];
+ ERR_FAIL_COND(t->type != TYPE_BEZIER);
+
+ BezierTrack *bt = static_cast<BezierTrack *>(t);
+
+ ERR_FAIL_INDEX(p_index, bt->values.size());
+
+ bt->values.write[p_index].value.handle_mode = p_mode;
+
+ if (p_mode == HANDLE_MODE_BALANCED) {
+ Transform2D xform;
+ xform.set_scale(Vector2(1.0, 1.0 / p_balanced_value_time_ratio));
+
+ Vector2 vec_in = xform.xform(bt->values[p_index].value.in_handle);
+ Vector2 vec_out = xform.xform(bt->values[p_index].value.out_handle);
+
+ bt->values.write[p_index].value.in_handle = xform.affine_inverse().xform(-vec_out.normalized() * vec_in.length());
+ }
+
+ emit_changed();
+}
+
void Animation::bezier_track_set_key_value(int p_track, int p_index, real_t p_value) {
ERR_FAIL_INDEX(p_track, tracks.size());
Track *t = tracks[p_track];
@@ -3242,7 +3272,7 @@ void Animation::bezier_track_set_key_value(int p_track, int p_index, real_t p_va
emit_changed();
}
-void Animation::bezier_track_set_key_in_handle(int p_track, int p_index, const Vector2 &p_handle) {
+void Animation::bezier_track_set_key_in_handle(int p_track, int p_index, const Vector2 &p_handle, double p_balanced_value_time_ratio) {
ERR_FAIL_INDEX(p_track, tracks.size());
Track *t = tracks[p_track];
ERR_FAIL_COND(t->type != TYPE_BEZIER);
@@ -3251,14 +3281,26 @@ void Animation::bezier_track_set_key_in_handle(int p_track, int p_index, const V
ERR_FAIL_INDEX(p_index, bt->values.size());
- bt->values.write[p_index].value.in_handle = p_handle;
- if (bt->values[p_index].value.in_handle.x > 0) {
- bt->values.write[p_index].value.in_handle.x = 0;
+ Vector2 in_handle = p_handle;
+ if (in_handle.x > 0) {
+ in_handle.x = 0;
+ }
+ bt->values.write[p_index].value.in_handle = in_handle;
+
+ if (bt->values[p_index].value.handle_mode == HANDLE_MODE_BALANCED) {
+ Transform2D xform;
+ xform.set_scale(Vector2(1.0, 1.0 / p_balanced_value_time_ratio));
+
+ Vector2 vec_out = xform.xform(bt->values[p_index].value.out_handle);
+ Vector2 vec_in = xform.xform(in_handle);
+
+ bt->values.write[p_index].value.out_handle = xform.affine_inverse().xform(-vec_in.normalized() * vec_out.length());
}
+
emit_changed();
}
-void Animation::bezier_track_set_key_out_handle(int p_track, int p_index, const Vector2 &p_handle) {
+void Animation::bezier_track_set_key_out_handle(int p_track, int p_index, const Vector2 &p_handle, double p_balanced_value_time_ratio) {
ERR_FAIL_INDEX(p_track, tracks.size());
Track *t = tracks[p_track];
ERR_FAIL_COND(t->type != TYPE_BEZIER);
@@ -3267,10 +3309,22 @@ void Animation::bezier_track_set_key_out_handle(int p_track, int p_index, const
ERR_FAIL_INDEX(p_index, bt->values.size());
- bt->values.write[p_index].value.out_handle = p_handle;
- if (bt->values[p_index].value.out_handle.x < 0) {
- bt->values.write[p_index].value.out_handle.x = 0;
+ Vector2 out_handle = p_handle;
+ if (out_handle.x < 0) {
+ out_handle.x = 0;
+ }
+ bt->values.write[p_index].value.out_handle = out_handle;
+
+ if (bt->values[p_index].value.handle_mode == HANDLE_MODE_BALANCED) {
+ Transform2D xform;
+ xform.set_scale(Vector2(1.0, 1.0 / p_balanced_value_time_ratio));
+
+ Vector2 vec_in = xform.xform(bt->values[p_index].value.in_handle);
+ Vector2 vec_out = xform.xform(out_handle);
+
+ bt->values.write[p_index].value.in_handle = xform.affine_inverse().xform(-vec_out.normalized() * vec_in.length());
}
+
emit_changed();
}
@@ -3286,6 +3340,18 @@ real_t Animation::bezier_track_get_key_value(int p_track, int p_index) const {
return bt->values[p_index].value.value;
}
+int Animation::bezier_track_get_key_handle_mode(int p_track, int p_index) const {
+ ERR_FAIL_INDEX_V(p_track, tracks.size(), 0);
+ Track *t = tracks[p_track];
+ ERR_FAIL_COND_V(t->type != TYPE_BEZIER, 0);
+
+ BezierTrack *bt = static_cast<BezierTrack *>(t);
+
+ ERR_FAIL_INDEX_V(p_index, bt->values.size(), 0);
+
+ return bt->values[p_index].value.handle_mode;
+}
+
Vector2 Animation::bezier_track_get_key_in_handle(int p_track, int p_index) const {
ERR_FAIL_INDEX_V(p_track, tracks.size(), Vector2());
Track *t = tracks[p_track];
@@ -3718,11 +3784,11 @@ void Animation::_bind_methods() {
ClassDB::bind_method(D_METHOD("method_track_get_name", "track_idx", "key_idx"), &Animation::method_track_get_name);
ClassDB::bind_method(D_METHOD("method_track_get_params", "track_idx", "key_idx"), &Animation::method_track_get_params);
- ClassDB::bind_method(D_METHOD("bezier_track_insert_key", "track_idx", "time", "value", "in_handle", "out_handle"), &Animation::bezier_track_insert_key, DEFVAL(Vector2()), DEFVAL(Vector2()));
+ ClassDB::bind_method(D_METHOD("bezier_track_insert_key", "track_idx", "time", "value", "in_handle", "out_handle", "handle_mode"), &Animation::bezier_track_insert_key, DEFVAL(Vector2()), DEFVAL(Vector2()), DEFVAL(Animation::HandleMode::HANDLE_MODE_BALANCED));
ClassDB::bind_method(D_METHOD("bezier_track_set_key_value", "track_idx", "key_idx", "value"), &Animation::bezier_track_set_key_value);
- ClassDB::bind_method(D_METHOD("bezier_track_set_key_in_handle", "track_idx", "key_idx", "in_handle"), &Animation::bezier_track_set_key_in_handle);
- ClassDB::bind_method(D_METHOD("bezier_track_set_key_out_handle", "track_idx", "key_idx", "out_handle"), &Animation::bezier_track_set_key_out_handle);
+ ClassDB::bind_method(D_METHOD("bezier_track_set_key_in_handle", "track_idx", "key_idx", "in_handle", "balanced_value_time_ratio"), &Animation::bezier_track_set_key_in_handle, DEFVAL(1.0));
+ ClassDB::bind_method(D_METHOD("bezier_track_set_key_out_handle", "track_idx", "key_idx", "out_handle", "balanced_value_time_ratio"), &Animation::bezier_track_set_key_out_handle, DEFVAL(1.0));
ClassDB::bind_method(D_METHOD("bezier_track_get_key_value", "track_idx", "key_idx"), &Animation::bezier_track_get_key_value);
ClassDB::bind_method(D_METHOD("bezier_track_get_key_in_handle", "track_idx", "key_idx"), &Animation::bezier_track_get_key_in_handle);
@@ -3738,6 +3804,9 @@ void Animation::_bind_methods() {
ClassDB::bind_method(D_METHOD("audio_track_get_key_start_offset", "track_idx", "key_idx"), &Animation::audio_track_get_key_start_offset);
ClassDB::bind_method(D_METHOD("audio_track_get_key_end_offset", "track_idx", "key_idx"), &Animation::audio_track_get_key_end_offset);
+ ClassDB::bind_method(D_METHOD("bezier_track_set_key_handle_mode", "track_idx", "key_idx", "key_handle_mode", "balanced_value_time_ratio"), &Animation::bezier_track_set_key_handle_mode, DEFVAL(1.0));
+ ClassDB::bind_method(D_METHOD("bezier_track_get_key_handle_mode", "track_idx", "key_idx"), &Animation::bezier_track_get_key_handle_mode);
+
ClassDB::bind_method(D_METHOD("animation_track_insert_key", "track_idx", "time", "animation"), &Animation::animation_track_insert_key);
ClassDB::bind_method(D_METHOD("animation_track_set_key_animation", "track_idx", "key_idx", "animation"), &Animation::animation_track_set_key_animation);
ClassDB::bind_method(D_METHOD("animation_track_get_key_animation", "track_idx", "key_idx"), &Animation::animation_track_get_key_animation);
@@ -3784,6 +3853,9 @@ void Animation::_bind_methods() {
BIND_ENUM_CONSTANT(LOOP_NONE);
BIND_ENUM_CONSTANT(LOOP_LINEAR);
BIND_ENUM_CONSTANT(LOOP_PINGPONG);
+
+ BIND_ENUM_CONSTANT(HANDLE_MODE_FREE);
+ BIND_ENUM_CONSTANT(HANDLE_MODE_BALANCED);
}
void Animation::clear() {
diff --git a/scene/resources/animation.h b/scene/resources/animation.h
index 510d6c8323..8e4287e4fb 100644
--- a/scene/resources/animation.h
+++ b/scene/resources/animation.h
@@ -72,6 +72,11 @@ public:
LOOP_PINGPONG,
};
+ enum HandleMode {
+ HANDLE_MODE_FREE,
+ HANDLE_MODE_BALANCED,
+ };
+
private:
struct Track {
TrackType type = TrackType::TYPE_ANIMATION;
@@ -157,10 +162,10 @@ private:
};
/* BEZIER TRACK */
-
struct BezierKey {
Vector2 in_handle; //relative (x always <0)
Vector2 out_handle; //relative (x always >0)
+ HandleMode handle_mode = HANDLE_MODE_BALANCED;
real_t value = 0.0;
};
@@ -419,11 +424,13 @@ public:
void track_set_interpolation_type(int p_track, InterpolationType p_interp);
InterpolationType track_get_interpolation_type(int p_track) const;
- int bezier_track_insert_key(int p_track, double p_time, real_t p_value, const Vector2 &p_in_handle, const Vector2 &p_out_handle);
+ int bezier_track_insert_key(int p_track, double p_time, real_t p_value, const Vector2 &p_in_handle, const Vector2 &p_out_handle, const HandleMode p_handle_mode = HandleMode::HANDLE_MODE_BALANCED);
+ void bezier_track_set_key_handle_mode(int p_track, int p_index, HandleMode p_mode, double p_balanced_value_time_ratio = 1.0);
void bezier_track_set_key_value(int p_track, int p_index, real_t p_value);
- void bezier_track_set_key_in_handle(int p_track, int p_index, const Vector2 &p_handle);
- void bezier_track_set_key_out_handle(int p_track, int p_index, const Vector2 &p_handle);
+ void bezier_track_set_key_in_handle(int p_track, int p_index, const Vector2 &p_handle, double p_balanced_value_time_ratio = 1.0);
+ void bezier_track_set_key_out_handle(int p_track, int p_index, const Vector2 &p_handle, double p_balanced_value_time_ratio = 1.0);
real_t bezier_track_get_key_value(int p_track, int p_index) const;
+ int bezier_track_get_key_handle_mode(int p_track, int p_index) const;
Vector2 bezier_track_get_key_in_handle(int p_track, int p_index) const;
Vector2 bezier_track_get_key_out_handle(int p_track, int p_index) const;
@@ -478,6 +485,7 @@ public:
VARIANT_ENUM_CAST(Animation::TrackType);
VARIANT_ENUM_CAST(Animation::InterpolationType);
VARIANT_ENUM_CAST(Animation::UpdateMode);
+VARIANT_ENUM_CAST(Animation::HandleMode);
VARIANT_ENUM_CAST(Animation::LoopMode);
#endif
diff --git a/servers/physics_2d/godot_step_2d.cpp b/servers/physics_2d/godot_step_2d.cpp
index 84ec0e3c63..00d11acdab 100644
--- a/servers/physics_2d/godot_step_2d.cpp
+++ b/servers/physics_2d/godot_step_2d.cpp
@@ -152,6 +152,9 @@ void GodotStep2D::step(GodotSpace2D *p_space, real_t p_delta, int p_iterations)
p_space->set_active_objects(active_count);
+ // Update the broadphase to register collision pairs.
+ p_space->update();
+
{ //profile
profile_endtime = OS::get_singleton()->get_ticks_usec();
p_space->set_elapsed_time(GodotSpace2D::ELAPSED_TIME_INTEGRATE_FORCES, profile_endtime - profile_begtime);
@@ -286,7 +289,6 @@ void GodotStep2D::step(GodotSpace2D *p_space, real_t p_delta, int p_iterations)
all_constraints.clear();
- p_space->update();
p_space->unlock();
_step++;
}
diff --git a/servers/physics_3d/godot_shape_3d.cpp b/servers/physics_3d/godot_shape_3d.cpp
index b520ee45c7..d1e919ab6a 100644
--- a/servers/physics_3d/godot_shape_3d.cpp
+++ b/servers/physics_3d/godot_shape_3d.cpp
@@ -430,7 +430,7 @@ Vector3 GodotBoxShape3D::get_closest_point_to(const Vector3 &p_point) const {
if (outside == 1) {
//use plane if only one side matches
Vector3 n;
- n[i] = SGN(p_point[i]);
+ n[i] = SIGN(p_point[i]);
Plane p(n, half_extents[i]);
min_point = p.project(p_point);
diff --git a/servers/physics_3d/godot_step_3d.cpp b/servers/physics_3d/godot_step_3d.cpp
index 331d65df49..5453c4415c 100644
--- a/servers/physics_3d/godot_step_3d.cpp
+++ b/servers/physics_3d/godot_step_3d.cpp
@@ -220,6 +220,9 @@ void GodotStep3D::step(GodotSpace3D *p_space, real_t p_delta, int p_iterations)
p_space->set_active_objects(active_count);
+ // Update the broadphase to register collision pairs.
+ p_space->update();
+
{ //profile
profile_endtime = OS::get_singleton()->get_ticks_usec();
p_space->set_elapsed_time(GodotSpace3D::ELAPSED_TIME_INTEGRATE_FORCES, profile_endtime - profile_begtime);
@@ -398,7 +401,6 @@ void GodotStep3D::step(GodotSpace3D *p_space, real_t p_delta, int p_iterations)
all_constraints.clear();
- p_space->update();
p_space->unlock();
_step++;
}
diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
index 6ae76c9bf2..61f2031a70 100644
--- a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
+++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
@@ -585,6 +585,7 @@ void SceneShaderForwardClustered::init(RendererStorageRD *p_storage, const Strin
actions.renames["CUSTOM1"] = "custom1_attrib";
actions.renames["CUSTOM2"] = "custom2_attrib";
actions.renames["CUSTOM3"] = "custom3_attrib";
+ actions.renames["OUTPUT_IS_SRGB"] = "SHADER_IS_SRGB";
// not implemented but need these just in case code is in the shaders
actions.renames["VIEW_INDEX"] = "0";
diff --git a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp
index 3a6c945052..5d5cb7a6b7 100644
--- a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp
+++ b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp
@@ -573,6 +573,7 @@ void SceneShaderForwardMobile::init(RendererStorageRD *p_storage, const String p
actions.renames["CUSTOM1"] = "custom1_attrib";
actions.renames["CUSTOM2"] = "custom2_attrib";
actions.renames["CUSTOM3"] = "custom3_attrib";
+ actions.renames["OUTPUT_IS_SRGB"] = "SHADER_IS_SRGB";
actions.renames["VIEW_INDEX"] = "ViewIndex";
actions.renames["VIEW_MONO_LEFT"] = "0";
diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.cpp b/servers/rendering/renderer_rd/renderer_storage_rd.cpp
index 64be176d24..04753d7a9b 100644
--- a/servers/rendering/renderer_rd/renderer_storage_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_storage_rd.cpp
@@ -2868,7 +2868,7 @@ bool RendererStorageRD::MaterialData::update_parameters_uniform_set(const Map<St
//check whether buffer changed
if (p_uniform_dirty && ubo_data.size()) {
- update_uniform_buffer(p_uniforms, p_uniform_offsets, p_parameters, ubo_data.ptrw(), ubo_data.size(), false);
+ update_uniform_buffer(p_uniforms, p_uniform_offsets, p_parameters, ubo_data.ptrw(), ubo_data.size(), true);
RD::get_singleton()->buffer_update(uniform_buffer, 0, ubo_data.size(), ubo_data.ptrw(), p_barrier);
}
diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl
index 83c02d08a7..20982a466c 100644
--- a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl
+++ b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl
@@ -6,6 +6,8 @@
#include "scene_forward_clustered_inc.glsl"
+#define SHADER_IS_SRGB false
+
/* INPUT ATTRIBS */
layout(location = 0) in vec3 vertex_attrib;
@@ -358,6 +360,8 @@ void main() {
#VERSION_DEFINES
+#define SHADER_IS_SRGB false
+
/* Specialization Constants (Toggles) */
layout(constant_id = 0) const bool sc_use_forward_gi = false;
diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl
index cfafde493b..b6fd89d912 100644
--- a/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl
+++ b/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl
@@ -7,6 +7,8 @@
/* Include our forward mobile UBOs definitions etc. */
#include "scene_forward_mobile_inc.glsl"
+#define SHADER_IS_SRGB false
+
/* INPUT ATTRIBS */
layout(location = 0) in vec3 vertex_attrib;
@@ -370,6 +372,8 @@ void main() {
#VERSION_DEFINES
+#define SHADER_IS_SRGB false
+
/* Specialization Constants */
#if !defined(MODE_RENDER_DEPTH)