-
-
Notifications
You must be signed in to change notification settings - Fork 101
Description
Describe the project you are working on
A highly performance required game, with a c++ template class:
template <typename T, typename measure_t = std::size_t>
class grid;Describe the problem or limitation you are having in your project
I had searching through the source code godot, expecting to found export method for godot::Array class, but all in vain.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
I hope godot can provide a way to export template class in c++, and detailed description.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
It supposed to be used as:
template <typename T, typename measure_t = std::size_t>
class grid;
ClassDB::register_class<grid>(); // overload the origin function
ClassDB::register_template_class<grid>(); // or define another function
ClassDB::register_class<grid<int>>(); // or at least can register a specialization of the template classor using variant:
class Grid : godot::RefCounted, grid<godot::Variant> // may hold a grid object instead of inherit to grid
{
// maybe GDCLASS or some bind_methods stuff
}
ClassDB::register_template_class<Grid>();# in GDScript
var my_grid: Grid[int]so two possible implementation, one is to register the type without giving template arguments (I'm doubting myself when I worte this), and the other is to export a derived class which inherits to godot::RefCounted and grid<godot::Variant> (which means it's a godot class), and do some trick in gdscript to make it usage just like it is a template class.
If this enhancement will not be used often, can it be worked around with a few lines of script?
no, it is about gdscript's language binding, which I supposed to be a complicated stuff.
Is there a reason why this should be core and not an add-on in the asset library?
It's about the engine itself, it's highly integrated within the engine, it's part of the engine.