-
Notifications
You must be signed in to change notification settings - Fork 0
class_object
####Category: Core
Base class for all non built-in types.
- void
_get( String property ) virtual -
Array
_get_property_list( ) virtual - void
_notification( int what ) virtual - void
_set( String property, var value ) virtual -
String
get_type( ) const -
bool
is_type( String type ) const - void
set( String property, var value ) - void
get( String property ) const -
Array
get_property_list( ) const - void
notification( int what, bool arg1=false ) -
int
get_instance_ID( ) const - void
set_script( Script script ) -
Script
get_script( ) const - void
set_meta( String name, var value ) - void
get_meta( String name ) const -
bool
has_meta( String name ) const -
StringArray
get_meta_list( ) const - void
add_user_signal( String signal, Array arguments=Array() ) - void
emit_signal( String signal, var arg0=NULL, var arg1=NULL, var arg2=NULL, var arg3=NULL, var arg4=NULL ) - void
call( String method, var arg0=NULL, var arg1=NULL, var arg2=NULL, var arg3=NULL, var arg4=NULL, var arg5=NULL, var arg6=NULL, var arg7=NULL, var arg8=NULL, var arg9=NULL ) - void
call_deferred( String method, var arg0=NULL, var arg1=NULL, var arg2=NULL, var arg3=NULL, var arg4=NULL ) - void
callv( String method, Array arg_array ) -
bool
has_method( String arg0 ) const -
Array
get_signal_list( ) const - void
connect( String signal, Object target, String method, Array binds=Array(), int flags=0 ) - void
disconnect( String signal, Object target, String method ) -
bool
is_connected( String signal, Object target, String method ) const - void
set_block_signals( bool enable ) -
bool
is_blocking_signals( ) const - void
set_message_translation( bool enable ) - void
can_translate_messages( bool arg0 ) - void
property_list_changed_notify( ) -
String
XL_MESSAGE( String message ) const -
String
tr( String message ) const
-
script_changed( )
- NOTIFICATION_POSTINITIALIZE = 0 - Called right when the object is initialized. Not available in script.
- NOTIFICATION_PREDELETE = 1 - Called before the object is about to be deleted.
- CONNECT_DEFERRED = 1 - Connect a signal in deferred mode. This way, signal emissions are stored in a queue, then set on idle time.
- CONNECT_PERSIST = 2 - Persisting connections are saved when the object is serialized to file.
- CONNECT_ONESHOT = 4 - One short connections disconnect themselves after emission.
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 derivates add memory management, such as Reference (which keps 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 _get_property_list and handled in _get and [_set]. However, scripting languages and C++ have simper 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.
- void
_get( String property ) virtual
Return a property, return null if the property does not exist.
-
Array
_get_property_list( ) virtual
Return the property list, array of dictionaries, dictionaries must countain: name:String, type:int (see TYPE_* enum in globals) and optionally: hint:int (see PROPERTY_HINT_* in globals), hint_string:String, usage:int (see PROPERTY_USAGE_* in globals).
- void
_notification( int what ) virtual
Notification request, the notification id is received.
- void
_set( String property, var value ) virtual
Set a property. Return true if the property was found.
-
String
get_type( ) const
Return the type of the object as a string.
Check the type of the obeject against a string (including inheritance).
- void
set( String property, var value )
Set property into the object.
- void
get( String property ) const
Get a property from the object.
-
Array
get_property_list( ) const
Return the list of properties as an array of dictionaries, dictionaries countain: name:String, type:int (see TYPE_* enum in globals) and optionally: hint:int (see PROPERTY_HINT_* in globals), hint_string:String, usage:int (see PROPERTY_USAGE_* in globals).
Notify the object of something.
-
int
get_instance_ID( ) const
Return the instance ID. All objects have a unique instance ID.
- void
set_script( Script script )
Set a script into the object, scripts extend the object functionality.
-
Script
get_script( ) const
Return the object script (or null if it doesn't have one).
- void
set_meta( String name, var value )
Set a metadata into the object. Medatada is serialized. Metadata can be anything.
- void
get_meta( String name ) const
Return a metadata from the object.
Return true if a metadata is found with the requested name.
-
StringArray
get_meta_list( ) const
Return the list of metadatas in the object.
Add a user signal (can be added anytime). Arguments are optional, but can be added as an array of dictionaries, each containing "name" and "type" (from [@GlobalScope] TYPE_*).
- void
emit_signal( String signal, var arg0=NULL, var arg1=NULL, var arg2=NULL, var arg3=NULL, var arg4=NULL )
Emit a signal. Arguments are passed in an array.
- void
call( String method, var arg0=NULL, var arg1=NULL, var arg2=NULL, var arg3=NULL, var arg4=NULL, var arg5=NULL, var arg6=NULL, var arg7=NULL, var arg8=NULL, var arg9=NULL )
Call a function in the object, result is returned.
- void
call_deferred( String method, var arg0=NULL, var arg1=NULL, var arg2=NULL, var arg3=NULL, var arg4=NULL )
Create and store a function in the object. The call will take place on idle time.
-
Array
get_signal_list( ) const
Return the list of signals as an array of dictionaries.
Connect a signal to a method at a target (member function). Binds are optional and are passed as extra arguments to the call. Flags specify optional deferred or one shot connections, see enum CONNECT_*.
A signal can only be connected once to a method, and it will throw an error if already connected. If you want to avoid this, use is_connected to check.
Disconnect a signal from a method.
Return true if a connection exists for a given signal and target/method.
- void
set_block_signals( bool enable )
If set to true, signal emission is blocked.
-
bool
is_blocking_signals( ) const
Return true if signal emission blocking is enabled.
- void
set_message_translation( bool enable )
Set true if this object can translate strings (in calls to tr() ). Default is true.
- void
can_translate_messages( bool arg0 )
Return true if this object can translate strings.
deprecated, will go away.
Translate a message. Only works in message translation is enabled (which is by default). See set_message_translation.