summaryrefslogtreecommitdiff
path: root/scene/main/node.cpp
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2017-08-16 03:21:28 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2017-08-16 03:26:47 +0200
commit213ad45ccfdea964db1625a625f2261ddb3f6862 (patch)
tree6dc74a1ee5dce9083e1991d6822b4344ea0824fc /scene/main/node.cpp
parent603b262d9bfe757e4a009a80f1c80230d35512ba (diff)
Allow zero-padded serial naming
Thereby, the editor will acknowledge node namings such as _Thing003_ so that a duplicate, for instance, will be named _Thing004_, instead of _Thing4_, that was the case formerly. Closes #7758.
Diffstat (limited to 'scene/main/node.cpp')
-rwxr-xr-xscene/main/node.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 0d872d906e..0474c6fd26 100755
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -1301,8 +1301,9 @@ String Node::_generate_serial_child_name(Node *p_child) {
}
}
+ int num_places = nums.length();
for (;;) {
- String attempt = (name + (num > 0 || explicit_zero ? nnsep + itos(num) : "")).strip_edges();
+ String attempt = (name + (num > 0 || explicit_zero ? nnsep + itos(num).pad_zeros(num_places) : "")).strip_edges();
bool found = false;
for (int i = 0; i < data.children.size(); i++) {
if (data.children[i] == p_child)