Skip to content

Commit 9b5c7e9

Browse files
committed
Merge pull request #99545 from KoBeWi/Vector4.0
Fix stringification of Vector4
2 parents 0d88737 + e210313 commit 9b5c7e9

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

core/math/vector4.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ Vector4 Vector4::clampf(real_t p_min, real_t p_max) const {
213213
}
214214

215215
Vector4::operator String() const {
216-
return "(" + String::num_real(x, false) + ", " + String::num_real(y, false) + ", " + String::num_real(z, false) + ", " + String::num_real(w, false) + ")";
216+
return "(" + String::num_real(x, true) + ", " + String::num_real(y, true) + ", " + String::num_real(z, true) + ", " + String::num_real(w, true) + ")";
217217
}
218218

219219
static_assert(sizeof(Vector4) == 4 * sizeof(real_t));

modules/gdscript/tests/scripts/runtime/features/stringify.gd

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,18 @@ func test():
44
print(-1.25, 0.25, 1.25)
55
print("hello world")
66

7-
print(Vector2(0.25, 0.25))
7+
print(Vector2(0.25, 1))
88
print(Vector2i(0, 0))
99

10-
print(Rect2(0.25, 0.25, 0.5, 0.5))
10+
print(Rect2(0.25, 0.25, 0.5, 1))
1111
print(Rect2i(0, 0, 0, 0))
1212

13-
print(Vector3(0.25, 0.25, 0.25))
13+
print(Vector3(0.25, 0.25, 1))
1414
print(Vector3i(0, 0, 0))
1515

16+
print(Vector4(0.25, 0.25, 0.25, 1))
17+
print(Vector4i(0, 0, 0, 0))
18+
1619
print(Transform2D.IDENTITY)
1720
print(Plane(1, 2, 3, 4))
1821
print(Quaternion(1, 2, 3, 4))

modules/gdscript/tests/scripts/runtime/features/stringify.out

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ truefalse
33
-101
44
-1.250.251.25
55
hello world
6-
(0.25, 0.25)
6+
(0.25, 1.0)
77
(0, 0)
8-
[P: (0.25, 0.25), S: (0.5, 0.5)]
8+
[P: (0.25, 0.25), S: (0.5, 1.0)]
99
[P: (0, 0), S: (0, 0)]
10-
(0.25, 0.25, 0.25)
10+
(0.25, 0.25, 1.0)
1111
(0, 0, 0)
12+
(0.25, 0.25, 0.25, 1.0)
13+
(0, 0, 0, 0)
1214
[X: (1.0, 0.0), Y: (0.0, 1.0), O: (0.0, 0.0)]
1315
[N: (1.0, 2.0, 3.0), D: 4]
1416
(1, 2, 3, 4)
@@ -32,4 +34,4 @@ Node::[signal]property_list_changed
3234
[(1.0, 1.0), (0.0, 0.0)]
3335
[(1.0, 1.0, 1.0), (0.0, 0.0, 0.0)]
3436
[(1.0, 0.0, 0.0, 1.0), (0.0, 0.0, 1.0, 1.0), (0.0, 1.0, 0.0, 1.0)]
35-
[(1, 1, 1, 1), (0, 0, 0, 0)]
37+
[(1.0, 1.0, 1.0, 1.0), (0.0, 0.0, 0.0, 0.0)]

0 commit comments

Comments
 (0)