mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Use RequiredParam and RequiredResult in a handful of places in order to test
This commit is contained in:
@@ -1696,11 +1696,11 @@ void Node::_add_child_nocheck(Node *p_child, const StringName &p_name, InternalM
|
||||
emit_signal(SNAME("child_order_changed"));
|
||||
}
|
||||
|
||||
void Node::add_child(Node *p_child, bool p_force_readable_name, InternalMode p_internal) {
|
||||
void Node::add_child(RequiredParam<Node> rp_child, bool p_force_readable_name, InternalMode p_internal) {
|
||||
ERR_FAIL_COND_MSG(data.tree && !Thread::is_main_thread(), "Adding children to a node inside the SceneTree is only allowed from the main thread. Use call_deferred(\"add_child\",node).");
|
||||
|
||||
ERR_THREAD_GUARD
|
||||
ERR_FAIL_NULL(p_child);
|
||||
EXTRACT_PARAM_OR_FAIL(p_child, rp_child);
|
||||
ERR_FAIL_COND_MSG(p_child == this, vformat("Can't add child '%s' to itself.", p_child->get_name())); // adding to itself!
|
||||
ERR_FAIL_COND_MSG(p_child->data.parent, vformat("Can't add child '%s' to '%s', already has a parent '%s'.", p_child->get_name(), get_name(), p_child->data.parent->get_name())); //Fail if node has a parent
|
||||
#ifdef DEBUG_ENABLED
|
||||
@@ -2635,7 +2635,7 @@ void Node::_propagate_replace_owner(Node *p_owner, Node *p_by_owner) {
|
||||
data.blocked--;
|
||||
}
|
||||
|
||||
Ref<Tween> Node::create_tween() {
|
||||
RequiredResult<Tween> Node::create_tween() {
|
||||
ERR_THREAD_GUARD_V(Ref<Tween>());
|
||||
|
||||
SceneTree *tree = data.tree;
|
||||
|
||||
@@ -512,7 +512,7 @@ public:
|
||||
|
||||
InternalMode get_internal_mode() const;
|
||||
|
||||
void add_child(Node *p_child, bool p_force_readable_name = false, InternalMode p_internal = INTERNAL_MODE_DISABLED);
|
||||
void add_child(RequiredParam<Node> rp_child, bool p_force_readable_name = false, InternalMode p_internal = INTERNAL_MODE_DISABLED);
|
||||
void add_sibling(Node *p_sibling, bool p_force_readable_name = false);
|
||||
void remove_child(Node *p_child);
|
||||
|
||||
@@ -608,7 +608,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
Ref<Tween> create_tween();
|
||||
RequiredResult<Tween> create_tween();
|
||||
|
||||
void print_tree();
|
||||
void print_tree_pretty();
|
||||
|
||||
@@ -1751,7 +1751,7 @@ Ref<SceneTreeTimer> SceneTree::create_timer(double p_delay_sec, bool p_process_a
|
||||
return stt;
|
||||
}
|
||||
|
||||
Ref<Tween> SceneTree::create_tween() {
|
||||
RequiredResult<Tween> SceneTree::create_tween() {
|
||||
_THREAD_SAFE_METHOD_
|
||||
Ref<Tween> tween;
|
||||
tween.instantiate(this);
|
||||
|
||||
@@ -429,7 +429,7 @@ public:
|
||||
void unload_current_scene();
|
||||
|
||||
Ref<SceneTreeTimer> create_timer(double p_delay_sec, bool p_process_always = true, bool p_process_in_physics = false, bool p_ignore_time_scale = false);
|
||||
Ref<Tween> create_tween();
|
||||
RequiredResult<Tween> create_tween();
|
||||
void remove_tween(const Ref<Tween> &p_tween);
|
||||
TypedArray<Tween> get_processed_tweens();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user