ClassDB
继承: Object
A class information repository.
描述
Provides access to metadata stored for every available class.
方法
枚举
enum APIType:
APIType API_CORE = 0
Native Core class type.
APIType API_EDITOR = 1
Native Editor class type.
APIType API_EXTENSION = 2
GDExtension class type.
APIType API_EDITOR_EXTENSION = 3
GDExtension Editor class type.
APIType API_NONE = 4
Unknown class type.
方法说明
bool can_instantiate ( class: StringName ) const1
Returns true if objects can be instantiated from the specified class, otherwise returns false.
Variant class_call_static ( class: StringName, method: StringName, ... ) vararg2
Calls a static method on a class.
bool class_exists ( class: StringName ) const1
Returns whether the specified class is available or not.
APIType class_get_api_type ( class: StringName ) const1
Returns the API type of class. See APIType.
PackedStringArray class_get_enum_constants ( class: StringName, enum: StringName, no_inheritance: bool = false ) const1
Returns an array with all the keys in enum of class or its ancestry.
PackedStringArray class_get_enum_list ( class: StringName, no_inheritance: bool = false ) const1
Returns an array with all the enums of class or its ancestry.
int class_get_integer_constant ( class: StringName, name: StringName ) const1
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 ( class: StringName, name: StringName, no_inheritance: bool = false ) const1
Returns which enum the integer constant name of class or its ancestry belongs to.
PackedStringArray class_get_integer_constant_list ( class: StringName, no_inheritance: bool = false ) const1
Returns an array with the names all the integer constants of class or its ancestry.
int class_get_method_argument_count ( class: StringName, method: StringName, no_inheritance: bool = false ) const1
Returns the number of arguments of the method method of class or its ancestry if no_inheritance is false.
Array Dictionary class_get_method_list ( class: StringName, no_inheritance: bool = false ) const1
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, property: StringName ) const1
Returns the value of property of object or its ancestry.
Variant class_get_property_default_value ( class: StringName, property: StringName ) const1
Returns the default value of property of class or its ancestor classes.
StringName class_get_property_getter ( class: StringName, property: StringName )
Returns the getter method name of property of class.
Array Dictionary class_get_property_list ( class: StringName, no_inheritance: bool = false ) const1
Returns an array with all the properties of class or its ancestry if no_inheritance is false.
StringName class_get_property_setter ( class: StringName, property: StringName )
Returns the setter method name of property of class.
Dictionary class_get_signal ( class: StringName, signal: StringName ) const1
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).
Array Dictionary class_get_signal_list ( class: StringName, no_inheritance: bool = false ) const1
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 ( class: StringName, name: StringName, no_inheritance: bool = false ) const1
Returns whether class or its ancestry has an enum called name or not.
bool class_has_integer_constant ( class: StringName, name: StringName ) const1
Returns whether class or its ancestry has an integer constant called name or not.
bool class_has_method ( class: StringName, method: StringName, no_inheritance: bool = false ) const1
Returns whether class (or its ancestry if no_inheritance is false) has a method called method or not.
bool class_has_signal ( class: StringName, signal: StringName ) const1
Returns whether class or its ancestry has a signal called signal or not.
Error class_set_property ( object: Object, property: StringName, value: Variant ) const1
Sets property value of object to value.
PackedStringArray get_class_list ( ) const1
Returns the names of all the classes available.
PackedStringArray get_inheriters_from_class ( class: StringName ) const1
Returns the names of all the classes that directly or indirectly inherit from class.
StringName get_parent_class ( class: StringName ) const1
Returns the parent class of class.
Variant instantiate ( class: StringName ) const1
Creates an instance of class.
bool is_class_enabled ( class: StringName ) const1
Returns whether this class is enabled or not.
bool is_class_enum_bitfield ( class: StringName, enum: StringName, no_inheritance: bool = false ) const1
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 ( class: StringName, inherits: StringName ) const1
Returns whether inherits is an ancestor of class or not.
本方法通常需要用户覆盖才能生效。
本方法无副作用,不会修改该实例的任何成员变量。
本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。
本方法用于构造某个类型。
调用本方法无需实例,可直接使用类名进行调用。
本方法描述的是使用本类型作为左操作数的有效运算符。
这个值是由下列位标志构成位掩码的整数。
无返回值。