GodotObject

Base class for all non built-in types.

Everything not a built-in type starts the inheritance chain from this class. Objects do not manage memory, if inheriting from one the object will most likely have to be deleted manually (call the free function from the script or delete from C++). Some derivatives add memory management, such as Reference (which keeps a reference count and deletes itself automatically when no longer referenced) and Node, which deletes the children tree when deleted. Objects export properties, which are mainly useful for storage and editing, but not really so much in programming. Properties are exported in _getPropertyList and handled in _get and _set. However, scripting languages and C++ have simpler means to export them. Objects also receive notifications (_notification). Notifications are a simple way to notify the object about simple events, so they can all be handled together.

@GodotBaseClass
struct GodotObject {}

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!()
Undocumented in source.

Enums

ConnectFlags
enum ConnectFlags
Constants
enum Constants

Functions

_get
Variant _get(StringArg0 property)

Returns the given property. Returns null if the property does not exist.

_getPropertyList
Array _getPropertyList()

Returns the object's property list as an Array of dictionaries. Dictionaries must contain: name:String, type:int (see TYPE_* enum in @GlobalScope) and optionally: hint:int (see PROPERTY_HINT_* in @GlobalScope), hint_string:String, usage:int (see PROPERTY_USAGE_* in @GlobalScope).

_init
void _init()

The virtual method called upon initialization.

_notification
void _notification(long what)

Notify the object internally using an ID.

_set
bool _set(StringArg0 property, VariantArg1 value)

Sets a property. Returns true if the property exists.

addUserSignal
void addUserSignal(StringArg0 signal, Array arguments)

Adds a user-defined signal. Arguments are optional, but can be added as an Array of dictionaries, each containing "name" and "type" (from @GlobalScope TYPE_*).

call
Variant call(StringArg0 method, VarArgs varArgs)

Calls the method on the object and returns a result. Pass parameters as a comma separated list.

callDeferred
Variant callDeferred(StringArg0 method, VarArgs varArgs)

Calls the method on the object during idle time and returns a result. Pass parameters as a comma separated list.

callv
Variant callv(StringArg0 method, Array arg_array)

Calls the method on the object and returns a result. Pass parameters as an Array.

canTranslateMessages
bool canTranslateMessages()

Returns true if the object can translate strings.

connect
GodotError connect(StringArg0 signal, GodotObject target, StringArg2 method, Array binds, long flags)

Connects a signal to a method on a target object. Pass optional binds to the call. Use flags to set deferred or one shot connections. See CONNECT_* constants. A signal can only be connected once to a method. It will throw an error if already connected. To avoid this, first use isConnected to check for existing connections.

disconnect
void disconnect(StringArg0 signal, GodotObject target, StringArg2 method)

Disconnects a signal from a method on the given target.

emitSignal
Variant emitSignal(StringArg0 signal, VarArgs varArgs)

Emits the given signal.

free
void free()

Deletes the object from memory.

get
Variant get(StringArg0 property)

Returns a Variant for a property.

getClass
String getClass()

Returns the object's class as a String.

getIncomingConnections
Array getIncomingConnections()

Returns an Array of dictionaries with information about signals that are connected to the object. Inside each Dictionary there are 3 fields: - "source" is a reference to signal emitter. - "signal_name" is name of connected signal. - "method_name" is a name of method to which signal is connected.

getIndexed
Variant getIndexed(NodePathArg0 property)

Get indexed object property by String. Property indices get accessed with colon separation, for example: position:x

getInstanceId
long getInstanceId()

Returns the object's unique instance ID.

getMeta
Variant getMeta(StringArg0 name)

Returns the object's metadata for the given name.

getMetaList
PoolStringArray getMetaList()

Returns the object's metadata as a PoolStringArray.

getMethodList
Array getMethodList()

Returns the object's methods and their signatures as an Array.

getPropertyList
Array getPropertyList()

Returns the list of properties as an Array of dictionaries. Dictionaries contain: name:String, type:int (see TYPE_* enum in @GlobalScope) and optionally: hint:int (see PROPERTY_HINT_* in @GlobalScope), hint_string:String, usage:int (see PROPERTY_USAGE_* in @GlobalScope).

getScript
Reference getScript()

Returns the object's Script or null if one doesn't exist.

getSignalConnectionList
Array getSignalConnectionList(StringArg0 signal)

Returns an Array of connections for the given signal.

getSignalList
Array getSignalList()

Returns the list of signals as an Array of dictionaries.

hasMeta
bool hasMeta(StringArg0 name)

Returns true if a metadata is found with the given name.

hasMethod
bool hasMethod(StringArg0 method)

Returns true if the object contains the given method.

hasUserSignal
bool hasUserSignal(StringArg0 signal)

Returns true if the given user-defined signal exists.

isBlockingSignals
bool isBlockingSignals()

Returns true if signal emission blocking is enabled.

isClass
bool isClass(StringArg0 type)

Returns true if the object inherits from the given type.

isConnected
bool isConnected(StringArg0 signal, GodotObject target, StringArg2 method)

Returns true if a connection exists for a given signal, target, and method.

isQueuedForDeletion
bool isQueuedForDeletion()

Returns true if the queue_free method was called for the object.

notification
void notification(long what, bool reversed)

Notify the object of something.

opAssign
GodotObject opAssign(T n)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(GodotObject other)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(typeof(null) n)
Undocumented in source. Be warned that the author may not have intended to support it.
propertyListChangedNotify
void propertyListChangedNotify()
set
void set(StringArg0 property, VariantArg1 value)

Set property into the object.

setBlockSignals
void setBlockSignals(bool enable)

If set to true, signal emission is blocked.

setIndexed
void setIndexed(NodePathArg0 property, VariantArg1 value)
setMessageTranslation
void setMessageTranslation(bool enable)

Define whether the object can translate strings (with calls to tr). Default is true.

setMeta
void setMeta(StringArg0 name, VariantArg1 value)

Set a metadata into the object. Metadata is serialized. Metadata can be anything.

setScript
void setScript(Reference script)

Set a script into the object, scripts extend the object functionality.

tr
String tr(StringArg0 message)

Translate a message. Only works if message translation is enabled (which it is by default). See setMessageTranslation.

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Static functions

_new
GodotObject _new()
Undocumented in source. Be warned that the author may not have intended to support it.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

_classBinding
struct _classBinding
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.
_godot_object
godot_object _godot_object;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
To as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
To as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
ToRef as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta