| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "core/input/input_event.h" |
| 34 |
#include "core/io/resource.h" |
| 35 |
#include "core/string/node_path.h" |
| 36 |
#include "core/templates/iterable.h" |
| 37 |
#include "core/variant/typed_array.h" |
| 38 |
#include "scene/main/scene_tree.h" |
| 39 |
#include "scene/scene_string_names.h" |
| 40 |
|
| 41 |
class Viewport; |
| 42 |
class Window; |
| 43 |
class SceneState; |
| 44 |
class Tween; |
| 45 |
class PropertyTweener; |
| 46 |
|
| 47 |
SAFE_FLAG_TYPE_PUN_GUARANTEES |
| 48 |
SAFE_NUMERIC_TYPE_PUN_GUARANTEES(uint32_t) |
| 49 |
|
| 50 |
class Node : public Object { |
| 51 |
GDCLASS(Node, Object); |
| 52 |
|
| 53 |
protected: |
| 54 |
|
| 55 |
|
| 56 |
union MTFlag { |
| 57 |
SafeFlag mt; |
| 58 |
bool st; |
| 59 |
MTFlag() : |
| 60 |
mt{} {} |
| 61 |
}; |
| 62 |
template <typename T> |
| 63 |
union MTNumeric { |
| 64 |
SafeNumeric<T> mt; |
| 65 |
T st; |
| 66 |
MTNumeric() : |
| 67 |
mt{} {} |
| 68 |
}; |
| 69 |
|
| 70 |
public: |
| 71 |
static constexpr AncestralClass static_ancestral_class = AncestralClass::NODE; |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
enum ProcessMode : unsigned int { |
| 76 |
PROCESS_MODE_INHERIT, |
| 77 |
PROCESS_MODE_PAUSABLE, |
| 78 |
PROCESS_MODE_WHEN_PAUSED, |
| 79 |
PROCESS_MODE_ALWAYS, |
| 80 |
PROCESS_MODE_DISABLED, |
| 81 |
}; |
| 82 |
|
| 83 |
enum ProcessThreadGroup { |
| 84 |
PROCESS_THREAD_GROUP_INHERIT, |
| 85 |
PROCESS_THREAD_GROUP_MAIN_THREAD, |
| 86 |
PROCESS_THREAD_GROUP_SUB_THREAD, |
| 87 |
}; |
| 88 |
|
| 89 |
enum ProcessThreadMessages { |
| 90 |
FLAG_PROCESS_THREAD_MESSAGES = 1, |
| 91 |
FLAG_PROCESS_THREAD_MESSAGES_PHYSICS = 2, |
| 92 |
FLAG_PROCESS_THREAD_MESSAGES_ALL = 3, |
| 93 |
}; |
| 94 |
|
| 95 |
enum PhysicsInterpolationMode : unsigned int { |
| 96 |
PHYSICS_INTERPOLATION_MODE_INHERIT, |
| 97 |
PHYSICS_INTERPOLATION_MODE_ON, |
| 98 |
PHYSICS_INTERPOLATION_MODE_OFF, |
| 99 |
}; |
| 100 |
|
| 101 |
enum DuplicateFlags { |
| 102 |
DUPLICATE_SIGNALS = 1, |
| 103 |
DUPLICATE_GROUPS = 2, |
| 104 |
DUPLICATE_SCRIPTS = 4, |
| 105 |
DUPLICATE_USE_INSTANTIATION = 8, |
| 106 |
DUPLICATE_INTERNAL_STATE = 16, |
| 107 |
DUPLICATE_DEFAULT = DUPLICATE_SIGNALS | DUPLICATE_GROUPS | DUPLICATE_SCRIPTS | DUPLICATE_USE_INSTANTIATION, |
| 108 |
#ifdef TOOLS_ENABLED |
| 109 |
DUPLICATE_FROM_EDITOR = 32, |
| 110 |
#endif |
| 111 |
}; |
| 112 |
|
| 113 |
enum NameCasing { |
| 114 |
NAME_CASING_PASCAL_CASE, |
| 115 |
NAME_CASING_CAMEL_CASE, |
| 116 |
NAME_CASING_SNAKE_CASE, |
| 117 |
NAME_CASING_KEBAB_CASE, |
| 118 |
}; |
| 119 |
|
| 120 |
enum InternalMode { |
| 121 |
INTERNAL_MODE_DISABLED, |
| 122 |
INTERNAL_MODE_FRONT, |
| 123 |
INTERNAL_MODE_BACK, |
| 124 |
}; |
| 125 |
|
| 126 |
enum AutoTranslateMode : unsigned int { |
| 127 |
AUTO_TRANSLATE_MODE_INHERIT, |
| 128 |
AUTO_TRANSLATE_MODE_ALWAYS, |
| 129 |
AUTO_TRANSLATE_MODE_DISABLED, |
| 130 |
}; |
| 131 |
|
| 132 |
struct Comparator { |
| 133 |
bool operator()(const Node *p_a, const Node *p_b) const { return p_b->is_greater_than(p_a); } |
| 134 |
}; |
| 135 |
|
| 136 |
#ifdef DEBUG_ENABLED |
| 137 |
static SafeNumeric<uint64_t> total_node_count; |
| 138 |
#endif |
| 139 |
enum { |
| 140 |
UNIQUE_SCENE_ID_UNASSIGNED = 0 |
| 141 |
}; |
| 142 |
|
| 143 |
void _update_process(bool p_enable, bool p_for_children); |
| 144 |
|
| 145 |
struct ChildrenIterator { |
| 146 |
_FORCE_INLINE_ Node *&operator*() const { return *_ptr; } |
| 147 |
_FORCE_INLINE_ Node **operator->() const { return _ptr; } |
| 148 |
_FORCE_INLINE_ ChildrenIterator &operator++() { |
| 149 |
_ptr++; |
| 150 |
return *this; |
| 151 |
} |
| 152 |
_FORCE_INLINE_ ChildrenIterator &operator--() { |
| 153 |
_ptr--; |
| 154 |
return *this; |
| 155 |
} |
| 156 |
|
| 157 |
_FORCE_INLINE_ bool operator==(const ChildrenIterator &b) const { return _ptr == b._ptr; } |
| 158 |
_FORCE_INLINE_ bool operator!=(const ChildrenIterator &b) const { return _ptr != b._ptr; } |
| 159 |
|
| 160 |
ChildrenIterator(Node **p_ptr) { _ptr = p_ptr; } |
| 161 |
ChildrenIterator() {} |
| 162 |
ChildrenIterator(const ChildrenIterator &p_it) { _ptr = p_it._ptr; } |
| 163 |
|
| 164 |
private: |
| 165 |
Node **_ptr = nullptr; |
| 166 |
}; |
| 167 |
|
| 168 |
private: |
| 169 |
struct GroupData { |
| 170 |
bool persistent = false; |
| 171 |
SceneTree::Group *group = nullptr; |
| 172 |
}; |
| 173 |
|
| 174 |
struct ComparatorByIndex { |
| 175 |
bool operator()(const Node *p_left, const Node *p_right) const { |
| 176 |
static const uint32_t order[3] = { 1, 0, 2 }; |
| 177 |
uint32_t order_left = order[p_left->data.internal_mode]; |
| 178 |
uint32_t order_right = order[p_right->data.internal_mode]; |
| 179 |
if (order_left == order_right) { |
| 180 |
return p_left->data.index < p_right->data.index; |
| 181 |
} |
| 182 |
return order_left < order_right; |
| 183 |
} |
| 184 |
}; |
| 185 |
|
| 186 |
struct ComparatorWithPriority { |
| 187 |
bool operator()(const Node *p_a, const Node *p_b) const { return p_b->data.process_priority == p_a->data.process_priority ? p_b->is_greater_than(p_a) : p_b->data.process_priority > p_a->data.process_priority; } |
| 188 |
}; |
| 189 |
|
| 190 |
struct ComparatorWithPhysicsPriority { |
| 191 |
bool operator()(const Node *p_a, const Node *p_b) const { return p_b->data.physics_process_priority == p_a->data.physics_process_priority ? p_b->is_greater_than(p_a) : p_b->data.physics_process_priority > p_a->data.physics_process_priority; } |
| 192 |
}; |
| 193 |
|
| 194 |
|
| 195 |
struct Data { |
| 196 |
String scene_file_path; |
| 197 |
Ref<SceneState> instance_state; |
| 198 |
Ref<SceneState> inherited_state; |
| 199 |
|
| 200 |
Node *parent = nullptr; |
| 201 |
Node *owner = nullptr; |
| 202 |
HashMap<StringName, Node *> children; |
| 203 |
mutable bool children_cache_dirty = false; |
| 204 |
mutable LocalVector<Node *> children_cache; |
| 205 |
HashMap<StringName, Node *> owned_unique_nodes; |
| 206 |
bool unique_name_in_owner = false; |
| 207 |
InternalMode internal_mode = INTERNAL_MODE_DISABLED; |
| 208 |
mutable int internal_children_front_count_cache = 0; |
| 209 |
mutable int internal_children_back_count_cache = 0; |
| 210 |
mutable int external_children_count_cache = 0; |
| 211 |
mutable int index = -1; |
| 212 |
int32_t depth = -1; |
| 213 |
int blocked = 0; |
| 214 |
StringName name; |
| 215 |
SceneTree *tree = nullptr; |
| 216 |
|
| 217 |
String editor_description; |
| 218 |
|
| 219 |
Viewport *viewport = nullptr; |
| 220 |
|
| 221 |
mutable RID accessibility_element; |
| 222 |
|
| 223 |
HashMap<StringName, GroupData> grouped; |
| 224 |
List<Node *>::Element *OW = nullptr; |
| 225 |
List<Node *> owned; |
| 226 |
|
| 227 |
Node *process_owner = nullptr; |
| 228 |
ProcessThreadGroup process_thread_group = PROCESS_THREAD_GROUP_INHERIT; |
| 229 |
Node *process_thread_group_owner = nullptr; |
| 230 |
int process_thread_group_order = 0; |
| 231 |
BitField<ProcessThreadMessages> process_thread_messages = {}; |
| 232 |
void *process_group = nullptr; |
| 233 |
|
| 234 |
int multiplayer_authority = 1; |
| 235 |
Variant rpc_config; |
| 236 |
|
| 237 |
|
| 238 |
int process_priority = 0; |
| 239 |
int physics_process_priority = 0; |
| 240 |
|
| 241 |
|
| 242 |
ProcessMode process_mode : 3; |
| 243 |
PhysicsInterpolationMode physics_interpolation_mode : 2; |
| 244 |
AutoTranslateMode auto_translate_mode : 2; |
| 245 |
|
| 246 |
bool physics_process : 1; |
| 247 |
bool process : 1; |
| 248 |
|
| 249 |
bool physics_process_internal : 1; |
| 250 |
bool process_internal : 1; |
| 251 |
|
| 252 |
bool input : 1; |
| 253 |
bool shortcut_input : 1; |
| 254 |
bool unhandled_input : 1; |
| 255 |
bool unhandled_key_input : 1; |
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
bool physics_interpolated : 1; |
| 261 |
|
| 262 |
|
| 263 |
bool physics_interpolation_reset_requested : 1; |
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
bool physics_interpolated_client_side : 1; |
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
bool use_identity_transform : 1; |
| 276 |
|
| 277 |
bool use_placeholder : 1; |
| 278 |
|
| 279 |
bool display_folded : 1; |
| 280 |
bool editable_instance : 1; |
| 281 |
|
| 282 |
bool ready_notified : 1; |
| 283 |
bool ready_first : 1; |
| 284 |
|
| 285 |
mutable bool is_auto_translating : 1; |
| 286 |
mutable bool is_auto_translate_dirty : 1; |
| 287 |
|
| 288 |
mutable bool is_translation_domain_inherited : 1; |
| 289 |
mutable bool is_translation_domain_dirty : 1; |
| 290 |
|
| 291 |
int32_t unique_scene_id = UNIQUE_SCENE_ID_UNASSIGNED; |
| 292 |
|
| 293 |
mutable NodePath *path_cache = nullptr; |
| 294 |
|
| 295 |
} data; |
| 296 |
|
| 297 |
String _get_tree_string_pretty(const String &p_prefix, bool p_last); |
| 298 |
String _get_tree_string(const Node *p_node); |
| 299 |
|
| 300 |
Node *_get_child_by_name(const StringName &p_name) const; |
| 301 |
|
| 302 |
void _replace_connections_target(Node *p_new_target); |
| 303 |
|
| 304 |
void _validate_child_name(Node *p_child, bool p_force_human_readable = false); |
| 305 |
void _generate_serial_child_name(const Node *p_child, StringName &name) const; |
| 306 |
|
| 307 |
void _propagate_reverse_notification(int p_notification); |
| 308 |
void _propagate_deferred_notification(int p_notification, bool p_reverse); |
| 309 |
void _propagate_enter_tree(); |
| 310 |
void _propagate_ready(); |
| 311 |
void _propagate_exit_tree(); |
| 312 |
void _propagate_after_exit_tree(); |
| 313 |
void _propagate_physics_interpolated(bool p_interpolated); |
| 314 |
void _propagate_physics_interpolation_reset_requested(bool p_requested); |
| 315 |
void _propagate_process_owner(Node *p_owner, int p_pause_notification, int p_enabled_notification); |
| 316 |
void _propagate_groups_dirty(); |
| 317 |
void _propagate_translation_domain_dirty(); |
| 318 |
Array _get_node_and_resource(const NodePath &p_path); |
| 319 |
|
| 320 |
void _duplicate_scripts(const Node *p_original, Node *p_copy) const; |
| 321 |
void _duplicate_properties(const Node *p_root, const Node *p_original, Node *p_copy, int p_flags) const; |
| 322 |
void _duplicate_signals(const Node *p_original, Node *p_copy) const; |
| 323 |
Node *_duplicate(int p_flags, HashMap<const Node *, Node *> *r_duplimap = nullptr) const; |
| 324 |
|
| 325 |
TypedArray<StringName> _get_groups() const; |
| 326 |
|
| 327 |
Error _rpc_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error); |
| 328 |
Error _rpc_id_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error); |
| 329 |
|
| 330 |
friend class SceneTree; |
| 331 |
|
| 332 |
void _set_tree(SceneTree *p_tree); |
| 333 |
void _propagate_pause_notification(bool p_enable); |
| 334 |
void _propagate_suspend_notification(bool p_enable); |
| 335 |
|
| 336 |
_FORCE_INLINE_ bool _can_process(bool p_paused) const; |
| 337 |
_FORCE_INLINE_ bool _is_enabled() const; |
| 338 |
|
| 339 |
void _release_unique_name_in_owner(); |
| 340 |
void _acquire_unique_name_in_owner(); |
| 341 |
|
| 342 |
void _clean_up_owner(); |
| 343 |
|
| 344 |
_FORCE_INLINE_ void _update_children_cache() const { |
| 345 |
if (unlikely(data.children_cache_dirty)) { |
| 346 |
_update_children_cache_impl(); |
| 347 |
} |
| 348 |
} |
| 349 |
|
| 350 |
void _update_children_cache_impl() const; |
| 351 |
|
| 352 |
|
| 353 |
void _add_process_group(); |
| 354 |
void _remove_process_group(); |
| 355 |
void _add_to_process_thread_group(); |
| 356 |
void _remove_from_process_thread_group(); |
| 357 |
void _remove_tree_from_process_thread_group(); |
| 358 |
void _add_tree_to_process_thread_group(Node *p_owner); |
| 359 |
|
| 360 |
static thread_local Node *current_process_thread_group; |
| 361 |
|
| 362 |
Variant _call_deferred_thread_group_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error); |
| 363 |
Variant _call_thread_safe_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error); |
| 364 |
|
| 365 |
|
| 366 |
#ifdef TOOLS_ENABLED |
| 367 |
void _emit_editor_state_changed(); |
| 368 |
#else |
| 369 |
void _emit_editor_state_changed() {} |
| 370 |
#endif |
| 371 |
|
| 372 |
protected: |
| 373 |
void _block() { data.blocked++; } |
| 374 |
void _unblock() { data.blocked--; } |
| 375 |
|
| 376 |
void _notification(int p_notification); |
| 377 |
|
| 378 |
virtual void _physics_interpolated_changed(); |
| 379 |
|
| 380 |
virtual void add_child_notify(Node *p_child); |
| 381 |
virtual void remove_child_notify(Node *p_child); |
| 382 |
virtual void move_child_notify(Node *p_child); |
| 383 |
virtual void owner_changed_notify(); |
| 384 |
|
| 385 |
void _propagate_replace_owner(Node *p_owner, Node *p_by_owner); |
| 386 |
|
| 387 |
static void _bind_methods(); |
| 388 |
static String _get_name_num_separator(); |
| 389 |
|
| 390 |
friend class SceneState; |
| 391 |
|
| 392 |
void _add_child_nocheck(Node *p_child, const StringName &p_name, InternalMode p_internal_mode = INTERNAL_MODE_DISABLED); |
| 393 |
void _set_owner_nocheck(Node *p_owner); |
| 394 |
void _set_name_nocheck(const StringName &p_name); |
| 395 |
|
| 396 |
void _set_physics_interpolated_client_side(bool p_enable) { data.physics_interpolated_client_side = p_enable; } |
| 397 |
bool _is_physics_interpolated_client_side() const { return data.physics_interpolated_client_side; } |
| 398 |
|
| 399 |
void _set_physics_interpolation_reset_requested(bool p_enable) { data.physics_interpolation_reset_requested = p_enable; } |
| 400 |
bool _is_physics_interpolation_reset_requested() const { return data.physics_interpolation_reset_requested; } |
| 401 |
|
| 402 |
void _set_use_identity_transform(bool p_enable) { data.use_identity_transform = p_enable; } |
| 403 |
bool _is_using_identity_transform() const { return data.use_identity_transform; } |
| 404 |
int32_t _get_scene_tree_depth() const { return data.depth; } |
| 405 |
|
| 406 |
|
| 407 |
void _call_input(const Ref<InputEvent> &p_event); |
| 408 |
void _call_shortcut_input(const Ref<InputEvent> &p_event); |
| 409 |
void _call_unhandled_input(const Ref<InputEvent> &p_event); |
| 410 |
void _call_unhandled_key_input(const Ref<InputEvent> &p_event); |
| 411 |
|
| 412 |
void _validate_property(PropertyInfo &p_property) const; |
| 413 |
virtual String _to_string() override; |
| 414 |
|
| 415 |
Variant _get_node_rpc_config_bind() const { |
| 416 |
return get_node_rpc_config().duplicate(true); |
| 417 |
} |
| 418 |
|
| 419 |
protected: |
| 420 |
virtual bool _uses_signal_mutex() const override { return false; } |
| 421 |
|
| 422 |
virtual void input(const Ref<InputEvent> &p_event); |
| 423 |
virtual void shortcut_input(const Ref<InputEvent> &p_key_event); |
| 424 |
virtual void unhandled_input(const Ref<InputEvent> &p_event); |
| 425 |
virtual void unhandled_key_input(const Ref<InputEvent> &p_key_event); |
| 426 |
|
| 427 |
GDVIRTUAL1(_process, double) |
| 428 |
GDVIRTUAL1(_physics_process, double) |
| 429 |
GDVIRTUAL0(_enter_tree) |
| 430 |
GDVIRTUAL0(_exit_tree) |
| 431 |
GDVIRTUAL0(_ready) |
| 432 |
GDVIRTUAL0RC(Vector<String>, _get_accessibility_configuration_warnings) |
| 433 |
GDVIRTUAL0RC(Vector<String>, _get_configuration_warnings) |
| 434 |
|
| 435 |
GDVIRTUAL1(_input, RequiredParam<InputEvent>) |
| 436 |
GDVIRTUAL1(_shortcut_input, RequiredParam<InputEvent>) |
| 437 |
GDVIRTUAL1(_unhandled_input, RequiredParam<InputEvent>) |
| 438 |
GDVIRTUAL1(_unhandled_key_input, RequiredParam<InputEvent>) |
| 439 |
|
| 440 |
GDVIRTUAL0RC(RID, _get_focused_accessibility_element) |
| 441 |
|
| 442 |
#ifndef DISABLE_DEPRECATED |
| 443 |
void _set_name_bind_compat_76560(const String &p_name); |
| 444 |
Variant _get_rpc_config_bind_compat_106848() const; |
| 445 |
static void _bind_compatibility_methods(); |
| 446 |
#endif |
| 447 |
|
| 448 |
public: |
| 449 |
enum { |
| 450 |
|
| 451 |
NOTIFICATION_ENTER_TREE = 10, |
| 452 |
NOTIFICATION_EXIT_TREE = 11, |
| 453 |
NOTIFICATION_MOVED_IN_PARENT = 12, |
| 454 |
NOTIFICATION_READY = 13, |
| 455 |
NOTIFICATION_PAUSED = 14, |
| 456 |
NOTIFICATION_UNPAUSED = 15, |
| 457 |
NOTIFICATION_PHYSICS_PROCESS = 16, |
| 458 |
NOTIFICATION_PROCESS = 17, |
| 459 |
NOTIFICATION_PARENTED = 18, |
| 460 |
NOTIFICATION_UNPARENTED = 19, |
| 461 |
NOTIFICATION_SCENE_INSTANTIATED = 20, |
| 462 |
NOTIFICATION_DRAG_BEGIN = 21, |
| 463 |
NOTIFICATION_DRAG_END = 22, |
| 464 |
NOTIFICATION_PATH_RENAMED = 23, |
| 465 |
NOTIFICATION_CHILD_ORDER_CHANGED = 24, |
| 466 |
NOTIFICATION_INTERNAL_PROCESS = 25, |
| 467 |
NOTIFICATION_INTERNAL_PHYSICS_PROCESS = 26, |
| 468 |
NOTIFICATION_POST_ENTER_TREE = 27, |
| 469 |
NOTIFICATION_DISABLED = 28, |
| 470 |
NOTIFICATION_ENABLED = 29, |
| 471 |
NOTIFICATION_RESET_PHYSICS_INTERPOLATION = 2001, |
| 472 |
|
| 473 |
|
| 474 |
NOTIFICATION_ACCESSIBILITY_UPDATE = 3000, |
| 475 |
NOTIFICATION_ACCESSIBILITY_INVALIDATE = 3001, |
| 476 |
|
| 477 |
NOTIFICATION_WM_MOUSE_ENTER = 1002, |
| 478 |
NOTIFICATION_WM_MOUSE_EXIT = 1003, |
| 479 |
NOTIFICATION_WM_WINDOW_FOCUS_IN = 1004, |
| 480 |
NOTIFICATION_WM_WINDOW_FOCUS_OUT = 1005, |
| 481 |
NOTIFICATION_WM_CLOSE_REQUEST = 1006, |
| 482 |
NOTIFICATION_WM_GO_BACK_REQUEST = 1007, |
| 483 |
NOTIFICATION_WM_SIZE_CHANGED = 1008, |
| 484 |
NOTIFICATION_WM_DPI_CHANGE = 1009, |
| 485 |
NOTIFICATION_VP_MOUSE_ENTER = 1010, |
| 486 |
NOTIFICATION_VP_MOUSE_EXIT = 1011, |
| 487 |
NOTIFICATION_WM_POSITION_CHANGED = 1012, |
| 488 |
|
| 489 |
NOTIFICATION_OS_MEMORY_WARNING = MainLoop::NOTIFICATION_OS_MEMORY_WARNING, |
| 490 |
NOTIFICATION_TRANSLATION_CHANGED = MainLoop::NOTIFICATION_TRANSLATION_CHANGED, |
| 491 |
NOTIFICATION_WM_ABOUT = MainLoop::NOTIFICATION_WM_ABOUT, |
| 492 |
NOTIFICATION_CRASH = MainLoop::NOTIFICATION_CRASH, |
| 493 |
NOTIFICATION_OS_IME_UPDATE = MainLoop::NOTIFICATION_OS_IME_UPDATE, |
| 494 |
NOTIFICATION_APPLICATION_RESUMED = MainLoop::NOTIFICATION_APPLICATION_RESUMED, |
| 495 |
NOTIFICATION_APPLICATION_PAUSED = MainLoop::NOTIFICATION_APPLICATION_PAUSED, |
| 496 |
NOTIFICATION_APPLICATION_FOCUS_IN = MainLoop::NOTIFICATION_APPLICATION_FOCUS_IN, |
| 497 |
NOTIFICATION_APPLICATION_FOCUS_OUT = MainLoop::NOTIFICATION_APPLICATION_FOCUS_OUT, |
| 498 |
NOTIFICATION_TEXT_SERVER_CHANGED = MainLoop::NOTIFICATION_TEXT_SERVER_CHANGED, |
| 499 |
|
| 500 |
|
| 501 |
NOTIFICATION_EDITOR_PRE_SAVE = 9001, |
| 502 |
NOTIFICATION_EDITOR_POST_SAVE = 9002, |
| 503 |
NOTIFICATION_SUSPENDED = 9003, |
| 504 |
NOTIFICATION_UNSUSPENDED = 9004 |
| 505 |
}; |
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
StringName get_name() const; |
| 510 |
String get_description() const; |
| 511 |
void set_name(const StringName &p_name); |
| 512 |
|
| 513 |
InternalMode get_internal_mode() const; |
| 514 |
|
| 515 |
void add_child(RequiredParam<Node> rp_child, bool p_force_readable_name = false, InternalMode p_internal = INTERNAL_MODE_DISABLED); |
| 516 |
void add_sibling(RequiredParam<Node> rp_sibling, bool p_force_readable_name = false); |
| 517 |
void remove_child(RequiredParam<Node> rp_child); |
| 518 |
|
| 519 |
|
| 520 |
|
| 521 |
|
| 522 |
|
| 523 |
template <bool p_include_internal = true> |
| 524 |
Iterable<ChildrenIterator> iterate_children() const; |
| 525 |
|
| 526 |
int get_child_count(bool p_include_internal = true) const; |
| 527 |
Node *get_child(int p_index, bool p_include_internal = true) const; |
| 528 |
TypedArray<Node> get_children(bool p_include_internal = true) const; |
| 529 |
bool has_node(const NodePath &p_path) const; |
| 530 |
Node *get_node(const NodePath &p_path) const; |
| 531 |
Node *get_node_or_null(const NodePath &p_path) const; |
| 532 |
Node *find_child(const String &p_pattern, bool p_recursive = true, bool p_owned = true) const; |
| 533 |
TypedArray<Node> find_children(const String &p_pattern, const String &p_type = "", bool p_recursive = true, bool p_owned = true) const; |
| 534 |
bool has_node_and_resource(const NodePath &p_path) const; |
| 535 |
Node *get_node_and_resource(const NodePath &p_path, Ref<Resource> &r_res, Vector<StringName> &r_leftover_subpath, bool p_last_is_property = true) const; |
| 536 |
|
| 537 |
virtual void reparent(RequiredParam<Node> rp_parent, bool p_keep_global_transform = true); |
| 538 |
Node *get_parent() const; |
| 539 |
Node *find_parent(const String &p_pattern) const; |
| 540 |
|
| 541 |
void set_unique_scene_id(int32_t p_unique_id); |
| 542 |
int32_t get_unique_scene_id() const; |
| 543 |
|
| 544 |
Window *get_window() const; |
| 545 |
Window *get_non_popup_window() const; |
| 546 |
Window *get_last_exclusive_window() const; |
| 547 |
|
| 548 |
_FORCE_INLINE_ SceneTree *get_tree() const { |
| 549 |
ERR_FAIL_NULL_V(data.tree, nullptr); |
| 550 |
return data.tree; |
| 551 |
} |
| 552 |
|
| 553 |
_FORCE_INLINE_ bool is_inside_tree() const { return data.tree; } |
| 554 |
bool is_internal() const { return data.internal_mode != INTERNAL_MODE_DISABLED; } |
| 555 |
|
| 556 |
bool is_ancestor_of(RequiredParam<const Node> rp_node) const; |
| 557 |
bool is_greater_than(RequiredParam<const Node> rp_node) const; |
| 558 |
|
| 559 |
NodePath get_path() const; |
| 560 |
NodePath get_path_to(RequiredParam<const Node> rp_node, bool p_use_unique_path = false) const; |
| 561 |
Node *find_common_parent_with(const Node *p_node) const; |
| 562 |
|
| 563 |
void add_to_group(const StringName &p_identifier, bool p_persistent = false); |
| 564 |
void remove_from_group(const StringName &p_identifier); |
| 565 |
bool is_in_group(const StringName &p_identifier) const; |
| 566 |
|
| 567 |
struct GroupInfo { |
| 568 |
StringName name; |
| 569 |
bool persistent = false; |
| 570 |
}; |
| 571 |
|
| 572 |
void get_groups(List<GroupInfo> *p_groups) const; |
| 573 |
int get_persistent_group_count() const; |
| 574 |
|
| 575 |
void move_child(RequiredParam<Node> rp_child, int p_index); |
| 576 |
void _move_child(Node *p_child, int p_index, bool p_ignore_end = false); |
| 577 |
|
| 578 |
void set_owner(Node *p_owner); |
| 579 |
Node *get_owner() const; |
| 580 |
void get_owned_by(Node *p_by, List<Node *> *p_owned); |
| 581 |
|
| 582 |
void set_unique_name_in_owner(bool p_enabled); |
| 583 |
bool is_unique_name_in_owner() const; |
| 584 |
|
| 585 |
_FORCE_INLINE_ int get_index(bool p_include_internal = true) const { |
| 586 |
|
| 587 |
ERR_FAIL_COND_V_MSG(!p_include_internal && data.internal_mode != INTERNAL_MODE_DISABLED, -1, "Node is internal. Can't get index with 'include_internal' being false."); |
| 588 |
if (!data.parent) { |
| 589 |
return data.index; |
| 590 |
} |
| 591 |
data.parent->_update_children_cache(); |
| 592 |
|
| 593 |
if (!p_include_internal) { |
| 594 |
return data.index; |
| 595 |
} else { |
| 596 |
switch (data.internal_mode) { |
| 597 |
case INTERNAL_MODE_DISABLED: { |
| 598 |
return data.parent->data.internal_children_front_count_cache + data.index; |
| 599 |
} break; |
| 600 |
case INTERNAL_MODE_FRONT: { |
| 601 |
return data.index; |
| 602 |
} break; |
| 603 |
case INTERNAL_MODE_BACK: { |
| 604 |
return data.parent->data.internal_children_front_count_cache + data.parent->data.external_children_count_cache + data.index; |
| 605 |
} break; |
| 606 |
} |
| 607 |
return -1; |
| 608 |
} |
| 609 |
} |
| 610 |
|
| 611 |
RequiredResult<Tween> create_tween(); |
| 612 |
|
| 613 |
void print_tree(); |
| 614 |
void print_tree_pretty(); |
| 615 |
String get_tree_string(); |
| 616 |
String get_tree_string_pretty(); |
| 617 |
|
| 618 |
void set_scene_file_path(const String &p_scene_file_path); |
| 619 |
String get_scene_file_path() const; |
| 620 |
|
| 621 |
void set_editor_description(const String &p_editor_description); |
| 622 |
String get_editor_description() const; |
| 623 |
|
| 624 |
void set_editable_instance(RequiredParam<Node> rp_node, bool p_editable); |
| 625 |
bool is_editable_instance(const Node *p_node) const; |
| 626 |
Node *get_deepest_editable_node(Node *p_start_node) const; |
| 627 |
|
| 628 |
#ifdef TOOLS_ENABLED |
| 629 |
void set_property_pinned(const String &p_property, bool p_pinned); |
| 630 |
bool is_property_pinned(const StringName &p_property) const; |
| 631 |
virtual StringName get_property_store_alias(const StringName &p_property) const; |
| 632 |
bool is_part_of_edited_scene() const; |
| 633 |
#else |
| 634 |
bool is_part_of_edited_scene() const { return false; } |
| 635 |
#endif |
| 636 |
void get_storable_properties(HashSet<StringName> &r_storable_properties) const; |
| 637 |
|
| 638 |
|
| 639 |
|
| 640 |
void propagate_notification(int p_notification); |
| 641 |
|
| 642 |
void propagate_call(const StringName &p_method, const Array &p_args = Array(), const bool p_parent_first = false); |
| 643 |
|
| 644 |
|
| 645 |
|
| 646 |
void set_physics_process(bool p_process); |
| 647 |
double get_physics_process_delta_time() const; |
| 648 |
bool is_physics_processing() const; |
| 649 |
|
| 650 |
void set_process(bool p_process); |
| 651 |
double get_process_delta_time() const; |
| 652 |
bool is_processing() const; |
| 653 |
|
| 654 |
void set_physics_process_internal(bool p_process_internal); |
| 655 |
bool is_physics_processing_internal() const; |
| 656 |
|
| 657 |
void set_process_internal(bool p_process_internal); |
| 658 |
bool is_processing_internal() const; |
| 659 |
|
| 660 |
void set_process_priority(int p_priority); |
| 661 |
int get_process_priority() const; |
| 662 |
|
| 663 |
void set_process_thread_group_order(int p_order); |
| 664 |
int get_process_thread_group_order() const; |
| 665 |
|
| 666 |
void set_physics_process_priority(int p_priority); |
| 667 |
int get_physics_process_priority() const; |
| 668 |
|
| 669 |
void set_process_input(bool p_enable); |
| 670 |
bool is_processing_input() const; |
| 671 |
|
| 672 |
void set_process_shortcut_input(bool p_enable); |
| 673 |
bool is_processing_shortcut_input() const; |
| 674 |
|
| 675 |
void set_process_unhandled_input(bool p_enable); |
| 676 |
bool is_processing_unhandled_input() const; |
| 677 |
|
| 678 |
void set_process_unhandled_key_input(bool p_enable); |
| 679 |
bool is_processing_unhandled_key_input() const; |
| 680 |
|
| 681 |
_FORCE_INLINE_ bool _is_any_processing() const { |
| 682 |
return data.process || data.process_internal || data.physics_process || data.physics_process_internal; |
| 683 |
} |
| 684 |
_FORCE_INLINE_ bool is_accessible_from_caller_thread() const { |
| 685 |
if (current_process_thread_group == nullptr) { |
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
return !data.tree || is_current_thread_safe_for_nodes(); |
| 690 |
} else { |
| 691 |
|
| 692 |
return current_process_thread_group == data.process_thread_group_owner; |
| 693 |
} |
| 694 |
} |
| 695 |
|
| 696 |
_FORCE_INLINE_ bool is_readable_from_caller_thread() const { |
| 697 |
if (current_process_thread_group == nullptr) { |
| 698 |
|
| 699 |
|
| 700 |
|
| 701 |
return is_current_thread_safe_for_nodes() || unlikely(!data.tree); |
| 702 |
} else { |
| 703 |
|
| 704 |
return true; |
| 705 |
} |
| 706 |
} |
| 707 |
|
| 708 |
_FORCE_INLINE_ static bool is_group_processing() { return current_process_thread_group; } |
| 709 |
|
| 710 |
void set_process_thread_messages(BitField<ProcessThreadMessages> p_flags); |
| 711 |
BitField<ProcessThreadMessages> get_process_thread_messages() const; |
| 712 |
|
| 713 |
void queue_accessibility_update(); |
| 714 |
|
| 715 |
virtual RID get_accessibility_element() const; |
| 716 |
virtual RID get_focused_accessibility_element() const; |
| 717 |
virtual bool accessibility_override_tree_hierarchy() const { return false; } |
| 718 |
|
| 719 |
virtual PackedStringArray get_accessibility_configuration_warnings() const; |
| 720 |
|
| 721 |
Node *duplicate(int p_flags = DUPLICATE_GROUPS | DUPLICATE_SIGNALS | DUPLICATE_SCRIPTS) const; |
| 722 |
#ifdef TOOLS_ENABLED |
| 723 |
Node *duplicate_from_editor(HashMap<const Node *, Node *> &r_duplimap) const; |
| 724 |
Node *duplicate_from_editor(HashMap<const Node *, Node *> &r_duplimap, Node *p_scene_root, HashMap<Node *, HashMap<Ref<Resource>, Ref<Resource>>> &p_resource_remap) const; |
| 725 |
void remap_node_resources(Node *p_node, Node *p_scene_root, HashMap<Node *, HashMap<Ref<Resource>, Ref<Resource>>> &p_resource_remap) const; |
| 726 |
void remap_nested_resources(Ref<Resource> p_resource, HashMap<Ref<Resource>, Ref<Resource>> &p_resource_remap) const; |
| 727 |
#endif |
| 728 |
|
| 729 |
|
| 730 |
void set_scene_instance_state(const Ref<SceneState> &p_state); |
| 731 |
Ref<SceneState> get_scene_instance_state() const; |
| 732 |
|
| 733 |
void set_scene_inherited_state(const Ref<SceneState> &p_state); |
| 734 |
Ref<SceneState> get_scene_inherited_state() const; |
| 735 |
|
| 736 |
void set_scene_instance_load_placeholder(bool p_enable); |
| 737 |
bool get_scene_instance_load_placeholder() const; |
| 738 |
|
| 739 |
template <typename... VarArgs> |
| 740 |
Vector<Variant> make_binds(VarArgs... p_args) { |
| 741 |
Vector<Variant> binds = { p_args... }; |
| 742 |
return binds; |
| 743 |
} |
| 744 |
|
| 745 |
void replace_by(RequiredParam<Node> rp_node, bool p_keep_groups = false); |
| 746 |
|
| 747 |
void set_process_mode(ProcessMode p_mode); |
| 748 |
ProcessMode get_process_mode() const; |
| 749 |
bool can_process() const; |
| 750 |
bool can_process_notification(int p_what) const; |
| 751 |
|
| 752 |
void set_physics_interpolation_mode(PhysicsInterpolationMode p_mode); |
| 753 |
PhysicsInterpolationMode get_physics_interpolation_mode() const { return data.physics_interpolation_mode; } |
| 754 |
_FORCE_INLINE_ bool is_physics_interpolated() const { return data.physics_interpolated; } |
| 755 |
_FORCE_INLINE_ bool is_physics_interpolated_and_enabled() const { return SceneTree::is_fti_enabled() && is_physics_interpolated(); } |
| 756 |
void reset_physics_interpolation(); |
| 757 |
|
| 758 |
bool is_enabled() const; |
| 759 |
bool is_ready() const; |
| 760 |
|
| 761 |
void request_ready(); |
| 762 |
|
| 763 |
void set_process_thread_group(ProcessThreadGroup p_mode); |
| 764 |
ProcessThreadGroup get_process_thread_group() const; |
| 765 |
|
| 766 |
static void print_orphan_nodes(); |
| 767 |
static TypedArray<int> get_orphan_node_ids(); |
| 768 |
|
| 769 |
#ifdef TOOLS_ENABLED |
| 770 |
String validate_child_name(Node *p_child); |
| 771 |
String prevalidate_child_name(Node *p_child, StringName p_name); |
| 772 |
void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const override; |
| 773 |
#endif |
| 774 |
static String adjust_name_casing(const String &p_name); |
| 775 |
|
| 776 |
void queue_free(); |
| 777 |
|
| 778 |
|
| 779 |
static void init_node_hrcr(); |
| 780 |
|
| 781 |
bool is_owned_by_parent() const; |
| 782 |
|
| 783 |
void clear_internal_tree_resource_paths(); |
| 784 |
|
| 785 |
_FORCE_INLINE_ Viewport *get_viewport() const { return data.viewport; } |
| 786 |
|
| 787 |
virtual PackedStringArray get_configuration_warnings() const; |
| 788 |
|
| 789 |
void update_configuration_warnings(); |
| 790 |
|
| 791 |
void set_display_folded(bool p_folded); |
| 792 |
bool is_displayed_folded() const; |
| 793 |
|
| 794 |
|
| 795 |
|
| 796 |
virtual void set_multiplayer_authority(int p_peer_id, bool p_recursive = true); |
| 797 |
int get_multiplayer_authority() const; |
| 798 |
bool is_multiplayer_authority() const; |
| 799 |
|
| 800 |
void rpc_config(const StringName &p_method, const Variant &p_config); |
| 801 |
const Variant get_node_rpc_config() const; |
| 802 |
|
| 803 |
template <typename... VarArgs> |
| 804 |
Error rpc(const StringName &p_method, VarArgs... p_args); |
| 805 |
|
| 806 |
template <typename... VarArgs> |
| 807 |
Error rpc_id(int p_peer_id, const StringName &p_method, VarArgs... p_args); |
| 808 |
|
| 809 |
Error rpcp(int p_peer_id, const StringName &p_method, const Variant **p_arg, int p_argcount); |
| 810 |
|
| 811 |
Ref<MultiplayerAPI> get_multiplayer() const; |
| 812 |
|
| 813 |
|
| 814 |
|
| 815 |
void set_auto_translate_mode(AutoTranslateMode p_mode); |
| 816 |
AutoTranslateMode get_auto_translate_mode() const; |
| 817 |
bool can_auto_translate() const; |
| 818 |
|
| 819 |
virtual StringName get_translation_domain() const override; |
| 820 |
virtual void set_translation_domain(const StringName &p_domain) override; |
| 821 |
void set_translation_domain_inherited(); |
| 822 |
|
| 823 |
_FORCE_INLINE_ String atr(const String &p_message, const StringName &p_context = "") const { return can_auto_translate() ? tr(p_message, p_context) : p_message; } |
| 824 |
_FORCE_INLINE_ String atr_n(const String &p_message, const StringName &p_message_plural, int p_n, const StringName &p_context = "") const { |
| 825 |
if (can_auto_translate()) { |
| 826 |
return tr_n(p_message, p_message_plural, p_n, p_context); |
| 827 |
} |
| 828 |
return p_n == 1 ? p_message : String(p_message_plural); |
| 829 |
} |
| 830 |
|
| 831 |
|
| 832 |
|
| 833 |
void call_deferred_thread_groupp(const StringName &p_method, const Variant **p_args, int p_argcount, bool p_show_error = false); |
| 834 |
template <typename... VarArgs> |
| 835 |
void call_deferred_thread_group(const StringName &p_method, VarArgs... p_args) { |
| 836 |
Variant args[sizeof...(p_args) + 1] = { p_args..., Variant() }; |
| 837 |
const Variant *argptrs[sizeof...(p_args) + 1]; |
| 838 |
for (uint32_t i = 0; i < sizeof...(p_args); i++) { |
| 839 |
argptrs[i] = &args[i]; |
| 840 |
} |
| 841 |
call_deferred_thread_groupp(p_method, sizeof...(p_args) == 0 ? nullptr : (const Variant **)argptrs, sizeof...(p_args)); |
| 842 |
} |
| 843 |
void set_deferred_thread_group(const StringName &p_property, const Variant &p_value); |
| 844 |
void notify_deferred_thread_group(int p_notification); |
| 845 |
|
| 846 |
void call_thread_safep(const StringName &p_method, const Variant **p_args, int p_argcount, bool p_show_error = false); |
| 847 |
template <typename... VarArgs> |
| 848 |
void call_thread_safe(const StringName &p_method, VarArgs... p_args) { |
| 849 |
Variant args[sizeof...(p_args) + 1] = { p_args..., Variant() }; |
| 850 |
const Variant *argptrs[sizeof...(p_args) + 1]; |
| 851 |
for (uint32_t i = 0; i < sizeof...(p_args); i++) { |
| 852 |
argptrs[i] = &args[i]; |
| 853 |
} |
| 854 |
call_deferred_thread_groupp(p_method, sizeof...(p_args) == 0 ? nullptr : (const Variant **)argptrs, sizeof...(p_args)); |
| 855 |
} |
| 856 |
void set_thread_safe(const StringName &p_property, const Variant &p_value); |
| 857 |
void notify_thread_safe(int p_notification); |
| 858 |
|
| 859 |
|
| 860 |
|
| 861 |
bool is_instance() const { return !data.scene_file_path.is_empty(); } |
| 862 |
|
| 863 |
|
| 864 |
#ifdef DEBUG_ENABLED |
| 865 |
|
| 866 |
virtual void set_script(const Variant &p_script) override; |
| 867 |
virtual Variant get_script() const override; |
| 868 |
|
| 869 |
virtual bool has_meta(const StringName &p_name) const override; |
| 870 |
virtual void set_meta(const StringName &p_name, const Variant &p_value) override; |
| 871 |
virtual void remove_meta(const StringName &p_name) override; |
| 872 |
virtual Variant get_meta(const StringName &p_name, const Variant &p_default = Variant()) const override; |
| 873 |
virtual void get_meta_list(List<StringName> *p_list) const override; |
| 874 |
|
| 875 |
virtual Error emit_signalp(const StringName &p_name, const Variant **p_args, int p_argcount) override; |
| 876 |
virtual bool has_signal(const StringName &p_name) const override; |
| 877 |
virtual void get_signal_list(List<MethodInfo> *p_signals) const override; |
| 878 |
virtual void get_signal_connection_list(const StringName &p_signal, List<Connection> *p_connections) const override; |
| 879 |
virtual void get_all_signal_connections(List<Connection> *p_connections) const override; |
| 880 |
virtual int get_persistent_signal_connection_count() const override; |
| 881 |
virtual uint32_t get_signal_connection_flags(const StringName &p_name, const Callable &p_callable) const override; |
| 882 |
virtual void get_signals_connected_to_this(List<Connection> *p_connections) const override; |
| 883 |
|
| 884 |
virtual Error connect(const StringName &p_signal, const Callable &p_callable, uint32_t p_flags = 0) override; |
| 885 |
virtual void disconnect(const StringName &p_signal, const Callable &p_callable) override; |
| 886 |
virtual bool is_connected(const StringName &p_signal, const Callable &p_callable) const override; |
| 887 |
virtual bool has_connections(const StringName &p_signal) const override; |
| 888 |
#endif |
| 889 |
Node(); |
| 890 |
~Node(); |
| 891 |
}; |
| 892 |
|
| 893 |
VARIANT_ENUM_CAST(Node::DuplicateFlags); |
| 894 |
VARIANT_ENUM_CAST(Node::ProcessMode); |
| 895 |
VARIANT_ENUM_CAST(Node::ProcessThreadGroup); |
| 896 |
VARIANT_BITFIELD_CAST(Node::ProcessThreadMessages); |
| 897 |
VARIANT_ENUM_CAST(Node::InternalMode); |
| 898 |
VARIANT_ENUM_CAST(Node::PhysicsInterpolationMode); |
| 899 |
VARIANT_ENUM_CAST(Node::AutoTranslateMode); |
| 900 |
|
| 901 |
typedef HashSet<Node *, Node::Comparator> NodeSet; |
| 902 |
|
| 903 |
|
| 904 |
|
| 905 |
|
| 906 |
template <typename... VarArgs> |
| 907 |
Error Node::rpc(const StringName &p_method, VarArgs... p_args) { |
| 908 |
return rpc_id(0, p_method, p_args...); |
| 909 |
} |
| 910 |
|
| 911 |
template <typename... VarArgs> |
| 912 |
Error Node::rpc_id(int p_peer_id, const StringName &p_method, VarArgs... p_args) { |
| 913 |
Variant args[sizeof...(p_args) + 1] = { p_args..., Variant() }; |
| 914 |
const Variant *argptrs[sizeof...(p_args) + 1]; |
| 915 |
for (uint32_t i = 0; i < sizeof...(p_args); i++) { |
| 916 |
argptrs[i] = &args[i]; |
| 917 |
} |
| 918 |
return rpcp(p_peer_id, p_method, sizeof...(p_args) == 0 ? nullptr : (const Variant **)argptrs, sizeof...(p_args)); |
| 919 |
} |
| 920 |
|
| 921 |
#ifdef DEBUG_ENABLED |
| 922 |
#define ERR_THREAD_GUARD ERR_FAIL_COND_MSG(!is_accessible_from_caller_thread(), vformat("%s: The caller thread can't call the function `%s()` on this node. Use `call_deferred()` or `call_deferred_thread_group()` instead.", get_description(), FUNCTION_STR)); |
| 923 |
#define ERR_THREAD_GUARD_V(m_ret) ERR_FAIL_COND_V_MSG(!is_accessible_from_caller_thread(), (m_ret), vformat("%s: The caller thread can't call the function `%s()` on this node. Use `call_deferred()` or `call_deferred_thread_group()` instead.", get_description(), FUNCTION_STR)); |
| 924 |
#define ERR_MAIN_THREAD_GUARD ERR_FAIL_COND_MSG(is_inside_tree() && !is_current_thread_safe_for_nodes(), vformat("%s: The function `%s()` on this node can only be accessed from the main thread. Use `call_deferred()` instead.", get_description(), FUNCTION_STR)); |
| 925 |
#define ERR_MAIN_THREAD_GUARD_V(m_ret) ERR_FAIL_COND_V_MSG(is_inside_tree() && !is_current_thread_safe_for_nodes(), (m_ret), vformat("%s: The function `%s()` on this node can only be accessed from the main thread. Use `call_deferred()` instead.", get_description(), FUNCTION_STR)); |
| 926 |
#define ERR_READ_THREAD_GUARD ERR_FAIL_COND_MSG(!is_readable_from_caller_thread(), vformat("%s: The function `%s()` on this node can only be accessed from either the main thread or a thread group. Use `call_deferred()` instead.", get_description(), FUNCTION_STR)); |
| 927 |
#define ERR_READ_THREAD_GUARD_V(m_ret) ERR_FAIL_COND_V_MSG(!is_readable_from_caller_thread(), (m_ret), vformat("%s: The function `%s()` on this node can only be accessed from either the main thread or a thread group. Use `call_deferred()` instead.", get_description(), FUNCTION_STR)); |
| 928 |
#else |
| 929 |
#define ERR_THREAD_GUARD |
| 930 |
#define ERR_THREAD_GUARD_V(m_ret) |
| 931 |
#define ERR_MAIN_THREAD_GUARD |
| 932 |
#define ERR_MAIN_THREAD_GUARD_V(m_ret) |
| 933 |
#define ERR_READ_THREAD_GUARD |
| 934 |
#define ERR_READ_THREAD_GUARD_V(m_ret) |
| 935 |
#endif |
| 936 |
|
| 937 |
|
| 938 |
#define DEPRECATED_NODE_WARNING warnings.push_back(RTR("This node is marked as deprecated and will be removed in future versions.\nPlease check the Godot documentation for information about migration.")); |
| 939 |
#define EXPERIMENTAL_NODE_WARNING warnings.push_back(RTR("This node is marked as experimental and may be subject to removal or major changes in future versions.")); |