ConnectFlags
Object.swift:40struct ConnectFlags
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (67) members.
Typealiases
Type members
static var godotType: Variant.GType
static let notificationPostinitialize: Int
Notification received when the object is initialized, before its script is attached. Used internally.
static let notificationPredelete: Int
Notification received when the object is about to be deleted. Can act as the deconstructor of some programming languages.
class var godotClassName: StringName
Instance members
var content: UnsafeRawPointer?
var description: String
var propertyListChanged: SimpleSignal
Emitted when
notifyPropertyListChanged
is called.var scriptChanged: SimpleSignal
Emitted when the object’s script is changed.
func addUserSignal(String, arguments: GArray
) Adds a user-defined
signal
. Optional arguments for the signal can be added as anGArray
of dictionaries, each defining aname
String
and atype
integer (seeVariant.GType
). See alsohasUserSignal(_:)
.func call(method: StringName, Variant...
) -> Variant Calls the
method
on the object and returns the result. This method supports a variable number of arguments, so parameters can be passed as a comma separated list.func callDeferred(method: StringName, Variant...
) -> Variant Calls the
method
on the object during idle time. Always returns null, not the method’s result.func callv(method: StringName, argArray: GArray
) -> Variant Calls the
method
on the object and returns the result. Unlikecall(method:)
, this method expects all parameters to be contained insideargArray
.func canTranslateMessages(
) -> Bool Returns
true
if the object is allowed to translate messages withtr(message:context:)
andtrN(message:pluralMessage:n:context:)
. See alsosetMessageTranslation(enable:)
.func cancelFree(
) If this method is called during
notificationPredelete
, this object will reject being freed and will remain allocated. This is mostly an internal function used for error handling to avoid the user from freeing objects when they are not intended to.func connect(signal: StringName, callable: Callable, flags: UInt32
) -> GodotError Connects a
signal
by name to acallable
. Optionalflags
can be also added to configure the connection’s behavior (seeConnectFlags
constants).func connect(signal: SignalWith1Argument<some Any>, to: some Object, method: String
) -> GodotError Connects a signal to a callable method
func connect(signal: SignalWith2Arguments<some Any, some Any>, to: some Object, method: String
) -> GodotError Connects a signal to a callable method
func connect(signal: SignalWith3Arguments<some Any, some Any, some Any>, to: some Object, method: String
) -> GodotError Connects a signal to a callable method
func connect(signal: SignalWith4Arguments<some Any, some Any, some Any, some Any>, to: some Object, method: String
) -> GodotError Connects a signal to a callable method
func connect(signal: SignalWith5Arguments<some Any, some Any, some Any, some Any, some Any>, to: some Object, method: String
) -> GodotError Connects a signal to a callable method
func connect(signal: SignalWith6Arguments<some Any, some Any, some Any, some Any, some Any, some Any>, to: some Object, method: String
) -> GodotError Connects a signal to a callable method
func connect(signal: SignalWithNoArguments, to: some Object, method: String
) -> GodotError Connects a signal to a callable method
func disconnect(signal: StringName, callable: Callable
) Disconnects a
signal
by name from a givencallable
. If the connection does not exist, generates an error. UseisConnected(signal:callable:)
to make sure that the connection exists.func emit(signal: SignalWithNoArguments
) -> GodotError Emits a signal that was previously defined with the #signal macro.
func emit<A>(signal: SignalWith1Argument<A>, A
) -> GodotError Emits a signal that was previously defined with the #signal macro. The argument must match the type of the argument at that position in the signal.
func emit<A, B>(signal: SignalWith2Arguments<A, B>, A, B
) -> GodotError Emits a signal that was previously defined with the #signal macro. The argument must match the type of the argument at that position in the signal.
func emit<A, B, C>(signal: SignalWith3Arguments<A, B, C>, A, B, C
) -> GodotError Emits a signal that was previously defined with the #signal macro. The argument must match the type of the argument at that position in the signal.
func emit<A, B, C, D>(signal: SignalWith4Arguments<A, B, C, D>, A, B, C, D
) -> GodotError Emits a signal that was previously defined with the #signal macro. The argument must match the type of the argument at that position in the signal.
func emit<A, B, C, D, E>(signal: SignalWith5Arguments<A, B, C, D, E>, A, B, C, D, E
) -> GodotError Emits a signal that was previously defined with the #signal macro. The argument must match the type of the argument at that position in the signal.
func emit<A, B, C, D, E, F>(signal: SignalWith6Arguments<A, B, C, D, E, F>, A, B, C, D, E, F
) -> GodotError Emits a signal that was previously defined with the #signal macro. The argument must match the type of the argument at that position in the signal.
func emitSignal(StringName, Variant...
) -> GodotError Emits the given
signal
by name. The signal must exist, so it should be a built-in signal of this class or one of its inherited classes, or a user-defined signal (seeaddUserSignal(_:arguments:)
). This method supports a variable number of arguments, so parameters can be passed as a comma separated list.func get(property: StringName
) -> Variant Returns the
Variant
value of the givenproperty
. If theproperty
does not exist, this method returnsnull
.func getClass(
) -> String Returns the object’s built-in class name, as a
String
. See alsoisClass(_:)
.func getIncomingConnections(
) -> VariantCollection<GDictionary> Returns an
GArray
of signal connections received by this object. Each connection is represented as aGDictionary
that contains three entries:func getIndexed(propertyPath: NodePath
) -> Variant Gets the object’s property indexed by the given
propertyPath
. The path should be aNodePath
relative to the current object and can use the colon character (:
) to access nested properties.func getInstanceId(
) -> UInt Returns the object’s unique instance ID. This ID can be saved in
EncodedObjectAsID
, and can be used to retrieve this object instance with@GlobalScope.instance_from_id
.func getMeta(name: StringName, default: Variant
) -> Variant Returns the object’s metadata value for the given entry
name
. If the entry does not exist, returnsdefault
. Ifdefault
isnull
, an error is also generated.func getMetaList(
) -> VariantCollection<StringName> Returns the object’s metadata entry names as a
PackedStringArray
.func getMethodList(
) -> VariantCollection<GDictionary> Returns this object’s methods and their signatures as an
GArray
of dictionaries. EachGDictionary
contains the following entries:func getPropertyList(
) -> VariantCollection<GDictionary> Returns the object’s property list as an
GArray
of dictionaries. EachGDictionary
contains the following entries:func getScript(
) -> Variant Returns the object’s
Script
instance, ornull
if no script is attached.func getSignalConnectionList(signal: StringName
) -> VariantCollection<GDictionary> Returns an
GArray
of connections for the givensignal
name. Each connection is represented as aGDictionary
that contains three entries:func getSignalList(
) -> VariantCollection<GDictionary> Returns the list of existing signals as an
GArray
of dictionaries.func hasMeta(name: StringName
) -> Bool Returns
true
if a metadata entry is found with the givenname
. See alsogetMeta(name:`default`:)
,setMeta(name:value:)
andremoveMeta(name:)
.func hasMethod(StringName
) -> Bool Returns
true
if the givenmethod
name exists in the object.func hasSignal(StringName
) -> Bool Returns
true
if the givensignal
name exists in the object.func hasUserSignal(StringName
) -> Bool Returns
true
if the given user-definedsignal
name exists. Only signals added withaddUserSignal(_:arguments:)
are included.func isBlockingSignals(
) -> Bool Returns
true
if the object is blocking its signals from being emitted. SeesetBlockSignals(enable:)
.func isClass(String
) -> Bool Returns
true
if the object inherits from the givenclass
. See alsogetClass
.func isConnected(signal: StringName, callable: Callable
) -> Bool Returns
true
if a connection exists between the givensignal
name andcallable
.func isQueuedForDeletion(
) -> Bool Returns
true
if thequeueFree
method was called for the object.func notification(what: Int32, reversed: Bool
) Sends the given
what
notification to all classes inherited by the object, triggering calls to_notification()
, starting from the highest ancestor (theObject
class) and going down to the object’s script.func notifyPropertyListChanged(
) Emits the [signal property_list_changed] signal. This is mainly used to refresh the editor, so that the Inspector and editor plugins are properly updated.
func propertyCanRevert(property: StringName
) -> Bool Returns
true
if the givenproperty
has a custom default value. UsepropertyGetRevert(property:)
to get theproperty
’s default value.func propertyGetRevert(property: StringName
) -> Variant Returns the custom default value of the given
property
. UsepropertyCanRevert(property:)
to check if theproperty
has a custom default value.func removeMeta(name: StringName
) Removes the given entry
name
from the object’s metadata. See alsohasMeta(name:)
,getMeta(name:`default`:)
andsetMeta(name:value:)
.func set(property: StringName, value: Variant
) Assigns
value
to the givenproperty
. If the property does not exist or the givenvalue
‘s type doesn’t match, nothing happens.func setBlockSignals(enable: Bool
) If set to
true
, the object becomes unable to emit signals. As such,emitSignal(_:)
and signal connections will not work, until it is set tofalse
.func setDeferred(property: StringName, value: Variant
) Assigns
value
to the givenproperty
, at the end of the current frame. This is equivalent to callingset(property:value:)
throughcallDeferred(method:)
.func setIndexed(propertyPath: NodePath, value: Variant
) Assigns a new
value
to the property identified by thepropertyPath
. The path should be aNodePath
relative to this object, and can use the colon character (:
) to access nested properties.func setMessageTranslation(enable: Bool
) If set to
true
, allows the object to translate messages withtr(message:context:)
andtrN(message:pluralMessage:n:context:)
. Enabled by default. See alsocanTranslateMessages
.func setMeta(name: StringName, value: Variant
) Adds or changes the entry
name
inside the object’s metadata. The metadatavalue
can be anyVariant
, although some types cannot be serialized correctly.func setScript(Variant
) Attaches
script
to the object, and instantiates it. As a result, the script’s_init()
is called. AScript
is used to extend the object’s functionality.func toString(
) -> String Returns a
String
representing the object. Defaults to"<ClassName#RID>"
. Override_toString()
to customize the string representation of the object.func tr(message: StringName, context: StringName
) -> String Translates a
message
, using the translation catalogs configured in the Project Settings. Furthercontext
can be specified to help with the translation.func trN(message: StringName, pluralMessage: StringName, n: Int32, context: StringName
) -> String Translates a
message
orpluralMessage
, using the translation catalogs configured in the Project Settings. Furthercontext
can be specified to help with the translation.
Citizens in SwiftGodot
Conformances
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol Equatable
A type that can be compared for value equality.
protocol ExpressibleByArrayLiteral
A type that can be initialized using an array literal.
protocol OptionSet
A type that presents a mathematical set interface to a bit set.
protocol RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
protocol SetAlgebra<Element>
A type that provides mathematical set operations.
Type members
init(rawValue: Int
) static let deferred: Object.ConnectFlags
Deferred connections trigger their
Callable
s on idle time (at the end of the frame), rather than instantly.static let oneShot: Object.ConnectFlags
One-shot connections disconnect themselves after emission.
static let persist: Object.ConnectFlags
Persisting connections are stored when the object is serialized (such as when using
pack(path:)
). In the editor, connections created through the Node dock are always persisting.static let referenceCounted: Object.ConnectFlags
Reference-counted connections can be assigned to the same
Callable
multiple times. Each disconnection decreases the internal counter. The signal fully disconnects only when the counter reaches 0.
Instance members
var debugDescription: String
A textual representation of this instance, suitable for debugging
let rawValue: Int
Type features
init(
) Creates an empty option set.
init<S>(S
) Creates a new set from a finite sequence of items.
init(arrayLiteral: Self.Element...
) Creates a set containing the elements of the given array literal.
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.
Instance features
var isEmpty: Bool
A Boolean value that indicates whether the set has no elements.
func contains(Self
) -> Bool Returns a Boolean value that indicates whether a given element is a member of the option set.
func formIntersection(Self
) Removes all elements of this option set that are not also present in the given set.
func formSymmetricDifference(Self
) Replaces this set with a new set containing all elements contained in either this set or the given set, but not in both.
func formUnion(Self
) Inserts the elements of another set into this option set.
func insert(Self.Element
) -> (inserted: Bool, memberAfterInsert: Self.Element) Adds the given element to the option set if it is not already a member.
func intersection(Self
) -> Self Returns a new option set with only the elements contained in both this set and the given set.
func isDisjoint(with: Self
) -> Bool Returns a Boolean value that indicates whether the set has no members in common with the given set.
func isStrictSubset(of: Self
) -> Bool Returns a Boolean value that indicates whether this set is a strict subset of the given set.
func isStrictSuperset(of: Self
) -> Bool Returns a Boolean value that indicates whether this set is a strict superset of the given set.
func isSubset(of: Self
) -> Bool Returns a Boolean value that indicates whether the set is a subset of another set.
func isSuperset(of: Self
) -> Bool Returns a Boolean value that indicates whether the set is a superset of the given set.
func remove(Self.Element
) -> Self.Element? Removes the given element and all elements subsumed by it.
func subtract(Self
) Removes the elements of the given set from this set.
func subtracting(Self
) -> Self Returns a new set containing the elements of this set that do not occur in the given set.
func symmetricDifference(Self
) -> Self Returns a new option set with the elements contained in this set or in the given set, but not in both.
func union(Self
) -> Self Returns a new option set of the elements contained in this set, in the given set, or in both.
func update(with: Self.Element
) -> Self.Element? Inserts the given element into the set.