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
{{ message }}
Repository navigation
Using TypedArray with an enum causes 'get_class_static' is not a member of ... #1584
I might be missing something but I don't seem to be able to use MAKE_TYPED_ARRAY_INFO. I tried to add it to the end of my Direction.hpp file after VARIANT_ENUM_CAST and also tried to add #include <godot_cpp/core/type_info.hpp> but it doesn't seem to be recognized.
I also tried to add what would be result of the macro directly in the Direction.hpp file but I still get the same error 'get_class_static' is not a member of 'Game::Direction'
It looks like it compiles to something that shows up in Godot as Array[int] if I include both the MAKE_TYPED_ARRAY_INFO and MAKE_TYPED_ARRAY macros.
Edit: if I replace the Variant::get_type_name expression with enum_qualified_name_to_class_info_name("Game::Direction"), it shows the correct name in the documentation but links to the nonexistent class Game.Direction rather than the enum within the Game class.
@BenLubar Thanks, using both MAKE_TYPED_ARRAY_INFO and MAKE_TYPED_ARRAY works! Although like I mentioned for some reason I had to expand the macros instead of just doing this:
As for showing up in Godot as Array[int] I don't know if there is anything that can be done but at using ADD_PROPERTY like this works to have a dropdown.
Ok for anyone stumbling here in the future and wondering why they can't use MAKE_TYPED_ARRAY and MAKE_TYPED_ARRAY_INFO I found the answer. I don't know why I didn't notice sooner but they get undefined with #undef at the end of their respective .hpp files.
So unless someone has a better solution (which may well exist since I am quite new in C++ and gdextension in general) I ended up just copying the expanded macros like this:
Activity
aaronfranke commentedon Sep 18, 2024
Does it work if you use
MAKE_TYPED_ARRAY_INFO(Game::Direction, Variant::INT)?ZacharieBeauchemin commentedon Sep 18, 2024
I might be missing something but I don't seem to be able to use MAKE_TYPED_ARRAY_INFO. I tried to add it to the end of my Direction.hpp file after
VARIANT_ENUM_CASTand also tried to add#include <godot_cpp/core/type_info.hpp>but it doesn't seem to be recognized.I also tried to add what would be result of the macro directly in the Direction.hpp file but I still get the same error
'get_class_static' is not a member of 'Game::Direction'BenLubar commentedon Oct 4, 2024
It looks like it compiles to something that shows up in Godot as
Array[int]if I include both theMAKE_TYPED_ARRAY_INFOandMAKE_TYPED_ARRAYmacros.Edit: if I replace the
Variant::get_type_nameexpression withenum_qualified_name_to_class_info_name("Game::Direction"), it shows the correct name in the documentation but links to the nonexistent classGame.Directionrather than the enum within theGameclass.ZacharieBeauchemin commentedon Oct 4, 2024
@BenLubar Thanks, using both
MAKE_TYPED_ARRAY_INFOandMAKE_TYPED_ARRAYworks! Although like I mentioned for some reason I had to expand the macros instead of just doing this:As for showing up in Godot as
Array[int]I don't know if there is anything that can be done but at usingADD_PROPERTYlike this works to have a dropdown.dsnopek commentedon Oct 5, 2024
@ZacharieBeauchemin That seems about right to me!
ZacharieBeauchemin commentedon Oct 5, 2024
Ok for anyone stumbling here in the future and wondering why they can't use
MAKE_TYPED_ARRAYandMAKE_TYPED_ARRAY_INFOI found the answer. I don't know why I didn't notice sooner but they get undefined with#undefat the end of their respective.hppfiles.So unless someone has a better solution (which may well exist since I am quite new in C++ and gdextension in general) I ended up just copying the expanded macros like this:
Having to do this seems a bit weird to me but at least it works.