class Godot::Node

Overview

Base class for all scene tree nodes in Godot. Provides hierarchy management, node traversal, and lifecycle hooks (#_ready, #_process, #_physics_process).

Direct Known Subclasses

Defined in:

lapis.cr
libgodot/generated/classes/classes_part1.cr
libgodot/object.cr

Constructors

Instance Method Summary

Instance methods inherited from class Godot::Object

==(other : Godot::Object) : Bool
==(other : Nil) : Bool
==
, _godot_call_tool_button(button_name : String) : Void _godot_call_tool_button, _godot_call_virtual(method_name : String, delta : Float64) : Void _godot_call_virtual, _godot_call_virtual_with_data(method_name : String, args : Pointer(Pointer(Void)), ret : Pointer(Void)) : Void _godot_call_virtual_with_data, _godot_get_property(prop_name : String, ret_ptr : Pointer(Void)) : Void _godot_get_property, _godot_set_property(prop_name : String, val_ptr : Pointer(Void)) : Void _godot_set_property, add_user_signal(signal : String, arguments : Godot::Array) : Void add_user_signal, alive? : Bool alive?, await_signal(signal_name : String, timeout_sec : Float64 | Nil = nil) : Array(Variant) await_signal, call(method : String, *args) : Pointer(Void) call, call_bool(method : String, *args) : Bool call_bool, call_deferred(method : String, *args) : Pointer(Void) call_deferred, call_f64(method : String, *args) : Float64 call_f64, call_i64(method : String, *args) : Int64 call_i64, call_obj(method : String, *args) : Node | Nil call_obj, call_obj_as(type : T.class, method : String, *args) : T | Nil forall T call_obj_as, call_str(method : String, *args) : String call_str, callv(method : String, arg_array : Godot::Array) : Pointer(Void) callv, can_translate_messages : Bool can_translate_messages, cancel_free : Void cancel_free, check_alive! : Void check_alive!, connect(signal_name : String, flags : Godot::ConnectFlags = ::Godot::ConnectFlags::None, callback : Proc(Array(Variant), Void) | Nil = nil) : SignalSubscription
connect(signal_name : String, flags : Godot::ConnectFlags = ::Godot::ConnectFlags::None, &block : Array(Variant) -> Void) : SignalSubscription
connect(signal_name : String, listener_target : Godot::Object, method_name : Symbol, flags : Godot::ConnectFlags = ::Godot::ConnectFlags::None) : SignalSubscription
connect(signal : String, callable : Pointer(Void), flags : Int64) : Int64
connect
, connect_one_shot(signal_name : String, &block : Array(Variant) -> Void) : SignalSubscription connect_one_shot, destroy : Void destroy, destroyed? : Bool destroyed?, disconnect(signal : String, callable : Pointer(Void)) : Void
disconnect(signal_name : String) : Void
disconnect
, editor_hint? : Bool editor_hint?, emit_signal(name : String) : Void
emit_signal(name : String, *args) : Void
emit_signal
, free : Void free, get(property : String) : Pointer(Void) get, get_class : String get_class, get_incoming_connections : Godot::Array get_incoming_connections, get_indexed(property_path : NodePath) : Pointer(Void) get_indexed, get_instance_id : Int64 get_instance_id, get_meta(name : String, default : Pointer(Void)) : Pointer(Void) get_meta, get_meta_list : Godot::Array get_meta_list, get_method_argument_count(method : String) : Int64 get_method_argument_count, get_method_list : Godot::Array get_method_list, get_property_list : Godot::Array get_property_list, get_script : Pointer(Void) get_script, get_signal_connection_list(signal : String) : Godot::Array get_signal_connection_list, get_signal_list : Godot::Array get_signal_list, get_translation_domain : String get_translation_domain, has_connections(signal : String) : Bool has_connections, has_meta(name : String) : Bool has_meta, has_method(method : String) : Bool has_method, has_signal(signal : String) : Bool has_signal, has_signal?(signal_name : String) : Bool has_signal?, has_user_signal(signal : String) : Bool has_user_signal, hash(hasher) hash, if_alive : self | Nil if_alive, instance_id : UInt64 instance_id, is_blocking_signals : Bool is_blocking_signals, is_class(godot_class : String) : Bool is_class, is_connected(signal : String, callable : Pointer(Void)) : Bool is_connected, is_queued_for_deletion : Bool is_queued_for_deletion, is_valid? : Bool is_valid?, link_class_script : Void link_class_script, notification(what : Int64, reversed : Bool) : Void notification, notify_property_list_changed : Void notify_property_list_changed, pointer : Pointer(Void) pointer, pointer=(val : Pointer(Void)) pointer=, print(*args) print, printerr(*args) printerr, property_can_revert(property : String) : Bool property_can_revert, property_get_revert(property : String) : Pointer(Void) property_get_revert, puts(*args) puts, remove_meta(name : String) : Void remove_meta, remove_user_signal(signal : String) : Void remove_user_signal, set(property : String, value : Pointer(Void)) : Void set, set_block_signals(enable : Bool) : Void set_block_signals, set_deferred(property : String, value : Pointer(Void)) : Void set_deferred, set_indexed(property_path : NodePath, value : Pointer(Void)) : Void set_indexed, set_message_translation(enable : Bool) : Void set_message_translation, set_meta(name : String, value : Pointer(Void)) : Void set_meta, set_script(script : Pointer(Void)) : Void set_script, set_translation_domain(domain : String) : Void set_translation_domain, signal(name : String) : Godot::BoundSignal signal, signal_connection_count(signal_name : String) : Int32 signal_connection_count, signal_target_id : UInt64 signal_target_id, to_s(io : IO) : Void to_s, to_string : String to_string, to_unsafe : Pointer(Void) to_unsafe, tr(message : String, context : String) : String tr, tr_n(message : String, plural_message : String, n : Int64, context : String) : String tr_n

Constructor methods inherited from class Godot::Object

new(pointer : Pointer(Void) = Pointer(Void).null) new

Class methods inherited from class Godot::Object

_godot_has_virtual_method(method_name : String) : Bool _godot_has_virtual_method, is_instance_id_valid(id : Int | UInt64) : Bool is_instance_id_valid

Constructor Detail

def self.new(pointer : Pointer(Void) = Pointer(Void).null) #

[View source]

Instance Method Detail

def [](path : String) : Node #

Indexer syntactic sugar for retrieving a child node by path (e.g. self["Camera3D"])


[View source]
def []?(path : String) : Node | Nil #

Safe indexer returning nil if node not found (e.g. self["Camera3D"]?)


[View source]
def _physics_process(delta : Float64) : Void #

Fixed-rate physics process callback receiving delta timestep in seconds (Float64).


[View source]
def _process(delta : Float64) : Void #

Per-frame process callback receiving delta timestep in seconds (Float64).


[View source]
def _ready : Void #

Lifecycle callback called when the node enters the active scene tree.


[View source]
def add_child(node : Node, force_readable_name : Bool = false, internal : Int64 = 0_i64) : Void #

Adds a child node with optional force_readable_name and internal mode flags


[View source]
def add_sibling(sibling : Node, force_readable_name : Bool) : Void #

[View source]
def add_to_group(group : String, persistent : Bool) : Void #

[View source]
def add_to_group(group : String) : Void #

Adds this node to the specified group (with default non-persistent flag)


[View source]
def atr(message : String, context : String) : String #

[View source]
def atr_n(message : String, plural_message : String, n : Int64, context : String) : String #

[View source]
def auto_translate_mode #

Property #auto_translate_mode getter


[View source]
def auto_translate_mode=(val : Int) #

Property #auto_translate_mode setter


[View source]
def can_auto_translate : Bool #

[View source]
def can_process : Bool #

[View source]
def create_tween : Tween #

[View source]
def duplicate(flags : Int64) : Node #

[View source]
def each_child(include_internal : Bool = false, &block : Node -> Void) : Void #

Yields each child node without allocating an intermediate array.


[View source]
def editor_description #

Property #editor_description getter


[View source]
def editor_description=(val) #

Property #editor_description setter


[View source]
def find_child(pattern : String, recursive : Bool = true, owned : Bool = false) : Node | Nil #

Reliable GDExtension bridge implementation of find_child with default parameters


[View source]
def find_child_as(type : T.class, pattern : String, recursive : Bool = true, owned : Bool = false) : T | Nil forall T #

Finds child node matching pattern and casts to T, returning nil if not found


[View source]
def find_children(pattern : String, get_type : String, recursive : Bool, owned : Bool) : Godot::Array #

[View source]
def find_parent(pattern : String) : Node #

[View source]
def get_accessibility_element : Int64 #

[View source]
def get_auto_translate_mode : Int64 #

[View source]
def get_child(idx : Int64, include_internal : Bool) : Node #

[View source]
def get_child(idx : Int, include_internal : Bool = false) : Node #

Retrieves child at specified index


[View source]
def get_child?(idx : Int, include_internal : Bool = false) : Node | Nil #

Retrieves child at specified index, or nil if not found


[View source]
def get_child_as(type : T.class, idx : Int, include_internal : Bool = false) : T | Nil forall T #

Retrieves child at specified index cast to type T, or nil if not found or not matching type


[View source]
def get_child_count(include_internal : Bool = false) : Int64 #

Returns the count of children belonging to this node


[View source]
def get_children(include_internal : Bool = false) : Array(Node) #

Returns an Array containing all child nodes belonging to this node.


[View source]
def get_children_as(type : T.class, include_internal : Bool = false) : Array(T) forall T #

Returns all children of this node matching or cast to type T.


[View source]
def get_editor_description : String #

[View source]
def get_groups : Godot::Array #

[View source]
def get_index(include_internal : Bool) : Int64 #

[View source]
def get_last_exclusive_window : Window #

[View source]
def get_multiplayer : MultiplayerAPI #

[View source]
def get_multiplayer_authority : Int64 #

[View source]
def get_name : String #

[View source]
def get_node(path : String) : Node #

Retrieves a child or sibling node by NodePath string. Returns the Node if found, or produces an error if the node does not exist.


[View source]
def get_node(path : NodePath) : Node #

[View source]
def get_node?(path : String) : Node | Nil #

Retrieves a child or sibling node by NodePath string, or returns nil if not found.


[View source]
def get_node_and_resource(path : NodePath) : Godot::Array #

[View source]
def get_node_as(type : T.class, path : String) : T forall T #

Retrieves a child node cast to the specified Crystal class type T. Returns the node cast to T, or produces an error if the node does not exist.


[View source]
def get_node_as?(type : T.class, path : String) : T | Nil forall T #

Retrieves a child node cast to the specified Crystal class type T, or nil if not found.


[View source]
def get_node_or_null(path : String) : Node | Nil #

Fetches a node by String path. Similar to #get_node, but returns nil if path does not point to a valid node.


[View source]
def get_node_or_null(path : NodePath) : Node #

[View source]
def get_node_rpc_config : Pointer(Void) #

[View source]
def get_orphan_node_ids : Godot::Array #

[View source]
def get_owner : Node #

[View source]
def get_parent : Node #

Returns the parent Node


[View source]
def get_parent? : Node | Nil #

Returns the parent Node, or nil if orphan


[View source]
def get_parent_as(type : T.class) : T | Nil forall T #

Returns the parent node cast to T, or nil if parent is not of type T or is null


[View source]
def get_path : NodePath #

[View source]
def get_path_to(node : Node, use_unique_path : Bool) : NodePath #

[View source]
def get_physics_interpolation_mode : Int64 #

[View source]
def get_physics_process_delta_time : Float64 #

[View source]
def get_physics_process_priority : Int64 #

[View source]
def get_process_delta_time : Float64 #

[View source]
def get_process_mode : Int64 #

[View source]
def get_process_priority : Int64 #

[View source]
def get_process_thread_group : Int64 #

[View source]
def get_process_thread_group_order : Int64 #

[View source]
def get_process_thread_messages : Int64 #

[View source]
def get_scene_file_path : String #

[View source]
def get_scene_instance_load_placeholder : Bool #

[View source]
def get_tree : SceneTree #

Returns the SceneTree containing this node.


[View source]
def get_tree_string : String #

[View source]
def get_tree_string_pretty : String #

[View source]
def get_unique_node_as(type : T.class, unique_name : String) : T | Nil forall T #

Returns the scene unique node with name %unique_name cast to T


[View source]
def get_viewport : Viewport #

[View source]
def get_window : Window #

[View source]
def has_node(path : NodePath) : Bool #

[View source]
def has_node_and_resource(path : NodePath) : Bool #

[View source]
def in_group?(group_name : String) : Bool #

Returns true if this node belongs to the given node group.


[View source]
def inside_tree? : Bool #

Returns true if this node is currently a member of the active SceneTree.


[View source]
def is_ancestor_of(node : Node) : Bool #

[View source]
def is_displayed_folded : Bool #

[View source]
def is_editable_instance(node : Node) : Bool #

[View source]
def is_greater_than(node : Node) : Bool #

[View source]
def is_in_group(group : String) : Bool #

[View source]
def is_inside_tree : Bool #

Returns true if the node is currently inside the active scene tree


[View source]
def is_multiplayer_authority : Bool #

[View source]
def is_node_ready : Bool #

[View source]
def is_part_of_edited_scene : Bool #

[View source]
def is_physics_interpolated : Bool #

[View source]
def is_physics_interpolated_and_enabled : Bool #

[View source]
def is_physics_processing : Bool #

[View source]
def is_physics_processing_internal : Bool #

[View source]
def is_processing : Bool #

[View source]
def is_processing_input : Bool #

[View source]
def is_processing_internal : Bool #

[View source]
def is_processing_shortcut_input : Bool #

[View source]
def is_processing_unhandled_input : Bool #

[View source]
def is_processing_unhandled_key_input : Bool #

[View source]
def is_queued_for_deletion : Bool #

Checks if this node is queued for deletion


[View source]
def is_unique_name_in_owner : Bool #

[View source]
def local_groups : Set(String) #

[View source]
def move_child(child_node : Node, to_index : Int64) : Void #

[View source]
def multiplayer #

Property #multiplayer getter


[View source]
def name : String #

[View source]
def name=(val : String) #

[View source]
def node_as(type : T.class, path : String) : T forall T #

Shorthand for get_node_as


[View source]
def node_as?(type : T.class, path : String) : T | Nil forall T #

Shorthand for get_node_as?


[View source]
def notify_deferred_thread_group(what : Int64) : Void #

[View source]
def notify_thread_safe(what : Int64) : Void #

[View source]
def owner : Node | Nil #

Returns the scene owner node responsible for serialization packing.


[View source]
def owner=(o : Node | Nil) #

Sets the scene owner node for serialization packing.


[View source]
def physics_interpolation_mode #

Property #physics_interpolation_mode getter


[View source]
def physics_interpolation_mode=(val : Int) #

Property #physics_interpolation_mode setter


[View source]
def print_orphan_nodes : Void #

[View source]
def print_tree : Void #

[View source]
def print_tree_pretty : Void #

[View source]
def process_mode #

Property #process_mode getter


[View source]
def process_mode=(val : Int) #

Property #process_mode setter


[View source]
def process_physics_priority #

Property #process_physics_priority getter


[View source]
def process_physics_priority=(val : Int) #

Property #process_physics_priority setter


[View source]
def process_priority #

Property #process_priority getter


[View source]
def process_priority=(val : Int) #

Property #process_priority setter


[View source]
def process_thread_group #

Property #process_thread_group getter


[View source]
def process_thread_group=(val : Int) #

Property #process_thread_group setter


[View source]
def process_thread_group_order #

Property #process_thread_group_order getter


[View source]
def process_thread_group_order=(val : Int) #

Property #process_thread_group_order setter


[View source]
def process_thread_messages #

Property #process_thread_messages getter


[View source]
def process_thread_messages=(val : Int) #

Property #process_thread_messages setter


[View source]
def propagate_call(method : String, args : Godot::Array, parent_first : Bool) : Void #

[View source]
def propagate_notification(what : Int64) : Void #

[View source]
def queue_accessibility_update : Void #

[View source]
def queue_free : Void #

Queues this node for deletion at the end of the current frame


[View source]
def remove_child(node : Node) : Void #

Removes a child node from this node without freeing it


[View source]
def remove_from_group(group : String) : Void #

[View source]
def reparent(new_parent : Node, keep_global_transform : Bool = true) : Void #

Changes the parent of this Node to new_parent


[View source]
def replace_by(node : Node, keep_groups : Bool) : Void #

[View source]
def request_ready : Void #

[View source]
def reset_physics_interpolation : Void #

[View source]
def rpc_config(method : String, config : Pointer(Void)) : Void #

[View source]
def scene_file_path #

Property #scene_file_path getter


[View source]
def scene_file_path=(val) #

Property #scene_file_path setter


[View source]
def set_auto_translate_mode(mode : Int64) : Void #

[View source]
def set_deferred_thread_group(property : String, value : Pointer(Void)) : Void #

[View source]
def set_display_folded(fold : Bool) : Void #

[View source]
def set_editable_instance(node : Node, is_editable : Bool) : Void #

[View source]
def set_editor_description(editor_description : String) : Void #

[View source]
def set_multiplayer_authority(id : Int64, recursive : Bool) : Void #

[View source]
def set_name(name : String) : Void #

Sets the name of the node safely via dynamic reflection


[View source]
def set_owner(owner : Node) : Void #

[View source]
def set_physics_interpolation_mode(mode : Int64) : Void #

[View source]
def set_physics_process(enable : Bool) : Void #

[View source]
def set_physics_process_internal(enable : Bool) : Void #

[View source]
def set_physics_process_priority(priority : Int64) : Void #

[View source]
def set_process(enable : Bool) : Void #

[View source]
def set_process_input(enable : Bool) : Void #

[View source]
def set_process_internal(enable : Bool) : Void #

[View source]
def set_process_mode(mode : Int64) : Void #

[View source]
def set_process_priority(priority : Int64) : Void #

[View source]
def set_process_shortcut_input(enable : Bool) : Void #

[View source]
def set_process_thread_group(mode : Int64) : Void #

[View source]
def set_process_thread_group_order(order : Int64) : Void #

[View source]
def set_process_thread_messages(flags : Int64) : Void #

[View source]
def set_process_unhandled_input(enable : Bool) : Void #

[View source]
def set_process_unhandled_key_input(enable : Bool) : Void #

[View source]
def set_scene_file_path(scene_file_path : String) : Void #

[View source]
def set_scene_instance_load_placeholder(load_placeholder : Bool) : Void #

[View source]
def set_thread_safe(property : String, value : Pointer(Void)) : Void #

[View source]
def set_translation_domain_inherited : Void #

[View source]
def set_unique_name_in_owner(enable : Bool) : Void #

[View source]
def unique_name_in_owner #

Property #unique_name_in_owner getter


[View source]
def unique_name_in_owner=(val) #

Property #unique_name_in_owner setter


[View source]
def unique_name_in_owner? #

[View source]
def update_configuration_warnings : Void #

[View source]