-
-
Notifications
You must be signed in to change notification settings - Fork 712
Open
Description
I have the following code.
namespace godot {
class Vertex : public Reference {
GODOT_CLASS(Vertex, Reference);
public:
void _init() {}
static void _register_methods() {}
Vertex() { Godot::print("Construct"); }
~Vertex() { Godot::print("Destruct"); }
};
class ListDigraph : public Reference {
GODOT_CLASS(ListDigraph, Reference);
public:
template<class T>
Ref<T> __add_vertex() {
return Ref<T>::__internal_constructor(T::_new());
}
virtual Ref<Vertex> add_vertex() { return __add_vertex<Vertex>(); }
void _init() {}
static void _register_methods() {}
ListDigraph() {}
~ListDigraph() {}
};
/////////////////////////////////////////////////////////////////////////
class PropertyVertex : public Vertex {
GODOT_SUBCLASS(PropertyVertex, Vertex);
public:
void _init() {}
static void _register_methods() {}
PropertyVertex() {}
~PropertyVertex() {}
};
class PropertyGraph : public ListDigraph {
GODOT_SUBCLASS(PropertyGraph, ListDigraph);
public:
Ref<Vertex> add_vertex() override { return __add_vertex<PropertyVertex>(); }
void _init() {}
static void _register_methods() {}
PropertyGraph() {}
~PropertyGraph() {}
};
}Code compiles OK the problem is in the GDScript API:
var g = ListDigraph.new()
print(g.add_vertex())
# Oututs
#Construct
#[Reference:1137]
#Destruct
var p = PropertyGraph.new()
print(p.add_vertex())
# Oututs
#[Reference:1140]even though "PropertyVertex" is a "Vertex" its construct and destruct code are not printed.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels