godot/scene/main/node.cpp

/**************************************************************************/
/*  node.cpp                                                              */
/**************************************************************************/
/*                         This file is part of:                          */
/*                             GODOT ENGINE                               */
/*                        https://godotengine.org                         */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */
/*                                                                        */
/* Permission is hereby granted, free of charge, to any person obtaining  */
/* a copy of this software and associated documentation files (the        */
/* "Software"), to deal in the Software without restriction, including    */
/* without limitation the rights to use, copy, modify, merge, publish,    */
/* distribute, sublicense, and/or sell copies of the Software, and to     */
/* permit persons to whom the Software is furnished to do so, subject to  */
/* the following conditions:                                              */
/*                                                                        */
/* The above copyright notice and this permission notice shall be         */
/* included in all copies or substantial portions of the Software.        */
/*                                                                        */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
/**************************************************************************/

#include "node.h"

#include "core/config/project_settings.h"
#include "core/io/resource_loader.h"
#include "core/object/message_queue.h"
#include "core/object/script_language.h"
#include "core/string/print_string.h"
#include "instance_placeholder.h"
#include "scene/animation/tween.h"
#include "scene/debugger/scene_debugger.h"
#include "scene/main/multiplayer_api.h"
#include "scene/main/window.h"
#include "scene/resources/packed_scene.h"
#include "viewport.h"

#include <stdint.h>

int Node::orphan_node_count =;

thread_local Node *Node::current_process_thread_group =;

void Node::_notification(int p_notification) {}

void Node::_propagate_ready() {}

void Node::_propagate_enter_tree() {}

void Node::_propagate_after_exit_tree() {}

void Node::_propagate_exit_tree() {}

void Node::_propagate_physics_interpolated(bool p_interpolated) {}

void Node::_propagate_physics_interpolation_reset_requested(bool p_requested) {}

void Node::move_child(Node *p_child, int p_index) {}

void Node::_move_child(Node *p_child, int p_index, bool p_ignore_end) {}

void Node::_propagate_groups_dirty() {}

void Node::add_child_notify(Node *p_child) {}

void Node::remove_child_notify(Node *p_child) {}

void Node::move_child_notify(Node *p_child) {}

void Node::owner_changed_notify() {}

void Node::_physics_interpolated_changed() {}

void Node::set_physics_process(bool p_process) {}

bool Node::is_physics_processing() const {}

void Node::set_physics_process_internal(bool p_process_internal) {}

bool Node::is_physics_processing_internal() const {}

void Node::set_process_mode(ProcessMode p_mode) {}

void Node::_propagate_pause_notification(bool p_enable) {}

Node::ProcessMode Node::get_process_mode() const {}

void Node::_propagate_process_owner(Node *p_owner, int p_pause_notification, int p_enabled_notification) {}

void Node::set_multiplayer_authority(int p_peer_id, bool p_recursive) {}

int Node::get_multiplayer_authority() const {}

bool Node::is_multiplayer_authority() const {}

/***** RPC CONFIG ********/

void Node::rpc_config(const StringName &p_method, const Variant &p_config) {}

Variant Node::get_rpc_config() const {}

/***** RPC FUNCTIONS ********/

Error Node::_rpc_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error) {}

Error Node::_rpc_id_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error) {}

Error Node::rpcp(int p_peer_id, const StringName &p_method, const Variant **p_arg, int p_argcount) {}

Ref<MultiplayerAPI> Node::get_multiplayer() const {}

//////////// end of rpc

bool Node::can_process_notification(int p_what) const {}

bool Node::can_process() const {}

bool Node::_can_process(bool p_paused) const {}

void Node::set_physics_interpolation_mode(PhysicsInterpolationMode p_mode) {}

void Node::reset_physics_interpolation() {}

bool Node::_is_enabled() const {}

bool Node::is_enabled() const {}

double Node::get_physics_process_delta_time() const {}

double Node::get_process_delta_time() const {}

void Node::set_process(bool p_process) {}

bool Node::is_processing() const {}

void Node::set_process_internal(bool p_process_internal) {}

void Node::_add_process_group() {}

void Node::_remove_process_group() {}

void Node::_remove_from_process_thread_group() {}

void Node::_add_to_process_thread_group() {}

void Node::_remove_tree_from_process_thread_group() {}

void Node::_add_tree_to_process_thread_group(Node *p_owner) {}
bool Node::is_processing_internal() const {}

void Node::set_process_thread_group_order(int p_order) {}

int Node::get_process_thread_group_order() const {}

void Node::set_process_priority(int p_priority) {}

int Node::get_process_priority() const {}

void Node::set_physics_process_priority(int p_priority) {}

int Node::get_physics_process_priority() const {}

void Node::set_process_thread_group(ProcessThreadGroup p_mode) {}

Node::ProcessThreadGroup Node::get_process_thread_group() const {}

void Node::set_process_thread_messages(BitField<ProcessThreadMessages> p_flags) {}

BitField<Node::ProcessThreadMessages> Node::get_process_thread_messages() const {}

void Node::set_process_input(bool p_enable) {}

bool Node::is_processing_input() const {}

void Node::set_process_shortcut_input(bool p_enable) {}

bool Node::is_processing_shortcut_input() const {}

void Node::set_process_unhandled_input(bool p_enable) {}

bool Node::is_processing_unhandled_input() const {}

void Node::set_process_unhandled_key_input(bool p_enable) {}

bool Node::is_processing_unhandled_key_input() const {}

void Node::set_auto_translate_mode(AutoTranslateMode p_mode) {}

Node::AutoTranslateMode Node::get_auto_translate_mode() const {}

bool Node::can_auto_translate() const {}

StringName Node::get_translation_domain() const {}

void Node::set_translation_domain(const StringName &p_domain) {}

void Node::set_translation_domain_inherited() {}

void Node::_propagate_translation_domain_dirty() {}

StringName Node::get_name() const {}

void Node::_set_name_nocheck(const StringName &p_name) {}

void Node::set_name(const String &p_name) {}

// Returns a clear description of this node depending on what is available. Useful for error messages.
String Node::get_description() const {}

static SafeRefCount node_hrcr_count;

void Node::init_node_hrcr() {}

#ifdef TOOLS_ENABLED
String Node::validate_child_name(Node *p_child) {}

String Node::prevalidate_child_name(Node *p_child, StringName p_name) {}
#endif

String Node::adjust_name_casing(const String &p_name) {}

void Node::_validate_child_name(Node *p_child, bool p_force_human_readable) {}

// Return s + 1 as if it were an integer
String increase_numeric_string(const String &s) {}

void Node::_generate_serial_child_name(const Node *p_child, StringName &name) const {}

Node::InternalMode Node::get_internal_mode() const {}

void Node::_add_child_nocheck(Node *p_child, const StringName &p_name, InternalMode p_internal_mode) {}

void Node::add_child(Node *p_child, bool p_force_readable_name, InternalMode p_internal) {}

void Node::add_sibling(Node *p_sibling, bool p_force_readable_name) {}

void Node::remove_child(Node *p_child) {}

void Node::_update_children_cache_impl() const {}

int Node::get_child_count(bool p_include_internal) const {}

Node *Node::get_child(int p_index, bool p_include_internal) const {}

TypedArray<Node> Node::get_children(bool p_include_internal) const {}

Node *Node::_get_child_by_name(const StringName &p_name) const {}

Node *Node::get_node_or_null(const NodePath &p_path) const {}

Node *Node::get_node(const NodePath &p_path) const {}

bool Node::has_node(const NodePath &p_path) const {}

// Finds the first child node (in tree order) whose name matches the given pattern.
// Can be recursive or not, and limited to owned nodes.
Node *Node::find_child(const String &p_pattern, bool p_recursive, bool p_owned) const {}

// Finds child nodes based on their name using pattern matching, or class name,
// or both (either pattern or type can be left empty).
// Can be recursive or not, and limited to owned nodes.
TypedArray<Node> Node::find_children(const String &p_pattern, const String &p_type, bool p_recursive, bool p_owned) const {}

void Node::reparent(Node *p_parent, bool p_keep_global_transform) {}

Node *Node::get_parent() const {}

Node *Node::find_parent(const String &p_pattern) const {}

Window *Node::get_window() const {}

Window *Node::get_last_exclusive_window() const {}

bool Node::is_ancestor_of(const Node *p_node) const {}

bool Node::is_greater_than(const Node *p_node) const {}

void Node::get_owned_by(Node *p_by, List<Node *> *p_owned) {}

void Node::_set_owner_nocheck(Node *p_owner) {}

void Node::_release_unique_name_in_owner() {}

void Node::_acquire_unique_name_in_owner() {}

void Node::set_unique_name_in_owner(bool p_enabled) {}

bool Node::is_unique_name_in_owner() const {}

void Node::set_owner(Node *p_owner) {}

Node *Node::get_owner() const {}

void Node::_clean_up_owner() {}

Node *Node::find_common_parent_with(const Node *p_node) const {}

NodePath Node::get_path_to(const Node *p_node, bool p_use_unique_path) const {}

NodePath Node::get_path() const {}

bool Node::is_in_group(const StringName &p_identifier) const {}

void Node::add_to_group(const StringName &p_identifier, bool p_persistent) {}

void Node::remove_from_group(const StringName &p_identifier) {}

TypedArray<StringName> Node::_get_groups() const {}

void Node::get_groups(List<GroupInfo> *p_groups) const {}

int Node::get_persistent_group_count() const {}

void Node::print_tree_pretty() {}

void Node::print_tree() {}

String Node::_get_tree_string_pretty(const String &p_prefix, bool p_last) {}

String Node::get_tree_string_pretty() {}

String Node::_get_tree_string(const Node *p_node) {}

String Node::get_tree_string() {}

void Node::_propagate_reverse_notification(int p_notification) {}

void Node::_propagate_deferred_notification(int p_notification, bool p_reverse) {}

void Node::propagate_notification(int p_notification) {}

void Node::propagate_call(const StringName &p_method, const Array &p_args, const bool p_parent_first) {}

void Node::_propagate_replace_owner(Node *p_owner, Node *p_by_owner) {}

Ref<Tween> Node::create_tween() {}

void Node::set_scene_file_path(const String &p_scene_file_path) {}

String Node::get_scene_file_path() const {}

void Node::set_editor_description(const String &p_editor_description) {}

String Node::get_editor_description() const {}

void Node::set_editable_instance(Node *p_node, bool p_editable) {}

bool Node::is_editable_instance(const Node *p_node) const {}

Node *Node::get_deepest_editable_node(Node *p_start_node) const {}

#ifdef TOOLS_ENABLED
void Node::set_property_pinned(const String &p_property, bool p_pinned) {}

bool Node::is_property_pinned(const StringName &p_property) const {}

StringName Node::get_property_store_alias(const StringName &p_property) const {}

bool Node::is_part_of_edited_scene() const {}
#endif

void Node::get_storable_properties(HashSet<StringName> &r_storable_properties) const {}

String Node::to_string() {}

void Node::set_scene_instance_state(const Ref<SceneState> &p_state) {}

Ref<SceneState> Node::get_scene_instance_state() const {}

void Node::set_scene_inherited_state(const Ref<SceneState> &p_state) {}

Ref<SceneState> Node::get_scene_inherited_state() const {}

void Node::set_scene_instance_load_placeholder(bool p_enable) {}

bool Node::get_scene_instance_load_placeholder() const {}

Node *Node::_duplicate(int p_flags, HashMap<const Node *, Node *> *r_duplimap) const {}

Node *Node::duplicate(int p_flags) const {}

#ifdef TOOLS_ENABLED
Node *Node::duplicate_from_editor(HashMap<const Node *, Node *> &r_duplimap) const {}

Node *Node::duplicate_from_editor(HashMap<const Node *, Node *> &r_duplimap, const HashMap<Ref<Resource>, Ref<Resource>> &p_resource_remap) const {}

void Node::remap_node_resources(Node *p_node, const HashMap<Ref<Resource>, Ref<Resource>> &p_resource_remap) const {}

void Node::remap_nested_resources(Ref<Resource> p_resource, const HashMap<Ref<Resource>, Ref<Resource>> &p_resource_remap) const {}
#endif

// Duplicate node's properties.
// This has to be called after nodes have been duplicated since there might be properties
// of type Node that can be updated properly only if duplicated node tree is complete.
void Node::_duplicate_properties(const Node *p_root, const Node *p_original, Node *p_copy, int p_flags) const {}

// Duplication of signals must happen after all the node descendants have been copied,
// because re-targeting of connections from some descendant to another is not possible
// if the emitter node comes later in tree order than the receiver
void Node::_duplicate_signals(const Node *p_original, Node *p_copy) const {}

static void find_owned_by(Node *p_by, Node *p_node, List<Node *> *p_owned) {}

void Node::replace_by(Node *p_node, bool p_keep_groups) {}

void Node::_replace_connections_target(Node *p_new_target) {}

bool Node::has_node_and_resource(const NodePath &p_path) const {}

Array Node::_get_node_and_resource(const NodePath &p_path) {}

Node *Node::get_node_and_resource(const NodePath &p_path, Ref<Resource> &r_res, Vector<StringName> &r_leftover_subpath, bool p_last_is_property) const {}

void Node::_set_tree(SceneTree *p_tree) {}

#ifdef DEBUG_ENABLED
static HashMap<ObjectID, List<String>> _print_orphan_nodes_map;

static void _print_orphan_nodes_routine(Object *p_obj) {}
#endif // DEBUG_ENABLED

void Node::print_orphan_nodes() {}

void Node::queue_free() {}

void Node::set_import_path(const NodePath &p_import_path) {}

NodePath Node::get_import_path() const {}

#ifdef TOOLS_ENABLED
static void _add_nodes_to_options(const Node *p_base, const Node *p_node, List<String> *r_options) {}

void Node::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {}
#endif

void Node::clear_internal_tree_resource_paths() {}

PackedStringArray Node::get_configuration_warnings() const {}

void Node::update_configuration_warnings() {}

bool Node::is_owned_by_parent() const {}

void Node::set_display_folded(bool p_folded) {}

bool Node::is_displayed_folded() const {}

bool Node::is_ready() const {}

void Node::request_ready() {}

void Node::_call_input(const Ref<InputEvent> &p_event) {}

void Node::_call_shortcut_input(const Ref<InputEvent> &p_event) {}

void Node::_call_unhandled_input(const Ref<InputEvent> &p_event) {}

void Node::_call_unhandled_key_input(const Ref<InputEvent> &p_event) {}

void Node::_validate_property(PropertyInfo &p_property) const {}

void Node::input(const Ref<InputEvent> &p_event) {}

void Node::shortcut_input(const Ref<InputEvent> &p_key_event) {}

void Node::unhandled_input(const Ref<InputEvent> &p_event) {}

void Node::unhandled_key_input(const Ref<InputEvent> &p_key_event) {}

Variant Node::_call_deferred_thread_group_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error) {}

Variant Node::_call_thread_safe_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error) {}

void Node::call_deferred_thread_groupp(const StringName &p_method, const Variant **p_args, int p_argcount, bool p_show_error) {}
void Node::set_deferred_thread_group(const StringName &p_property, const Variant &p_value) {}
void Node::notify_deferred_thread_group(int p_notification) {}

void Node::call_thread_safep(const StringName &p_method, const Variant **p_args, int p_argcount, bool p_show_error) {}
void Node::set_thread_safe(const StringName &p_property, const Variant &p_value) {}
void Node::notify_thread_safe(int p_notification) {}

void Node::_bind_methods() {}

String Node::_get_name_num_separator() {}

Node::Node() {}

Node::~Node() {}

////////////////////////////////
// Multithreaded locked version of Object functions.

#ifdef DEBUG_ENABLED

void Node::set_script(const Variant &p_script) {}

Variant Node::get_script() const {}

bool Node::has_meta(const StringName &p_name) const {}

void Node::set_meta(const StringName &p_name, const Variant &p_value) {}

void Node::remove_meta(const StringName &p_name) {}

Variant Node::get_meta(const StringName &p_name, const Variant &p_default) const {}

void Node::get_meta_list(List<StringName> *p_list) const {}

Error Node::emit_signalp(const StringName &p_name, const Variant **p_args, int p_argcount) {}

bool Node::has_signal(const StringName &p_name) const {}

void Node::get_signal_list(List<MethodInfo> *p_signals) const {}

void Node::get_signal_connection_list(const StringName &p_signal, List<Connection> *p_connections) const {}

void Node::get_all_signal_connections(List<Connection> *p_connections) const {}

int Node::get_persistent_signal_connection_count() const {}

void Node::get_signals_connected_to_this(List<Connection> *p_connections) const {}

Error Node::connect(const StringName &p_signal, const Callable &p_callable, uint32_t p_flags) {}

void Node::disconnect(const StringName &p_signal, const Callable &p_callable) {}

bool Node::is_connected(const StringName &p_signal, const Callable &p_callable) const {}

bool Node::has_connections(const StringName &p_signal) const {}

#endif