Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

ClassDB

Inherits: Object

A class information repository.

描述

Provides access to metadata stored for every available class.

Methods

bool

can_instantiate ( StringName class ) const

bool

class_exists ( StringName class ) const

PackedStringArray

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

PackedStringArray

class_get_enum_list ( StringName class, bool no_inheritance=false ) const

int

class_get_integer_constant ( StringName class, StringName name ) const

StringName

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

PackedStringArray

class_get_integer_constant_list ( StringName class, bool no_inheritance=false ) const

Dictionary[]

class_get_method_list ( StringName class, bool no_inheritance=false ) const

Variant

class_get_property ( Object object, StringName property ) const

Dictionary[]

class_get_property_list ( StringName class, bool no_inheritance=false ) const

Dictionary

class_get_signal ( StringName class, StringName signal ) const

Dictionary[]

class_get_signal_list ( StringName class, bool no_inheritance=false ) const

bool

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

bool

class_has_integer_constant ( StringName class, StringName name ) const

bool

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

bool

class_has_signal ( StringName class, StringName signal ) const

Error

class_set_property ( Object object, StringName property, Variant value ) const

PackedStringArray

get_class_list ( ) const

PackedStringArray

get_inheriters_from_class ( StringName class ) const

StringName

get_parent_class ( StringName class ) const

Variant

instantiate ( StringName class ) const

bool

is_class_enabled ( StringName class ) const

bool

is_parent_class ( StringName class, StringName inherits ) const


Method Descriptions

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.


PackedStringArray class_get_enum_constants ( StringName class, StringName enum, bool no_inheritance=false ) const

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


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

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


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.


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.


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.


Error class_set_property ( Object object, StringName property, Variant value ) const

Sets property value of object to value.


PackedStringArray get_class_list ( ) const

Returns the names of all the classes available.


PackedStringArray get_inheriters_from_class ( StringName class ) const

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


StringName get_parent_class ( StringName class ) const

Returns the parent class of class.


Variant instantiate ( StringName class ) const

Creates an instance of class.


bool is_class_enabled ( StringName class ) const

Returns whether this class is enabled or not.


bool is_parent_class ( StringName class, StringName inherits ) const

Returns whether inherits is an ancestor of class or not.