Use NULL instead of COND checks when appropriate
Restricted to scene
This commit is contained in:
parent
9723077f4f
commit
dcd2b883eb
43 changed files with 123 additions and 126 deletions
|
|
@ -66,8 +66,8 @@ void Node::_notification(int p_notification) {
|
|||
} break;
|
||||
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
ERR_FAIL_COND(!get_viewport());
|
||||
ERR_FAIL_COND(!get_tree());
|
||||
ERR_FAIL_NULL(get_viewport());
|
||||
ERR_FAIL_NULL(get_tree());
|
||||
|
||||
// Update process mode.
|
||||
if (data.process_mode == PROCESS_MODE_INHERIT) {
|
||||
|
|
@ -121,8 +121,8 @@ void Node::_notification(int p_notification) {
|
|||
} break;
|
||||
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
ERR_FAIL_COND(!get_viewport());
|
||||
ERR_FAIL_COND(!get_tree());
|
||||
ERR_FAIL_NULL(get_viewport());
|
||||
ERR_FAIL_NULL(get_tree());
|
||||
|
||||
get_tree()->nodes_in_tree_count--;
|
||||
orphan_node_count++;
|
||||
|
|
@ -1989,7 +1989,7 @@ NodePath Node::get_path_to(const Node *p_node, bool p_use_unique_path) const {
|
|||
common_parent = common_parent->data.parent;
|
||||
}
|
||||
|
||||
ERR_FAIL_COND_V(!common_parent, NodePath()); //nodes not in the same tree
|
||||
ERR_FAIL_NULL_V(common_parent, NodePath()); //nodes not in the same tree
|
||||
|
||||
visited.clear();
|
||||
|
||||
|
|
@ -2252,7 +2252,7 @@ void Node::_propagate_replace_owner(Node *p_owner, Node *p_by_owner) {
|
|||
|
||||
Ref<Tween> Node::create_tween() {
|
||||
ERR_THREAD_GUARD_V(Ref<Tween>());
|
||||
ERR_FAIL_COND_V_MSG(!data.tree, nullptr, "Can't create Tween when not inside scene tree.");
|
||||
ERR_FAIL_NULL_V_MSG(data.tree, nullptr, "Can't create Tween when not inside scene tree.");
|
||||
Ref<Tween> tween = get_tree()->create_tween();
|
||||
tween->bind_node(this);
|
||||
return tween;
|
||||
|
|
@ -2437,19 +2437,19 @@ Node *Node::_duplicate(int p_flags, HashMap<const Node *, Node *> *r_duplimap) c
|
|||
}
|
||||
#endif
|
||||
node = res->instantiate(edit_state);
|
||||
ERR_FAIL_COND_V(!node, nullptr);
|
||||
ERR_FAIL_NULL_V(node, nullptr);
|
||||
node->set_scene_instance_load_placeholder(get_scene_instance_load_placeholder());
|
||||
|
||||
instantiated = true;
|
||||
|
||||
} else {
|
||||
Object *obj = ClassDB::instantiate(get_class());
|
||||
ERR_FAIL_COND_V(!obj, nullptr);
|
||||
ERR_FAIL_NULL_V(obj, nullptr);
|
||||
node = Object::cast_to<Node>(obj);
|
||||
if (!node) {
|
||||
memdelete(obj);
|
||||
}
|
||||
ERR_FAIL_COND_V(!node, nullptr);
|
||||
ERR_FAIL_NULL_V(node, nullptr);
|
||||
}
|
||||
|
||||
if (!get_scene_file_path().is_empty()) { //an instance
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue