Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Expose `ClassDB::is_class_exposed`

HolonProduction7d02cb5625d2
diff --git a/core/core_bind.cpp b/core/core_bind.cpp
index e0584bc8696..40820daaf3c 100644
--- a/core/core_bind.cpp
+++ b/core/core_bind.cpp
@@ -1818,6 +1818,10 @@ bool ClassDB::is_class_enabled(const StringName &p_class) const {
return ::ClassDB::is_class_enabled(p_class);
}
+bool ClassDB::is_class_exposed(const StringName &p_class) const {
+ return ::ClassDB::is_class_exposed(p_class);
+}
+
#ifdef TOOLS_ENABLED
void ClassDB::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
const String pf = p_function;
@@ -1830,7 +1834,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_enum_bitfield" || pf == "class_get_api_type");
+ pf == "is_class_enabled" || pf == "is_class_exposed" || pf == "is_class_enum_bitfield" || pf == "class_get_api_type");
}
if (first_argument_is_class || pf == "is_parent_class") {
LocalVector<StringName> classes;
@@ -1890,6 +1894,7 @@ void ClassDB::_bind_methods() {
::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);
+ ::ClassDB::bind_method(D_METHOD("is_class_exposed", "class"), &ClassDB::is_class_exposed);
BIND_ENUM_CONSTANT(API_CORE);
BIND_ENUM_CONSTANT(API_EDITOR);
diff --git a/core/core_bind.h b/core/core_bind.h
index 3855a600e17..ded6337d1da 100644
--- a/core/core_bind.h
+++ b/core/core_bind.h
@@ -561,6 +561,7 @@ public:
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;
+ bool is_class_exposed(const StringName &p_class) const;
#ifdef TOOLS_ENABLED
virtual void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const override;
diff --git a/doc/classes/ClassDB.xml b/doc/classes/ClassDB.xml
index aa0f776fe49..97687ad6bed 100644
--- a/doc/classes/ClassDB.xml
+++ b/doc/classes/ClassDB.xml
@@ -242,6 +242,14 @@
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.
</description>
</method>
+ <method name="is_class_exposed" qualifiers="const">
+ <return type="bool" />
+ <param index="0" name="class" type="StringName" />
+ <description>
+ Returns whether this [param class] is exposed or not.
+ Godot uses internal and platform specific classes at run time. [ClassDB] is able to work with those and lists them like any other class. This method can be used to filter them out if your use-case requires it.
+ </description>
+ </method>
<method name="is_parent_class" qualifiers="const">
<return type="bool" />
<param index="0" name="class" type="StringName" />