From c936ee54eed8a31da042429548c2ee7e0594c60c Mon Sep 17 00:00:00 2001 From: Chris Cranford Date: Sun, 7 Apr 2024 19:21:19 -0400 Subject: [PATCH] Expose `ClassDB::is_enum_bitfield` as `ClassDB::is_class_enum_bitfield` --- core/core_bind.cpp | 8 +++++++- core/core_bind.h | 2 ++ doc/classes/ClassDB.xml | 9 +++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/core/core_bind.cpp b/core/core_bind.cpp index 8c850307831..b7d78488d16 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -1528,6 +1528,10 @@ StringName ClassDB::class_get_integer_constant_enum(const StringName &p_class, c return ::ClassDB::get_integer_constant_enum(p_class, p_name, p_no_inheritance); } +bool ClassDB::is_class_enum_bitfield(const StringName &p_class, const StringName &p_enum, bool p_no_inheritance) const { + return ::ClassDB::is_enum_bitfield(p_class, p_enum, p_no_inheritance); +} + bool ClassDB::is_class_enabled(const StringName &p_class) const { return ::ClassDB::is_class_enabled(p_class); } @@ -1544,7 +1548,7 @@ void ClassDB::get_argument_options(const StringName &p_function, int p_idx, List pf == "class_has_method" || pf == "class_get_method_list" || pf == "class_get_integer_constant_list" || pf == "class_has_integer_constant" || pf == "class_get_integer_constant" || pf == "class_has_enum" || pf == "class_get_enum_list" || pf == "class_get_enum_constants" || pf == "class_get_integer_constant_enum" || - pf == "is_class_enabled"); + pf == "is_class_enabled" || pf == "is_class_enum_bitfield"); } if (first_argument_is_class || pf == "is_parent_class") { for (const String &E : get_class_list()) { @@ -1589,6 +1593,8 @@ void ClassDB::_bind_methods() { ::ClassDB::bind_method(D_METHOD("class_get_enum_constants", "class", "enum", "no_inheritance"), &ClassDB::class_get_enum_constants, DEFVAL(false)); ::ClassDB::bind_method(D_METHOD("class_get_integer_constant_enum", "class", "name", "no_inheritance"), &ClassDB::class_get_integer_constant_enum, DEFVAL(false)); + ::ClassDB::bind_method(D_METHOD("is_class_enum_bitfield", "class", "enum", "no_inheritance"), &ClassDB::is_class_enum_bitfield, DEFVAL(false)); + ::ClassDB::bind_method(D_METHOD("is_class_enabled", "class"), &ClassDB::is_class_enabled); } diff --git a/core/core_bind.h b/core/core_bind.h index d46321cf5c2..1940a1c5e6c 100644 --- a/core/core_bind.h +++ b/core/core_bind.h @@ -461,6 +461,8 @@ public: PackedStringArray class_get_enum_constants(const StringName &p_class, const StringName &p_enum, bool p_no_inheritance = false) const; StringName class_get_integer_constant_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance = false) const; + bool is_class_enum_bitfield(const StringName &p_class, const StringName &p_enum, bool p_no_inheritance = false) const; + bool is_class_enabled(const StringName &p_class) const; #ifdef TOOLS_ENABLED diff --git a/doc/classes/ClassDB.xml b/doc/classes/ClassDB.xml index 3f714060919..bdb0ec9bc69 100644 --- a/doc/classes/ClassDB.xml +++ b/doc/classes/ClassDB.xml @@ -192,6 +192,15 @@ Returns whether this [param class] is enabled or not. + + + + + + + Returns whether [param class] (or its ancestor classes if [param no_inheritance] is [code]false[/code]) has an enum called [param enum] that is a bitfield. + +