Make global scope enums accessible as types in GDScript

Add functions to CoreConstant so enums can be properly deduced. Also add
the enums in release builds to make consistent with ClassDB enums and
avoid differences in script compilation between debug and release.
This commit is contained in:
George Marques
2023-02-19 12:57:09 -03:00
parent 28db611f0f
commit 75f16b8167
21 changed files with 355 additions and 87 deletions

View File

@ -32,6 +32,7 @@
#define CORE_CONSTANTS_H
#include "core/string/string_name.h"
#include "core/templates/hash_set.h"
class CoreConstants {
public:
@ -41,6 +42,10 @@ public:
static bool get_ignore_value_in_docs(int p_idx);
static const char *get_global_constant_name(int p_idx);
static int64_t get_global_constant_value(int p_idx);
static bool is_global_constant(const StringName &p_name);
static int get_global_constant_index(const StringName &p_name);
static bool is_global_enum(const StringName &p_enum);
static void get_enum_values(StringName p_enum, HashMap<StringName, int64_t> *p_values);
};
#endif // CORE_CONSTANTS_H