Index · Object → ClassDB

ClassDB

A class information repository.

Class 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

func can_instantiate(class: StringName) -> bool

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

func class_call_static(class: StringName, method: StringName) -> Variant

Calls a static method on a class.

func class_exists(class: StringName) -> bool

Returns whether the specified class is available or not.

func class_get_api_type(class: StringName) -> ClassDB.APIType

Returns the API type of the specified class.

func class_get_enum_constants(class: StringName, enum: StringName, no_inheritance: bool = false) -> PackedStringArray

Returns an array with all the keys in enum of class or its ancestry.

func class_get_enum_list(class: StringName, no_inheritance: bool = false) -> PackedStringArray

Returns an array with all the enums of class or its ancestry.

func class_get_integer_constant(class: StringName, name: StringName) -> int

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

func class_get_integer_constant_enum(class: StringName, name: StringName, no_inheritance: bool = false) -> StringName

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

func class_get_integer_constant_list(class: StringName, no_inheritance: bool = false) -> PackedStringArray

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

func class_get_method_argument_count(class: StringName, method: StringName, no_inheritance: bool = false) -> int

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

func class_get_method_list(class: StringName, no_inheritance: bool = false) -> Dictionary[]

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.

func class_get_property(object: Object, property: StringName) -> Variant

Returns the value of property of object or its ancestry.

func class_get_property_default_value(class: StringName, property: StringName) -> Variant

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

func class_get_property_getter(class: StringName, property: StringName) -> StringName

Returns the getter method name of property of class.

func class_get_property_list(class: StringName, no_inheritance: bool = false) -> Dictionary[]

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

func class_get_property_setter(class: StringName, property: StringName) -> StringName

Returns the setter method name of property of class.

func class_get_signal(class: StringName, signal: StringName) -> Dictionary

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).

func class_get_signal_list(class: StringName, no_inheritance: bool = false) -> Dictionary[]

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().

func class_has_enum(class: StringName, name: StringName, no_inheritance: bool = false) -> bool

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

func class_has_integer_constant(class: StringName, name: StringName) -> bool

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

func class_has_method(class: StringName, method: StringName, no_inheritance: bool = false) -> bool

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

func class_has_signal(class: StringName, signal: StringName) -> bool

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

func class_set_property(object: Object, property: StringName, value: Variant) -> Error

Sets property value of object to value.

func get_class_list() -> PackedStringArray

Returns the names of all engine classes available.

Note: Script-defined classes with class_name are not included in this list. Use ProjectSettings.get_global_class_list() to get a list of script-defined classes instead.

func get_inheriters_from_class(class: StringName) -> PackedStringArray

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

func get_parent_class(class: StringName) -> StringName

Returns the parent class of class.

func instantiate(class: StringName) -> Variant

Creates an instance of class.

func is_class_enabled(class: StringName) -> bool

Returns whether this class is enabled or not.

func is_class_enum_bitfield(class: StringName, enum: StringName, no_inheritance: bool = false) -> bool

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

func is_parent_class(class: StringName, inherits: StringName) -> bool

Returns whether inherits is an ancestor of class or not.

Inherited from Object (62)
func _get(property: StringName) -> Variant
func _get_property_list() -> Dictionary[]
func _init() -> void
func _iter_get(iter: Variant) -> Variant
func _iter_init(iter: Array) -> bool
func _iter_next(iter: Array) -> bool
func _notification(what: int) -> void
func _set(property: StringName, value: Variant) -> bool
func _to_string() -> String
func _validate_property(property: Dictionary) -> void
func add_user_signal(signal: String, arguments: Array = []) -> void
func call(method: StringName) -> Variant
func callv(method: StringName, arg_array: Array) -> Variant
func cancel_free() -> void
func connect(signal: StringName, callable: Callable, flags: int = 0) -> Error
func disconnect(signal: StringName, callable: Callable) -> void
func emit_signal(signal: StringName) -> Error
func free() -> void
func get(property: StringName) -> Variant
func get_class() -> String
func get_incoming_connections() -> Dictionary[]
func get_indexed(property_path: NodePath) -> Variant
func get_meta(name: StringName, default: Variant = null) -> Variant
func get_meta_list() -> StringName[]
func get_method_list() -> Dictionary[]
func get_property_list() -> Dictionary[]
func get_signal_connection_list(signal: StringName) -> Dictionary[]
func get_signal_list() -> Dictionary[]
func has_meta(name: StringName) -> bool
func has_method(method: StringName) -> bool
func has_signal(signal: StringName) -> bool
func is_class(class: StringName) -> bool
func is_connected(signal: StringName, callable: Callable) -> bool
func notification(what: int, reversed: bool = false) -> void
func remove_meta(name: StringName) -> void
func remove_user_signal(signal: StringName) -> void
func set(property: StringName, value: Variant) -> void
func set_block_signals(enable: bool) -> void
func set_deferred(property: StringName, value: Variant) -> void
func set_indexed(property_path: NodePath, value: Variant) -> void
func set_message_translation(enable: bool) -> void
func set_meta(name: StringName, value: Variant) -> void
func set_script(script: Variant) -> void
func set_translation_domain(domain: StringName) -> void
func to_string() -> String
func tr(message: StringName, context: StringName = &"") -> String
func tr_n(message: StringName, plural_message: StringName, n: int, context: StringName = &"") -> String

Signals

Inherited from Object (2)

Enums & Constants

enum APIType
API_CORE = 0

Native Core class type.

API_EDITOR = 1

Native Editor class type.

API_EXTENSION = 2

GDExtension class type.

API_EDITOR_EXTENSION = 3

GDExtension Editor class type.

API_NONE = 4

Unknown class type.