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
Any script class created with class_name which extends an abstract class, does not show up on the "Create New Node" dialog, despite extending from abstract class working fine otherwise. (Also might be the same for virtual classes: #58972 because #67614)
In any case, making the script class visible in the dialog is probably preferrable if possible.
Also there are several proposals about allowing to show/hide script classes from the dialog (and not just automatically add them there), here is one: godotengine/godot-proposals#4493
Related (Seems to be about custom nodes added via EditorPlugins): #63536
Steps to reproduce
Create 2 classes, one extending from abstract class, other from normal class. For example using PhysicsBody3D/StaticBody3D:
Oops, the example code was incorrect, but the MRP (thus the screenshot) had the correct classes.
Also, after digging into, according to #70700, you cannot call new() on script class extending from abstract class:
classMyCanvasItemextendsCanvasItem: pass# now okfunc_ready() ->void:
CanvasItem.new() # now warned as bad, before wasn'tMyCanvasItem.new() # warned, not allowedvarcontrol:=Control.new()
control.set_script(MyCanvasItem) # ok
Which might be the reason that the node is not visible in the create new node dialog, as I am assuming instantiates the node using new(), thus it cannot be instantiated. The script can be assigned to a node just fine though.
However, it seems that VIRTUAL classes (#58972) can be extended and instantiated, such as basebutton:
On these grounds, I say this is not an bug on the current implementation, and this issue should be a proposal. (Such as possible to extend abstract classes as non-abstract, or otherwise make changes to the way abstract classes are handled when extending, as it currently is possible to extend from abstract class.)
The actual use case I had was to have a base script extending from PhysicalBody3D, that script is then extended for Static/RigidBody3D etc. node specific behaviour (A script which extends from PhysicalBody3D can be assigned to all of the other nodes inheriting from it).
Tested versions
v4.2.1.stable.arch_linux
System information
Godot v4.2.1.stable unknown - Arch Linux #1 SMP PREEMPT_DYNAMIC Thu, 28 Mar 2024 17:06:35 +0000 - X11 - Vulkan (Forward+) - dedicated AMD Radeon RX 5700 XT (RADV NAVI10) () - AMD Ryzen 9 5950X 16-Core Processor (32 Threads)
Issue description
Any script class created with
class_name
which extends an abstract class, does not show up on the "Create New Node" dialog, despite extending from abstract class working fine otherwise. (Also might be the same for virtual classes: #58972 because #67614)In any case, making the script class visible in the dialog is probably preferrable if possible.
Also there are several proposals about allowing to show/hide script classes from the dialog (and not just automatically add them there), here is one: godotengine/godot-proposals#4493
Related (Seems to be about custom nodes added via EditorPlugins): #63536
Steps to reproduce
Create 2 classes, one extending from abstract class, other from normal class. For example using
PhysicsBody3D/StaticBody3D
:Results in only the
Test
class being visible (and able to be created) in the "Create New Node" dialog.Minimal reproduction project (MRP)
mrp-class_name_create_new_node.tar.gz
The text was updated successfully, but these errors were encountered: