ClassDB

package
v0.0.0-...-ae8aae0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package ClassDB provides methods for working with ClassDB object instances.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Advanced

func Advanced() class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

func CanInstantiate

func CanInstantiate(class_ string) bool

Returns [code]true[/code] if objects can be instantiated from the specified [param class], otherwise returns [code]false[/code].

func ClassExists

func ClassExists(class_ string) bool

Returns whether the specified [param class] is available or not.

func ClassGetEnumConstants

func ClassGetEnumConstants(class_ string, enum string) []string

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

func ClassGetEnumList

func ClassGetEnumList(class_ string) []string

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

func ClassGetIntegerConstant

func ClassGetIntegerConstant(class_ string, name string) int

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

func ClassGetIntegerConstantEnum

func ClassGetIntegerConstantEnum(class_ string, name string) string

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

func ClassGetIntegerConstantList

func ClassGetIntegerConstantList(class_ string) []string

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

func ClassGetMethodArgumentCount

func ClassGetMethodArgumentCount(class_ string, method string) int

Returns the number of arguments of the method [param method] of [param class] or its ancestry if [param no_inheritance] is [code]false[/code].

func ClassGetProperty

func ClassGetProperty(obj Object.Instance, property string) any

Returns the value of [param property] of [param object] or its ancestry.

func ClassGetPropertyDefaultValue

func ClassGetPropertyDefaultValue(class_ string, property string) any

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

func ClassHasEnum

func ClassHasEnum(class_ string, name string) bool

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

func ClassHasIntegerConstant

func ClassHasIntegerConstant(class_ string, name string) bool

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

func ClassHasMethod

func ClassHasMethod(class_ string, method string) bool

Returns whether [param class] (or its ancestry if [param no_inheritance] is [code]false[/code]) has a method called [param method] or not.

func ClassHasSignal

func ClassHasSignal(class_ string, signal string) bool

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

func ClassSetProperty

func ClassSetProperty(obj Object.Instance, property string, value any) error

Sets [param property] value of [param object] to [param value].

func GetClassList

func GetClassList() []string

Returns the names of all the classes available.

func GetInheritersFromClass

func GetInheritersFromClass(class_ string) []string

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

func GetParentClass

func GetParentClass(class_ string) string

Returns the parent class of [param class].

func Instantiate

func Instantiate(class_ string) any

Creates an instance of [param class].

func IsClassEnabled

func IsClassEnabled(class_ string) bool

Returns whether this [param class] is enabled or not.

func IsClassEnumBitfield

func IsClassEnumBitfield(class_ string, enum string) bool

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

func IsParentClass

func IsParentClass(class_ string, inherits string) bool

Returns whether [param inherits] is an ancestor of [param class] or not.

Types

type Error

type Error = gd.Error //gd:Error
const (
	/*Methods that return [enum Error] return [constant OK] when no error occurred.
	  Since [constant OK] has value 0, and all other error constants are positive integers, it can also be used in boolean checks.
	  [b]Example:[/b]
	  [codeblock]
	  var error = method_that_returns_error()
	  if error != OK:
	      printerr("Failure!")

	  # Or, alternatively:
	  if error:
	      printerr("Still failing!")
	  [/codeblock]
	  [b]Note:[/b] Many functions do not return an error code, but will print error messages to standard output.*/
	Ok Error = 0
	/*Generic error.*/
	Failed Error = 1
	/*Unavailable error.*/
	ErrUnavailable Error = 2
	/*Unconfigured error.*/
	ErrUnconfigured Error = 3
	/*Unauthorized error.*/
	ErrUnauthorized Error = 4
	/*Parameter range error.*/
	ErrParameterRangeError Error = 5
	/*Out of memory (OOM) error.*/
	ErrOutOfMemory Error = 6
	/*File: Not found error.*/
	ErrFileNotFound Error = 7
	/*File: Bad drive error.*/
	ErrFileBadDrive Error = 8
	/*File: Bad path error.*/
	ErrFileBadPath Error = 9
	/*File: No permission error.*/
	ErrFileNoPermission Error = 10
	/*File: Already in use error.*/
	ErrFileAlreadyInUse Error = 11
	/*File: Can't open error.*/
	ErrFileCantOpen Error = 12
	/*File: Can't write error.*/
	ErrFileCantWrite Error = 13
	/*File: Can't read error.*/
	ErrFileCantRead Error = 14
	/*File: Unrecognized error.*/
	ErrFileUnrecognized Error = 15
	/*File: Corrupt error.*/
	ErrFileCorrupt Error = 16
	/*File: Missing dependencies error.*/
	ErrFileMissingDependencies Error = 17
	/*File: End of file (EOF) error.*/
	ErrFileEof Error = 18
	/*Can't open error.*/
	ErrCantOpen Error = 19
	/*Can't create error.*/
	ErrCantCreate Error = 20
	/*Query failed error.*/
	ErrQueryFailed Error = 21
	/*Already in use error.*/
	ErrAlreadyInUse Error = 22
	/*Locked error.*/
	ErrLocked Error = 23
	/*Timeout error.*/
	ErrTimeout Error = 24
	/*Can't connect error.*/
	ErrCantConnect Error = 25
	/*Can't resolve error.*/
	ErrCantResolve Error = 26
	/*Connection error.*/
	ErrConnectionError Error = 27
	/*Can't acquire resource error.*/
	ErrCantAcquireResource Error = 28
	/*Can't fork process error.*/
	ErrCantFork Error = 29
	/*Invalid data error.*/
	ErrInvalidData Error = 30
	/*Invalid parameter error.*/
	ErrInvalidParameter Error = 31
	/*Already exists error.*/
	ErrAlreadyExists Error = 32
	/*Does not exist error.*/
	ErrDoesNotExist Error = 33
	/*Database: Read error.*/
	ErrDatabaseCantRead Error = 34
	/*Database: Write error.*/
	ErrDatabaseCantWrite Error = 35
	/*Compilation failed error.*/
	ErrCompilationFailed Error = 36
	/*Method not found error.*/
	ErrMethodNotFound Error = 37
	/*Linking failed error.*/
	ErrLinkFailed Error = 38
	/*Script failed error.*/
	ErrScriptFailed Error = 39
	/*Cycling link (import cycle) error.*/
	ErrCyclicLink Error = 40
	/*Invalid declaration error.*/
	ErrInvalidDeclaration Error = 41
	/*Duplicate symbol error.*/
	ErrDuplicateSymbol Error = 42
	/*Parse error.*/
	ErrParseError Error = 43
	/*Busy error.*/
	ErrBusy Error = 44
	/*Skip error.*/
	ErrSkip Error = 45
	/*Help error. Used internally when passing [code]--version[/code] or [code]--help[/code] as executable options.*/
	ErrHelp Error = 46
	/*Bug error, caused by an implementation issue in the method.
	  [b]Note:[/b] If a built-in method returns this code, please open an issue on [url=https://github.com/godotengine/godot/issues]the GitHub Issue Tracker[/url].*/
	ErrBug Error = 47
	/*Printer on fire error (This is an easter egg, no built-in methods return this error code).*/
	ErrPrinterOnFire Error = 48
)

type PropertyInfo

type PropertyInfo struct {
	ClassName  string       `gd:"class_name"`
	Name       string       `gd:"name"`
	Hint       int          `gd:"hint"`
	HintString string       `gd:"hint_string"`
	Type       reflect.Type `gd:"type"`
	Usage      int          `gd:"usage"`
}

func ClassGetMethodList

func ClassGetMethodList(class_ string) []PropertyInfo

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

func ClassGetPropertyList

func ClassGetPropertyList(class_ string) []PropertyInfo

Returns an array with all the properties of [param class] or its ancestry if [param no_inheritance] is [code]false[/code].

type SignalInfo

type SignalInfo struct {
	Name        string         `gd:"name"`
	Flags       int            `gd:"flags"`
	ID          int            `gd:"id"`
	DefaultArgs []interface{}  `gd:"default_args"`
	Args        []PropertyInfo `gd:"args"`
}

func ClassGetSignal

func ClassGetSignal(class_ string, signal string) SignalInfo

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

func ClassGetSignalList

func ClassGetSignalList(class_ string) []SignalInfo

Returns an array with all the signals of [param class] or its ancestry if [param no_inheritance] is [code]false[/code]. Every element of the array is a [Dictionary] as described in [method class_get_signal].

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL