Skip to content

Commit

Permalink
Fix enum binding
Browse files Browse the repository at this point in the history
  • Loading branch information
Zylann committed Jun 9, 2024
1 parent fd340cf commit 6ebf995
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion terrain/instancing/voxel_instancer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ void VoxelInstancer::set_up_mode(UpMode mode) {
}
}

UpMode VoxelInstancer::get_up_mode() const {
VoxelInstancer::UpMode VoxelInstancer::get_up_mode() const {
return _up_mode;
}

Expand Down
8 changes: 7 additions & 1 deletion terrain/instancing/voxel_instancer.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ class VoxelInstancer : public Node3D, public IInstanceLibraryItemListener {
public:
static const int MAX_LOD = 8;

// I didn't want this enum to be here on the C++ side, because it prevents forward-declaring the class it is in.
// However Godot is forcing me to.
// `VARIANT_ENUM_CAST(ns1::ns2::Enum)` assumes the enum is in a class, so it generates its name as being `ns2.Enum`,
// which confuses docs and GDExtension dumps. There doesn't seem to be a way to register that enum as global either.
using UpMode = zylann::voxel::UpMode;

VoxelInstancer();
~VoxelInstancer();

Expand Down Expand Up @@ -323,7 +329,7 @@ class VoxelInstancer : public Node3D, public IInstanceLibraryItemListener {
} // namespace voxel
} // namespace zylann

VARIANT_ENUM_CAST(zylann::voxel::UpMode);
VARIANT_ENUM_CAST(zylann::voxel::VoxelInstancer::UpMode);
VARIANT_ENUM_CAST(zylann::voxel::VoxelInstancer::DebugDrawFlag);

#endif // VOXEL_INSTANCER_H

0 comments on commit 6ebf995

Please sign in to comment.