summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2017-08-16 16:33:42 +0200
committerGitHub <noreply@github.com>2017-08-16 16:33:42 +0200
commitba68b2610c634019ac1650416a7f398335810db6 (patch)
treef796bf261af3fd8d2911b4c05abde8d564883c77
parent6abb7bd13b6224fd6dae2a78444a2c1afa553125 (diff)
parent213ad45ccfdea964db1625a625f2261ddb3f6862 (diff)
Merge pull request #10367 from RandomShaper/allow-zero-padded-series
Allow zero-padded serial naming
-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)