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
Godot v4.3.stable - Windows 10.0.19045 - GLES3 (Compatibility) - NVIDIA GeForce RTX 3050 Ti Laptop GPU (NVIDIA; 31.0.15.2799) - AMD Ryzen 5 5600H with Radeon Graphics (12 Threads)
Issue description
According to the docs, the set_axis() function of the SpriteBase3D node expects a "Vector3.Axis" enum. The link to that enum is active in the in-engine docs, but not in the web docs. If you navigate to the Vector3 docs, you'll see that an Axis enum doesn't exist, only three separate constants.
This would be just a documentation issue, but the result is that there is no valid enum that set_axis() would accept, and I believe having to use an int there would be bad practice. Moreover, the editor's behavior here depends on how the Sprite in question is referenced, which is the most confusing part for me:
$Sprite3D.set_axis(Vector3.AXIS_Y) # This works
@onready var sprite : Sprite3D = $Sprite3D # Explicit casting as Sprite3D is what seems to be causing the error
# in any function, i.e. _ready():
sprite.set_axis(Vector3.AXIS_Y) # This triggers warnings
The warnings this latter example triggers are as follows:
W 0:00:04:0562 Integer used when an enum value is expected. If this is intended cast the integer to the enum type.
<GDScript Error>INT_AS_ENUM_WITHOUT_CAST
<GDScript Source>node_3d.gd:7
W 0:00:04:0563 Cannot pass 1 as Enum "Axis": no enum member has matching value.
<GDScript Error>INT_AS_ENUM_WITHOUT_MATCH
<GDScript Source>node_3d.gd:7
I believe that at the very least the Sprite3D docs should be modified to reflect the intended use, but ideally set_axis() should accept existing enums (whether it means reimplementing Vector3.Axis or making it understand the AXIS constants) without warnings.
Steps to reproduce
See the MRP. To reproduce it yourself:
Set up a 3D scene.
Create a Sprite3D and cast it as Sprite3D in the script.
Address the resulting variable in the script with set_axis(). The prompt will suggest using the Vector3.Axis enum. Type "Vector3" and choose any AXIS const (AXIS_X, AXIS_Y, AXIS_Z) from the prompt.
I looked at other implementations for other classes like Vector4 and Vector2. None of them had that issue, instead they treated Vector2.Axis params and return types as an int. At least for binded methods. So I'll change any binded method that uses Vector3.Axis as param/return type to int. This will most definitely break compat, but I'll have a shot at it.
Maybe later someone can follow this PR with a PR that changes all VectorX.Axis param types to int for consistency.
Tested versions
Reproducible in: Godot 4.3
System information
Godot v4.3.stable - Windows 10.0.19045 - GLES3 (Compatibility) - NVIDIA GeForce RTX 3050 Ti Laptop GPU (NVIDIA; 31.0.15.2799) - AMD Ryzen 5 5600H with Radeon Graphics (12 Threads)
Issue description
According to the docs, the set_axis() function of the SpriteBase3D node expects a "Vector3.Axis" enum. The link to that enum is active in the in-engine docs, but not in the web docs. If you navigate to the Vector3 docs, you'll see that an Axis enum doesn't exist, only three separate constants.
This would be just a documentation issue, but the result is that there is no valid enum that set_axis() would accept, and I believe having to use an int there would be bad practice. Moreover, the editor's behavior here depends on how the Sprite in question is referenced, which is the most confusing part for me:
$Sprite3D.set_axis(Vector3.AXIS_Y) # This works
The warnings this latter example triggers are as follows:
I believe that at the very least the Sprite3D docs should be modified to reflect the intended use, but ideally set_axis() should accept existing enums (whether it means reimplementing Vector3.Axis or making it understand the AXIS constants) without warnings.
Steps to reproduce
See the MRP. To reproduce it yourself:
Minimal reproduction project (MRP)
axis-test.zip
The text was updated successfully, but these errors were encountered: