You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We represent the default value in ClassDB as an instance of RID which doesn't tell us we don't care about this instance (i.e. the default value is in fact "a new instance of RID is going to be created each time you call the function")
I think the easier solution would be to add a workaround in extension_api_dump.cpp (typically adding "RID()" as default_value if the argument type is RID and it has a default value set).
Of course this is not perfect given this way extension_api.json also don't provide the "this default value should be generated before each use". However we can fix this by adding a reusable_default_value boolean flag (that would only be true for RID).
Bonus issue
I'm not sure why Variant::get_construct_string doesn't serialize RID 🤔
It is also the case for Callable and Signal.
It means Dictionary/Array containing RID/Callable/Signal are not properly serialized as they will be displayed as [, , ,]
In the case this behavior is expected, shouldn't we add a warning when trying to serialize RID/Callable/Signal ?
Steps to reproduce
n/a
Minimal reproduction project
No response
The text was updated successfully, but these errors were encountered:
Godot version
4.0-rc13
System information
n/a
Issue description
RID as default value are not serialized properly, for instance
PhysicsServer2D::joint_make_pin
This is because
Variant::get_construct_string
is use for the serialization which doesn't support serialization ofRID
:godot/core/extension/extension_api_dump.cpp
Line 528 in 7c7ce7d
Variant::get_construct_string
doesn't support serialization ofRID
and default to an empty string:godot/core/variant/variant_parser.cpp
Lines 1886 to 1887 in 7c7ce7d
The main issue
We represent the default value in ClassDB as an instance of
RID
which doesn't tell us we don't care about this instance (i.e. the default value is in fact "a new instance ofRID
is going to be created each time you call the function")I think the easier solution would be to add a workaround in
extension_api_dump.cpp
(typically adding"RID()"
asdefault_value
if the argument type isRID
and it has a default value set).Of course this is not perfect given this way
extension_api.json
also don't provide the "this default value should be generated before each use". However we can fix this by adding areusable_default_value
boolean flag (that would only be true for RID).Bonus issue
I'm not sure why
Variant::get_construct_string
doesn't serializeRID
🤔It is also the case for
Callable
andSignal
.It means Dictionary/Array containing RID/Callable/Signal are not properly serialized as they will be displayed as
[, , ,]
In the case this behavior is expected, shouldn't we add a warning when trying to serialize RID/Callable/Signal ?
Steps to reproduce
n/a
Minimal reproduction project
No response
The text was updated successfully, but these errors were encountered: