godot-cpp icon indicating copy to clipboard operation
godot-cpp copied to clipboard

[GDExtension] Can't extend gd extension class

Open BastiaanOlij opened this issue 4 years ago • 3 comments

This wasn't possible before in GD native but I was under the impression that GD extensions would allow this, it's been a long requested feature to extend these classes with GDScript

image

BastiaanOlij avatar Sep 21 '21 01:09 BastiaanOlij

Wouldn't the node that this script is attached to have to be of the Example type? It looks like you're attaching it to a control. I might be misunderstanding though.

ellenhp avatar Sep 21 '21 04:09 ellenhp

@ellenhp I'm attaching it to the Example node: image

I have a feeling this may be caused by the issue Fales mentioned around the class not being recognised correctly. I also have a feeling this may be the exact same reason why the properties don't show in the inspector because the inspector also thinks this is Control (which is the superclass of Example).

BastiaanOlij avatar Sep 21 '21 09:09 BastiaanOlij

Ok after more investigation it looks like @ellenhp was on the right track afterall.

The moment I assign my script to this node, behind the scenes, it changes my node back to being of type Control:

[node name="Example" type="Control" parent="."]
script = ExtResource( "2_6hifa" )
__meta__ = {
"_edit_use_anchors_": false
}

And it's pretty consistent in changing it every time I try to change it back...

BastiaanOlij avatar Sep 21 '21 12:09 BastiaanOlij

This issue is out-dated. It is currently possible to attach a script to a node defined in GDExtension. There is some weirdness around virtual methods, but there's dedicated issues for that, for example: https://github.com/godotengine/godot-cpp/issues/1199 and https://github.com/godotengine/godot-cpp/issues/1022

dsnopek avatar Jan 06 '24 17:01 dsnopek