Skip to content

Commit 79dd3cf

Browse files
committed
Update API
1 parent 42c29a2 commit 79dd3cf

File tree

888 files changed

+35655
-8765
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

888 files changed

+35655
-8765
lines changed

kt/api-generator/src/main/kotlin/godot/codegen/models/Header.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ data class Header @JsonCreator constructor(
99
@JsonProperty("version_patch") val versionPatch: Int,
1010
@JsonProperty("version_status") val versionStatus: String,
1111
@JsonProperty("version_build") val versionBuild: String,
12-
@JsonProperty("version_full_name") val versionFullName: String
12+
@JsonProperty("version_full_name") val versionFullName: String,
13+
@JsonProperty("precision") val precision: String
1314
)

kt/api-generator/src/main/resources/api.json

Lines changed: 17092 additions & 2545 deletions
Large diffs are not rendered by default.

kt/godot-library/godot-api-library/src/main/kotlin/godot/RegisterEngineTypes.kt

Lines changed: 64 additions & 0 deletions
Large diffs are not rendered by default.

kt/godot-library/godot-api-library/src/main/kotlin/godot/api/AESContext.kt

Lines changed: 51 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,30 @@ import kotlin.jvm.JvmOverloads
3232
* var aes = AESContext.new()
3333
*
3434
* func _ready():
35-
* var key = "My secret key!!!" # Key must be either 16 or 32 bytes.
36-
* var data = "My secret text!!" # Data size must be multiple of 16 bytes, apply padding if
37-
* needed.
38-
* # Encrypt ECB
39-
* aes.start(AESContext.MODE_ECB_ENCRYPT, key.to_utf8_buffer())
40-
* var encrypted = aes.update(data.to_utf8_buffer())
41-
* aes.finish()
42-
* # Decrypt ECB
43-
* aes.start(AESContext.MODE_ECB_DECRYPT, key.to_utf8_buffer())
44-
* var decrypted = aes.update(encrypted)
45-
* aes.finish()
46-
* # Check ECB
47-
* assert(decrypted == data.to_utf8_buffer())
35+
* var key = "My secret key!!!" # Key must be either 16 or 32 bytes.
36+
* var data = "My secret text!!" # Data size must be multiple of 16 bytes, apply padding if needed.
37+
* # Encrypt ECB
38+
* aes.start(AESContext.MODE_ECB_ENCRYPT, key.to_utf8_buffer())
39+
* var encrypted = aes.update(data.to_utf8_buffer())
40+
* aes.finish()
41+
* # Decrypt ECB
42+
* aes.start(AESContext.MODE_ECB_DECRYPT, key.to_utf8_buffer())
43+
* var decrypted = aes.update(encrypted)
44+
* aes.finish()
45+
* # Check ECB
46+
* assert(decrypted == data.to_utf8_buffer())
4847
*
49-
* var iv = "My secret iv!!!!" # IV must be of exactly 16 bytes.
50-
* # Encrypt CBC
51-
* aes.start(AESContext.MODE_CBC_ENCRYPT, key.to_utf8_buffer(), iv.to_utf8_buffer())
52-
* encrypted = aes.update(data.to_utf8_buffer())
53-
* aes.finish()
54-
* # Decrypt CBC
55-
* aes.start(AESContext.MODE_CBC_DECRYPT, key.to_utf8_buffer(), iv.to_utf8_buffer())
56-
* decrypted = aes.update(encrypted)
57-
* aes.finish()
58-
* # Check CBC
59-
* assert(decrypted == data.to_utf8_buffer())
48+
* var iv = "My secret iv!!!!" # IV must be of exactly 16 bytes.
49+
* # Encrypt CBC
50+
* aes.start(AESContext.MODE_CBC_ENCRYPT, key.to_utf8_buffer(), iv.to_utf8_buffer())
51+
* encrypted = aes.update(data.to_utf8_buffer())
52+
* aes.finish()
53+
* # Decrypt CBC
54+
* aes.start(AESContext.MODE_CBC_DECRYPT, key.to_utf8_buffer(), iv.to_utf8_buffer())
55+
* decrypted = aes.update(encrypted)
56+
* aes.finish()
57+
* # Check CBC
58+
* assert(decrypted == data.to_utf8_buffer())
6059
* ```
6160
*
6261
* ```csharp
@@ -66,36 +65,36 @@ import kotlin.jvm.JvmOverloads
6665
*
6766
* public partial class MyNode : Node
6867
* {
69-
* private AesContext _aes = new AesContext();
68+
* private AesContext _aes = new AesContext();
7069
*
71-
* public override void _Ready()
72-
* {
73-
* string key = "My secret key!!!"; // Key must be either 16 or 32 bytes.
74-
* string data = "My secret text!!"; // Data size must be multiple of 16 bytes, apply
75-
* padding if needed.
76-
* // Encrypt ECB
77-
* _aes.Start(AesContext.Mode.EcbEncrypt, key.ToUtf8Buffer());
78-
* byte[] encrypted = _aes.Update(data.ToUtf8Buffer());
79-
* _aes.Finish();
80-
* // Decrypt ECB
81-
* _aes.Start(AesContext.Mode.EcbDecrypt, key.ToUtf8Buffer());
82-
* byte[] decrypted = _aes.Update(encrypted);
83-
* _aes.Finish();
84-
* // Check ECB
85-
* Debug.Assert(decrypted == data.ToUtf8Buffer());
70+
* public override void _Ready()
71+
* {
72+
* string key = "My secret key!!!"; // Key must be either 16 or 32 bytes.
73+
* string data = "My secret text!!"; // Data size must be multiple of 16 bytes, apply padding if
74+
* needed.
75+
* // Encrypt ECB
76+
* _aes.Start(AesContext.Mode.EcbEncrypt, key.ToUtf8Buffer());
77+
* byte[] encrypted = _aes.Update(data.ToUtf8Buffer());
78+
* _aes.Finish();
79+
* // Decrypt ECB
80+
* _aes.Start(AesContext.Mode.EcbDecrypt, key.ToUtf8Buffer());
81+
* byte[] decrypted = _aes.Update(encrypted);
82+
* _aes.Finish();
83+
* // Check ECB
84+
* Debug.Assert(decrypted == data.ToUtf8Buffer());
8685
*
87-
* string iv = "My secret iv!!!!"; // IV must be of exactly 16 bytes.
88-
* // Encrypt CBC
89-
* _aes.Start(AesContext.Mode.EcbEncrypt, key.ToUtf8Buffer(), iv.ToUtf8Buffer());
90-
* encrypted = _aes.Update(data.ToUtf8Buffer());
91-
* _aes.Finish();
92-
* // Decrypt CBC
93-
* _aes.Start(AesContext.Mode.EcbDecrypt, key.ToUtf8Buffer(), iv.ToUtf8Buffer());
94-
* decrypted = _aes.Update(encrypted);
95-
* _aes.Finish();
96-
* // Check CBC
97-
* Debug.Assert(decrypted == data.ToUtf8Buffer());
98-
* }
86+
* string iv = "My secret iv!!!!"; // IV must be of exactly 16 bytes.
87+
* // Encrypt CBC
88+
* _aes.Start(AesContext.Mode.EcbEncrypt, key.ToUtf8Buffer(), iv.ToUtf8Buffer());
89+
* encrypted = _aes.Update(data.ToUtf8Buffer());
90+
* _aes.Finish();
91+
* // Decrypt CBC
92+
* _aes.Start(AesContext.Mode.EcbDecrypt, key.ToUtf8Buffer(), iv.ToUtf8Buffer());
93+
* decrypted = _aes.Update(encrypted);
94+
* _aes.Finish();
95+
* // Check CBC
96+
* Debug.Assert(decrypted == data.ToUtf8Buffer());
97+
* }
9998
* }
10099
* ```
101100
*/

kt/godot-library/godot-api-library/src/main/kotlin/godot/api/AStar2D.kt

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import kotlin.Long
2828
import kotlin.NotImplementedError
2929
import kotlin.Suppress
3030
import kotlin.Unit
31+
import kotlin.jvm.JvmName
3132
import kotlin.jvm.JvmOverloads
3233

3334
/**
@@ -39,10 +40,31 @@ import kotlin.jvm.JvmOverloads
3940
*/
4041
@GodotBaseType
4142
public open class AStar2D : RefCounted() {
43+
/**
44+
* If `true` enables the filtering of neighbors via [_filterNeighbor].
45+
*/
46+
public final inline var neighborFilterEnabled: Boolean
47+
@JvmName("neighborFilterEnabledProperty")
48+
get() = isNeighborFilterEnabled()
49+
@JvmName("neighborFilterEnabledProperty")
50+
set(`value`) {
51+
setNeighborFilterEnabled(value)
52+
}
53+
4254
public override fun new(scriptIndex: Int): Unit {
4355
createNativeObject(3, scriptIndex)
4456
}
4557

58+
/**
59+
* Called when neighboring enters processing and if [neighborFilterEnabled] is `true`. If `true`
60+
* is returned the point will not be processed.
61+
*
62+
* Note that this function is hidden in the default [AStar2D] class.
63+
*/
64+
public open fun _filterNeighbor(fromId: Long, neighborId: Long): Boolean {
65+
throw NotImplementedError("AStar2D::_filterNeighbor is not implemented.")
66+
}
67+
4668
/**
4769
* Called when estimating the cost between a point and the path's ending point.
4870
*
@@ -202,6 +224,17 @@ public open class AStar2D : RefCounted() {
202224
return (TransferContext.readReturnValue(PACKED_INT_64_ARRAY) as PackedInt64Array)
203225
}
204226

227+
public final fun setNeighborFilterEnabled(enabled: Boolean): Unit {
228+
TransferContext.writeArguments(BOOL to enabled)
229+
TransferContext.callMethod(ptr, MethodBindings.setNeighborFilterEnabledPtr, NIL)
230+
}
231+
232+
public final fun isNeighborFilterEnabled(): Boolean {
233+
TransferContext.writeArguments()
234+
TransferContext.callMethod(ptr, MethodBindings.isNeighborFilterEnabledPtr, BOOL)
235+
return (TransferContext.readReturnValue(BOOL) as Boolean)
236+
}
237+
205238
/**
206239
* Disables or enables the specified point for pathfinding. Useful for making a temporary
207240
* obstacle.
@@ -301,8 +334,7 @@ public open class AStar2D : RefCounted() {
301334

302335
/**
303336
* Reserves space internally for [numNodes] points. Useful if you're adding a known large number
304-
* of points at once, such as points on a grid. The new capacity must be greater or equal to the old
305-
* capacity.
337+
* of points at once, such as points on a grid.
306338
*/
307339
public final fun reserveSpace(numNodes: Long): Unit {
308340
TransferContext.writeArguments(LONG to numNodes)
@@ -369,8 +401,8 @@ public open class AStar2D : RefCounted() {
369401
* If there is no valid path to the target, and [allowPartialPath] is `true`, returns a path to
370402
* the point closest to the target that can be reached.
371403
*
372-
* **Note:** This method is not thread-safe. If called from a [Thread], it will return an empty
373-
* array and will print an error message.
404+
* **Note:** This method is not thread-safe; it can only be used from a single [Thread] at a given
405+
* time. Consider using [Mutex] to ensure exclusive access to one thread to avoid race conditions.
374406
*
375407
* Additionally, when [allowPartialPath] is `true` and [toId] is disabled the search may take an
376408
* unusually long time to finish.
@@ -474,6 +506,12 @@ public open class AStar2D : RefCounted() {
474506
internal val getPointIdsPtr: VoidPtr =
475507
TypeManager.getMethodBindPtr("AStar2D", "get_point_ids", 3851388692)
476508

509+
internal val setNeighborFilterEnabledPtr: VoidPtr =
510+
TypeManager.getMethodBindPtr("AStar2D", "set_neighbor_filter_enabled", 2586408642)
511+
512+
internal val isNeighborFilterEnabledPtr: VoidPtr =
513+
TypeManager.getMethodBindPtr("AStar2D", "is_neighbor_filter_enabled", 36873697)
514+
477515
internal val setPointDisabledPtr: VoidPtr =
478516
TypeManager.getMethodBindPtr("AStar2D", "set_point_disabled", 972357352)
479517

kt/godot-library/godot-api-library/src/main/kotlin/godot/api/AStar3D.kt

Lines changed: 60 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import kotlin.Long
2828
import kotlin.NotImplementedError
2929
import kotlin.Suppress
3030
import kotlin.Unit
31+
import kotlin.jvm.JvmName
3132
import kotlin.jvm.JvmOverloads
3233

3334
/**
@@ -53,14 +54,14 @@ import kotlin.jvm.JvmOverloads
5354
* extends AStar3D
5455
*
5556
* func _compute_cost(u, v):
56-
* var u_pos = get_point_position(u)
57-
* var v_pos = get_point_position(v)
58-
* return abs(u_pos.x - v_pos.x) + abs(u_pos.y - v_pos.y) + abs(u_pos.z - v_pos.z)
57+
* var u_pos = get_point_position(u)
58+
* var v_pos = get_point_position(v)
59+
* return abs(u_pos.x - v_pos.x) + abs(u_pos.y - v_pos.y) + abs(u_pos.z - v_pos.z)
5960
*
6061
* func _estimate_cost(u, v):
61-
* var u_pos = get_point_position(u)
62-
* var v_pos = get_point_position(v)
63-
* return abs(u_pos.x - v_pos.x) + abs(u_pos.y - v_pos.y) + abs(u_pos.z - v_pos.z)
62+
* var u_pos = get_point_position(u)
63+
* var v_pos = get_point_position(v)
64+
* return abs(u_pos.x - v_pos.x) + abs(u_pos.y - v_pos.y) + abs(u_pos.z - v_pos.z)
6465
* ```
6566
*
6667
* ```csharp
@@ -70,22 +71,22 @@ import kotlin.jvm.JvmOverloads
7071
* [GlobalClass]
7172
* public partial class MyAStar3D : AStar3D
7273
* {
73-
* public override float _ComputeCost(long fromId, long toId)
74-
* {
75-
* Vector3 fromPoint = GetPointPosition(fromId);
76-
* Vector3 toPoint = GetPointPosition(toId);
74+
* public override float _ComputeCost(long fromId, long toId)
75+
* {
76+
* Vector3 fromPoint = GetPointPosition(fromId);
77+
* Vector3 toPoint = GetPointPosition(toId);
7778
*
78-
* return Mathf.Abs(fromPoint.X - toPoint.X) + Mathf.Abs(fromPoint.Y - toPoint.Y) +
79+
* return Mathf.Abs(fromPoint.X - toPoint.X) + Mathf.Abs(fromPoint.Y - toPoint.Y) +
7980
* Mathf.Abs(fromPoint.Z - toPoint.Z);
80-
* }
81+
* }
8182
*
82-
* public override float _EstimateCost(long fromId, long toId)
83-
* {
84-
* Vector3 fromPoint = GetPointPosition(fromId);
85-
* Vector3 toPoint = GetPointPosition(toId);
86-
* return Mathf.Abs(fromPoint.X - toPoint.X) + Mathf.Abs(fromPoint.Y - toPoint.Y) +
83+
* public override float _EstimateCost(long fromId, long toId)
84+
* {
85+
* Vector3 fromPoint = GetPointPosition(fromId);
86+
* Vector3 toPoint = GetPointPosition(toId);
87+
* return Mathf.Abs(fromPoint.X - toPoint.X) + Mathf.Abs(fromPoint.Y - toPoint.Y) +
8788
* Mathf.Abs(fromPoint.Z - toPoint.Z);
88-
* }
89+
* }
8990
* }
9091
* ```
9192
*
@@ -103,10 +104,31 @@ import kotlin.jvm.JvmOverloads
103104
*/
104105
@GodotBaseType
105106
public open class AStar3D : RefCounted() {
107+
/**
108+
* If `true` enables the filtering of neighbors via [_filterNeighbor].
109+
*/
110+
public final inline var neighborFilterEnabled: Boolean
111+
@JvmName("neighborFilterEnabledProperty")
112+
get() = isNeighborFilterEnabled()
113+
@JvmName("neighborFilterEnabledProperty")
114+
set(`value`) {
115+
setNeighborFilterEnabled(value)
116+
}
117+
106118
public override fun new(scriptIndex: Int): Unit {
107119
createNativeObject(4, scriptIndex)
108120
}
109121

122+
/**
123+
* Called when neighboring point enters processing and if [neighborFilterEnabled] is `true`. If
124+
* `true` is returned the point will not be processed.
125+
*
126+
* Note that this function is hidden in the default [AStar3D] class.
127+
*/
128+
public open fun _filterNeighbor(fromId: Long, neighborId: Long): Boolean {
129+
throw NotImplementedError("AStar3D::_filterNeighbor is not implemented.")
130+
}
131+
110132
/**
111133
* Called when estimating the cost between a point and the path's ending point.
112134
*
@@ -285,6 +307,17 @@ public open class AStar3D : RefCounted() {
285307
return (TransferContext.readReturnValue(BOOL) as Boolean)
286308
}
287309

310+
public final fun setNeighborFilterEnabled(enabled: Boolean): Unit {
311+
TransferContext.writeArguments(BOOL to enabled)
312+
TransferContext.callMethod(ptr, MethodBindings.setNeighborFilterEnabledPtr, NIL)
313+
}
314+
315+
public final fun isNeighborFilterEnabled(): Boolean {
316+
TransferContext.writeArguments()
317+
TransferContext.callMethod(ptr, MethodBindings.isNeighborFilterEnabledPtr, BOOL)
318+
return (TransferContext.readReturnValue(BOOL) as Boolean)
319+
}
320+
288321
/**
289322
* Creates a segment between the given points. If [bidirectional] is `false`, only movement from
290323
* [id] to [toId] is allowed, not the reverse direction.
@@ -365,8 +398,7 @@ public open class AStar3D : RefCounted() {
365398

366399
/**
367400
* Reserves space internally for [numNodes] points. Useful if you're adding a known large number
368-
* of points at once, such as points on a grid. New capacity must be greater or equals to old
369-
* capacity.
401+
* of points at once, such as points on a grid.
370402
*/
371403
public final fun reserveSpace(numNodes: Long): Unit {
372404
TransferContext.writeArguments(LONG to numNodes)
@@ -433,8 +465,8 @@ public open class AStar3D : RefCounted() {
433465
* If there is no valid path to the target, and [allowPartialPath] is `true`, returns a path to
434466
* the point closest to the target that can be reached.
435467
*
436-
* **Note:** This method is not thread-safe. If called from a [Thread], it will return an empty
437-
* array and will print an error message.
468+
* **Note:** This method is not thread-safe; it can only be used from a single [Thread] at a given
469+
* time. Consider using [Mutex] to ensure exclusive access to one thread to avoid race conditions.
438470
*
439471
* Additionally, when [allowPartialPath] is `true` and [toId] is disabled the search may take an
440472
* unusually long time to finish.
@@ -543,6 +575,12 @@ public open class AStar3D : RefCounted() {
543575
internal val isPointDisabledPtr: VoidPtr =
544576
TypeManager.getMethodBindPtr("AStar3D", "is_point_disabled", 1116898809)
545577

578+
internal val setNeighborFilterEnabledPtr: VoidPtr =
579+
TypeManager.getMethodBindPtr("AStar3D", "set_neighbor_filter_enabled", 2586408642)
580+
581+
internal val isNeighborFilterEnabledPtr: VoidPtr =
582+
TypeManager.getMethodBindPtr("AStar3D", "is_neighbor_filter_enabled", 36873697)
583+
546584
internal val connectPointsPtr: VoidPtr =
547585
TypeManager.getMethodBindPtr("AStar3D", "connect_points", 3710494224)
548586

kt/godot-library/godot-api-library/src/main/kotlin/godot/api/AStarGrid2D.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,8 @@ public open class AStarGrid2D : RefCounted() {
558558
* If there is no valid path to the target, and [allowPartialPath] is `true`, returns a path to
559559
* the point closest to the target that can be reached.
560560
*
561-
* **Note:** This method is not thread-safe. If called from a [Thread], it will return an empty
562-
* array and will print an error message.
561+
* **Note:** This method is not thread-safe; it can only be used from a single [Thread] at a given
562+
* time. Consider using [Mutex] to ensure exclusive access to one thread to avoid race conditions.
563563
*
564564
* Additionally, when [allowPartialPath] is `true` and [toId] is solid the search may take an
565565
* unusually long time to finish.

0 commit comments

Comments
 (0)