Fixed bug failing to generate new unique names for objects.

This commit is contained in:
Juan Pablo Caram
2014-10-30 11:59:58 -04:00
parent 77eff45d1d
commit 84bd8d14c6
6 changed files with 46 additions and 18 deletions

View File

@@ -612,10 +612,10 @@ class App(QtCore.QObject):
App.log.debug("new_object()")
### Check for existing name
if name in self.collection.get_names():
while name in self.collection.get_names():
## Create a new name
# Ends with number?
App.log.debug("new_object(): Object name exists, changing.")
App.log.debug("new_object(): Object name (%s) exists, changing." % name)
match = re.search(r'(.*[^\d])?(\d+)$', name)
if match: # Yes: Increment the number!
base = match.group(1) or ''