mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-09 07:56:22 -06:00
Simplify the renameNodes method
Especially when duplicating large amounts of items this would cause a bit of a slowdown CURA-7106
This commit is contained in:
parent
ba34fb6e35
commit
46076bf21d
1 changed files with 2 additions and 3 deletions
|
@ -98,7 +98,8 @@ class ObjectsModel(ListModel):
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _renameNodes(self, node_info_dict: Dict[str, _NodeInfo]) -> List[SceneNode]:
|
@staticmethod
|
||||||
|
def _renameNodes(node_info_dict: Dict[str, _NodeInfo]) -> List[SceneNode]:
|
||||||
# Go through all names and find out the names for all nodes that need to be renamed.
|
# Go through all names and find out the names for all nodes that need to be renamed.
|
||||||
all_nodes = [] # type: List[SceneNode]
|
all_nodes = [] # type: List[SceneNode]
|
||||||
for name, node_info in node_info_dict.items():
|
for name, node_info in node_info_dict.items():
|
||||||
|
@ -118,9 +119,7 @@ class ObjectsModel(ListModel):
|
||||||
else:
|
else:
|
||||||
new_group_name = "{0}#{1}".format(name, current_index)
|
new_group_name = "{0}#{1}".format(name, current_index)
|
||||||
|
|
||||||
old_name = node.getName()
|
|
||||||
node.setName(new_group_name)
|
node.setName(new_group_name)
|
||||||
Logger.log("d", "Node [%s] renamed to [%s]", old_name, new_group_name)
|
|
||||||
all_nodes.append(node)
|
all_nodes.append(node)
|
||||||
return all_nodes
|
return all_nodes
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue