mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
[3.x] Rename set_indexed & get_child's params to be clearer
3.x backport of #67300 and #64463.
This commit is contained in:
@@ -1284,7 +1284,7 @@ void Node::_add_child_nocheck(Node *p_child, const StringName &p_name) {
|
||||
}
|
||||
}
|
||||
|
||||
void Node::add_child(Node *p_child, bool p_legible_unique_name) {
|
||||
void Node::add_child(Node *p_child, bool p_force_readable_name) {
|
||||
ERR_FAIL_NULL(p_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
|
||||
@@ -1294,16 +1294,16 @@ void Node::add_child(Node *p_child, bool p_legible_unique_name) {
|
||||
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);
|
||||
_validate_child_name(p_child, p_force_readable_name);
|
||||
|
||||
_add_child_nocheck(p_child, p_child->data.name);
|
||||
}
|
||||
|
||||
void Node::add_child_below_node(Node *p_node, Node *p_child, bool p_legible_unique_name) {
|
||||
void Node::add_child_below_node(Node *p_node, Node *p_child, bool p_force_readable_name) {
|
||||
ERR_FAIL_NULL(p_node);
|
||||
ERR_FAIL_NULL(p_child);
|
||||
|
||||
add_child(p_child, p_legible_unique_name);
|
||||
add_child(p_child, p_force_readable_name);
|
||||
|
||||
if (p_node->data.parent == this) {
|
||||
move_child(p_child, p_node->get_position_in_parent() + 1);
|
||||
@@ -2981,11 +2981,11 @@ void Node::_bind_methods() {
|
||||
GLOBAL_DEF("node/name_casing", NAME_CASING_PASCAL_CASE);
|
||||
ProjectSettings::get_singleton()->set_custom_property_info("node/name_casing", PropertyInfo(Variant::INT, "node/name_casing", PROPERTY_HINT_ENUM, "PascalCase,camelCase,snake_case"));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("add_child_below_node", "node", "child_node", "legible_unique_name"), &Node::add_child_below_node, DEFVAL(false));
|
||||
ClassDB::bind_method(D_METHOD("add_child_below_node", "node", "child_node", "force_readable_name"), &Node::add_child_below_node, DEFVAL(false));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_name", "name"), &Node::set_name);
|
||||
ClassDB::bind_method(D_METHOD("get_name"), &Node::get_name);
|
||||
ClassDB::bind_method(D_METHOD("add_child", "node", "legible_unique_name"), &Node::add_child, DEFVAL(false));
|
||||
ClassDB::bind_method(D_METHOD("add_child", "node", "force_readable_name"), &Node::add_child, DEFVAL(false));
|
||||
ClassDB::bind_method(D_METHOD("remove_child", "node"), &Node::remove_child);
|
||||
ClassDB::bind_method(D_METHOD("get_child_count"), &Node::get_child_count);
|
||||
ClassDB::bind_method(D_METHOD("get_children"), &Node::_get_children);
|
||||
|
||||
Reference in New Issue
Block a user