Class reference

ClassDB

Inherits Object

A class information repository.

Description

Provides access to metadata stored for every available engine class. Note: Script-defined classes with class_name are not part of ClassDB, so they will not return reflection data such as a method or property list. However, GDExtension-defined classes are part of ClassDB, so they will return reflection data.

Methods

bool can_instantiate(StringName class) const

Returns true if objects can be instantiated from the specified class, otherwise returns false.

bool class_exists(StringName class) const

Returns whether the specified class is available or not.

int class_get_api_type(StringName class) const

Returns the API type of the specified class.

int class_get_integer_constant(StringName class, StringName name) const

Returns the value of the integer constant name of class or its ancestry. Always returns 0 when the constant could not be found.

StringName class_get_integer_constant_enum(StringName class, StringName name, bool no_inheritance = false) const

Returns which enum the integer constant name of class or its ancestry belongs to.

PackedStringArray class_get_integer_constant_list(StringName class, bool no_inheritance = false) const

Returns an array with the names all the integer constants of class or its ancestry.

int class_get_method_argument_count(StringName class, StringName method, bool no_inheritance = false) const

Returns the number of arguments of the method method of class or its ancestry if no_inheritance is false.

Dictionary[] class_get_method_list(StringName class, bool no_inheritance = false) const

Returns an array with all the methods of class or its ancestry if no_inheritance is false. Every element of the array is a Dictionary with the following keys: args, default_args, flags, id, name, return: (class_name, hint, hint_string, name, type, usage). Note: In exported release builds the debug info is not available, so the returned dictionaries will contain only method names.

Variant class_get_property(Object object, StringName property) const

Returns the value of property of object or its ancestry.

Variant class_get_property_default_value(StringName class, StringName property) const

Returns the default value of property of class or its ancestor classes.

Dictionary[] class_get_property_list(StringName class, bool no_inheritance = false) const

Returns an array with all the properties of class or its ancestry if no_inheritance is false.

Dictionary class_get_signal(StringName class, StringName signal) const

Returns the signal data of class or its ancestry. The returned value is a Dictionary with the following keys: args, default_args, flags, id, name, return: (class_name, hint, hint_string, name, type, usage).

Dictionary[] class_get_signal_list(StringName class, bool no_inheritance = false) const

Returns an array with all the signals of class or its ancestry if no_inheritance is false. Every element of the array is a Dictionary as described in class_get_signal().

bool class_has_enum(StringName class, StringName name, bool no_inheritance = false) const

Returns whether class or its ancestry has an enum called name or not.

bool class_has_integer_constant(StringName class, StringName name) const

Returns whether class or its ancestry has an integer constant called name or not.

bool class_has_method(StringName class, StringName method, bool no_inheritance = false) const

Returns whether class (or its ancestry if no_inheritance is false) has a method called method or not.

bool class_has_signal(StringName class, StringName signal) const

Returns whether class or its ancestry has a signal called signal or not.

int class_override_api_type(StringName class, int api) const

Overrides the API type of class to api. See ClassDB.APIType. Note: This should only be used with a thorough understanding of its implications.

PackedStringArray get_inheriters_from_class(StringName class) const

Returns the names of all engine classes that directly or indirectly inherit from class.

bool is_class_enabled(StringName class) const

Returns whether this class is enabled or not.

bool is_class_enum_bitfield(StringName class, StringName enum, bool no_inheritance = false) const

Returns whether class (or its ancestor classes if no_inheritance is false) has an enum called enum that is a bitfield.

bool is_parent_class(StringName class, StringName inherits) const

Returns whether inherits is an ancestor of class or not.

void set_current_api(int api) const

Sets the globally active API type to api. See ClassDB.APIType. Note: This should only be used with a thorough understanding of its implications.

Constants

API_CORE = 0

Enum: APIType

Native Core class type.

API_EDITOR = 1

Enum: APIType

Native Editor class type.

API_EXTENSION = 2

Enum: APIType

GDExtension class type.

API_EDITOR_EXTENSION = 3

Enum: APIType

GDExtension Editor class type.

API_NONE = 4

Enum: APIType

Unknown class type.

Source revision 5592dc3a7a61
Connection interrupted. Reload×

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.