Remove ERR_EXPLAIN from scene/* code
This commit is contained in:
@ -327,14 +327,9 @@ void Node::_propagate_exit_tree() {
|
||||
void Node::move_child(Node *p_child, int p_pos) {
|
||||
|
||||
ERR_FAIL_NULL(p_child);
|
||||
ERR_EXPLAIN("Invalid new child position: " + itos(p_pos));
|
||||
ERR_FAIL_INDEX(p_pos, data.children.size() + 1);
|
||||
ERR_EXPLAIN("child is not a child of this node.");
|
||||
ERR_FAIL_COND(p_child->data.parent != this);
|
||||
if (data.blocked > 0) {
|
||||
ERR_EXPLAIN("Parent node is busy setting up children, move_child() failed. Consider using call_deferred(\"move_child\") instead (or \"popup\" if this is from a popup).");
|
||||
ERR_FAIL_COND(data.blocked > 0);
|
||||
}
|
||||
ERR_FAIL_INDEX_MSG(p_pos, data.children.size() + 1, "Invalid new child position: " + itos(p_pos) + ".");
|
||||
ERR_FAIL_COND_MSG(p_child->data.parent != this, "Child is not a child of this node.");
|
||||
ERR_FAIL_COND_MSG(data.blocked > 0, "Parent node is busy setting up children, move_child() failed. Consider using call_deferred(\"move_child\") instead (or \"popup\" if this is from a popup).");
|
||||
|
||||
// Specifying one place beyond the end
|
||||
// means the same as moving to the last position
|
||||
@ -1165,25 +1160,9 @@ void Node::_add_child_nocheck(Node *p_child, const StringName &p_name) {
|
||||
void Node::add_child(Node *p_child, bool p_legible_unique_name) {
|
||||
|
||||
ERR_FAIL_NULL(p_child);
|
||||
|
||||
if (p_child == this) {
|
||||
ERR_EXPLAIN("Can't add child '" + p_child->get_name() + "' to itself.");
|
||||
ERR_FAIL_COND(p_child == this); // adding to itself!
|
||||
}
|
||||
|
||||
/* Fail if node has a parent */
|
||||
if (p_child->data.parent) {
|
||||
ERR_EXPLAIN("Can't add child '" + p_child->get_name() + "' to '" + get_name() + "', already has a parent '" + p_child->data.parent->get_name() + "'.");
|
||||
ERR_FAIL_COND(p_child->data.parent);
|
||||
}
|
||||
|
||||
if (data.blocked > 0) {
|
||||
ERR_EXPLAIN("Parent node is busy setting up children, add_node() failed. Consider using call_deferred(\"add_child\", child) instead.");
|
||||
ERR_FAIL_COND(data.blocked > 0);
|
||||
}
|
||||
|
||||
ERR_EXPLAIN("Can't add child while a notification is happening.");
|
||||
ERR_FAIL_COND(data.blocked > 0);
|
||||
ERR_FAIL_COND_MSG(p_child == this, "Can't add child '" + p_child->get_name() + "' to itself."); // adding to itself!
|
||||
ERR_FAIL_COND_MSG(p_child->data.parent, "Can't add child '" + p_child->get_name() + "' to '" + get_name() + "', already has a parent '" + p_child->data.parent->get_name() + "'."); //Fail if node has a parent
|
||||
ERR_FAIL_COND_MSG(data.blocked > 0, "Parent node is busy setting up children, add_node() failed. Consider using call_deferred(\"add_child\", child) instead.");
|
||||
|
||||
/* Validate name */
|
||||
_validate_child_name(p_child, p_legible_unique_name);
|
||||
@ -1239,10 +1218,7 @@ void Node::_propagate_validate_owner() {
|
||||
void Node::remove_child(Node *p_child) {
|
||||
|
||||
ERR_FAIL_NULL(p_child);
|
||||
if (data.blocked > 0) {
|
||||
ERR_EXPLAIN("Parent node is busy setting up children, remove_node() failed. Consider using call_deferred(\"remove_child\",child) instead.");
|
||||
ERR_FAIL_COND(data.blocked > 0);
|
||||
}
|
||||
ERR_FAIL_COND_MSG(data.blocked > 0, "Parent node is busy setting up children, remove_node() failed. Consider using call_deferred(\"remove_child\", child) instead.");
|
||||
|
||||
int child_count = data.children.size();
|
||||
Node **children = data.children.ptrw();
|
||||
@ -1265,8 +1241,7 @@ void Node::remove_child(Node *p_child) {
|
||||
}
|
||||
}
|
||||
|
||||
ERR_EXPLAIN("Cannot remove child node " + p_child->to_string() + " as it is not in our list of children");
|
||||
ERR_FAIL_COND(idx == -1);
|
||||
ERR_FAIL_COND_MSG(idx == -1, "Cannot remove child node " + p_child->get_name() + " as it is not a child of this node.");
|
||||
//ERR_FAIL_COND( p_child->data.blocked > 0 );
|
||||
|
||||
//if (data.scene) { does not matter
|
||||
@ -1330,10 +1305,7 @@ Node *Node::get_node_or_null(const NodePath &p_path) const {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!data.inside_tree && p_path.is_absolute()) {
|
||||
ERR_EXPLAIN("Can't use get_node() with absolute paths from outside the active scene tree.");
|
||||
ERR_FAIL_V(NULL);
|
||||
}
|
||||
ERR_FAIL_COND_V_MSG(!data.inside_tree && p_path.is_absolute(), NULL, "Can't use get_node() with absolute paths from outside the active scene tree.");
|
||||
|
||||
Node *current = NULL;
|
||||
Node *root = NULL;
|
||||
@ -1394,10 +1366,7 @@ Node *Node::get_node_or_null(const NodePath &p_path) const {
|
||||
Node *Node::get_node(const NodePath &p_path) const {
|
||||
|
||||
Node *node = get_node_or_null(p_path);
|
||||
if (!node) {
|
||||
ERR_EXPLAIN("Node not found: " + p_path);
|
||||
ERR_FAIL_V(NULL);
|
||||
}
|
||||
ERR_FAIL_COND_V_MSG(!node, NULL, "Node not found: " + p_path + ".");
|
||||
return node;
|
||||
}
|
||||
|
||||
@ -1665,8 +1634,7 @@ NodePath Node::get_path_to(const Node *p_node) const {
|
||||
|
||||
NodePath Node::get_path() const {
|
||||
|
||||
ERR_EXPLAIN("Cannot get path of node as it is not in a scene tree");
|
||||
ERR_FAIL_COND_V(!is_inside_tree(), NodePath());
|
||||
ERR_FAIL_COND_V_MSG(!is_inside_tree(), NodePath(), "Cannot get path of node as it is not in a scene tree.");
|
||||
|
||||
if (data.path_cache)
|
||||
return *data.path_cache;
|
||||
@ -2193,13 +2161,11 @@ void Node::_duplicate_and_reown(Node *p_new_parent, const Map<Node *, Node *> &p
|
||||
} else {
|
||||
|
||||
Object *obj = ClassDB::instance(get_class());
|
||||
ERR_EXPLAIN("Node: Could not duplicate: " + String(get_class()));
|
||||
ERR_FAIL_COND(!obj);
|
||||
ERR_FAIL_COND_MSG(!obj, "Node: Could not duplicate: " + String(get_class()) + ".");
|
||||
node = Object::cast_to<Node>(obj);
|
||||
if (!node) {
|
||||
memdelete(obj);
|
||||
ERR_EXPLAIN("Node: Could not duplicate: " + String(get_class()));
|
||||
ERR_FAIL();
|
||||
ERR_FAIL_MSG("Node: Could not duplicate: " + String(get_class()) + ".");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2297,14 +2263,12 @@ Node *Node::duplicate_and_reown(const Map<Node *, Node *> &p_reown_map) const {
|
||||
ERR_FAIL_COND_V(get_filename() != "", NULL);
|
||||
|
||||
Object *obj = ClassDB::instance(get_class());
|
||||
ERR_EXPLAIN("Node: Could not duplicate: " + String(get_class()));
|
||||
ERR_FAIL_COND_V(!obj, NULL);
|
||||
ERR_FAIL_COND_V_MSG(!obj, NULL, "Node: Could not duplicate: " + String(get_class()) + ".");
|
||||
|
||||
Node *node = Object::cast_to<Node>(obj);
|
||||
if (!node) {
|
||||
memdelete(obj);
|
||||
ERR_EXPLAIN("Node: Could not duplicate: " + String(get_class()));
|
||||
ERR_FAIL_V(NULL);
|
||||
ERR_FAIL_V_MSG(NULL, "Node: Could not duplicate: " + String(get_class()) + ".");
|
||||
}
|
||||
node->set_name(get_name());
|
||||
|
||||
@ -2441,8 +2405,7 @@ void Node::_replace_connections_target(Node *p_new_target) {
|
||||
if (c.flags & CONNECT_PERSIST) {
|
||||
c.source->disconnect(c.signal, this, c.method);
|
||||
bool valid = p_new_target->has_method(c.method) || Ref<Script>(p_new_target->get_script()).is_null() || Ref<Script>(p_new_target->get_script())->has_method(c.method);
|
||||
ERR_EXPLAIN("Attempt to connect signal \'" + c.source->get_class() + "." + c.signal + "\' to nonexistent method \'" + c.target->get_class() + "." + c.method + "\'");
|
||||
ERR_CONTINUE(!valid);
|
||||
ERR_CONTINUE_MSG(!valid, "Attempt to connect signal '" + c.source->get_class() + "." + c.signal + "' to nonexistent method '" + c.target->get_class() + "." + c.method + "'.");
|
||||
c.source->connect(c.signal, p_new_target, c.method, c.binds, c.flags);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user