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
Built-in types are returned by value in GDScript, meaning that any modification of these (unless they are ref-counted like Array and Dictionary) by functions is ignored except when accessed as a variable itself, this seems to be reflected in how (mostly) GDScript does not expose such functions even when they exist in the class (like rotate on Transform2D/3D), however there are three exceptions to this: set_rotationset_scaleset_skew on Transform2D
These can cause confusion (I for one was confused) as it is not obvious that functions called on a Transform2D cannot modify it when accessed in an array or dictionary or when from a Node2D etc., and to me it looks that these cases were overlooked
I would suggest simply removing these functions from GDScript, alternatively replacing them with non-modifying functions with_rotationwith_scalewith_skew if the functionality is considered important enough to keep
The set_rotation function was added in #47872 and I'm not sure why as it's never called by name there, and the rest were exposed by #52398 reasoning that the rotation one was already exposed
And to me it looks like set_rotation was only exposed there because it was used in the test project, I don't know about other areas where exposing it is justified
Godot version
4.0.dev
System information
Windows 10
Issue description
Built-in types are returned by value in GDScript, meaning that any modification of these (unless they are ref-counted like Array and Dictionary) by functions is ignored except when accessed as a variable itself, this seems to be reflected in how (mostly) GDScript does not expose such functions even when they exist in the class (like
rotate
on Transform2D/3D), however there are three exceptions to this:set_rotation
set_scale
set_skew
on Transform2DThese can cause confusion (I for one was confused) as it is not obvious that functions called on a Transform2D cannot modify it when accessed in an array or dictionary or when from a Node2D etc., and to me it looks that these cases were overlooked
I would suggest simply removing these functions from GDScript, alternatively replacing them with non-modifying functions
with_rotation
with_scale
with_skew
if the functionality is considered important enough to keepSteps to reproduce
To illustrate this:
And note how the transform in the array is unaffected
Minimal reproduction project
No response
The text was updated successfully, but these errors were encountered: