summaryrefslogtreecommitdiffstats
path: root/core/object/object.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/object/object.h')
-rw-r--r--core/object/object.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/object/object.h b/core/object/object.h
index c4d287a71c..6f626b0ed0 100644
--- a/core/object/object.h
+++ b/core/object/object.h
@@ -304,8 +304,10 @@ struct MethodInfo {
// API used to extend in GDExtension and other C compatible compiled languages.
class MethodBind;
+class GDExtension;
struct ObjectGDExtension {
+ GDExtension *library = nullptr;
ObjectGDExtension *parent = nullptr;
List<ObjectGDExtension *> children;
StringName parent_class_name;
@@ -798,6 +800,18 @@ public:
return *_class_name_ptr;
}
+ _FORCE_INLINE_ const StringName &get_class_name_for_extension(const GDExtension *p_library) const {
+ // Only return the class name per the extension if it matches the given p_library.
+ if (_extension && _extension->library == p_library) {
+ return _extension->class_name;
+ }
+ // Otherwise, return the name of the built-in class.
+ if (unlikely(!_class_name_ptr)) {
+ return *_get_class_namev();
+ }
+ return *_class_name_ptr;
+ }
+
/* IAPI */
void set(const StringName &p_name, const Variant &p_value, bool *r_valid = nullptr);