mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Renamed some local variables so they describe better what they do
CURA-6283
This commit is contained in:
parent
c784a39ec6
commit
48dd9d247c
1 changed files with 12 additions and 12 deletions
|
@ -130,36 +130,36 @@ class ObjectsModel(ListModel):
|
||||||
# - known indices for nodes which doesn't need to be renamed
|
# - known indices for nodes which doesn't need to be renamed
|
||||||
# - a list of nodes that need to be renamed. When renaming then, we should avoid using the known indices.
|
# - a list of nodes that need to be renamed. When renaming then, we should avoid using the known indices.
|
||||||
name_to_node_info_dict[original_name] = _NodeInfo(is_group = is_group)
|
name_to_node_info_dict[original_name] = _NodeInfo(is_group = is_group)
|
||||||
node_info_dict = name_to_node_info_dict[original_name]
|
node_info = name_to_node_info_dict[original_name]
|
||||||
if not force_rename and name_index not in node_info_dict.index_to_node:
|
if not force_rename and name_index not in node_info.index_to_node:
|
||||||
node_info_dict.index_to_node[name_index] = node
|
node_info.index_to_node[name_index] = node
|
||||||
else:
|
else:
|
||||||
node_info_dict.nodes_to_rename.append(node)
|
node_info.nodes_to_rename.append(node)
|
||||||
|
|
||||||
# Go through all names and rename the nodes that need to be renamed.
|
# Go through all names and rename the nodes that need to be renamed.
|
||||||
node_rename_list = [] # type: List[Dict[str, Union[str, SceneNode]]]
|
node_rename_list = [] # type: List[Dict[str, Union[str, SceneNode]]]
|
||||||
for name, node_info_dict in name_to_node_info_dict.items():
|
for name, node_info in name_to_node_info_dict.items():
|
||||||
# First add the ones that do not need to be renamed.
|
# First add the ones that do not need to be renamed.
|
||||||
for node in node_info_dict.index_to_node.values():
|
for node in node_info.index_to_node.values():
|
||||||
node_rename_list.append({"node": node})
|
node_rename_list.append({"node": node})
|
||||||
|
|
||||||
# Generate new names for the nodes that need to be renamed
|
# Generate new names for the nodes that need to be renamed
|
||||||
current_index = 0
|
current_index = 0
|
||||||
for node in node_info_dict.nodes_to_rename:
|
for node in node_info.nodes_to_rename:
|
||||||
current_index += 1
|
current_index += 1
|
||||||
while current_index in node_info_dict.index_to_node:
|
while current_index in node_info.index_to_node:
|
||||||
current_index += 1
|
current_index += 1
|
||||||
|
|
||||||
if not node_info_dict.is_group:
|
if not node_info.is_group:
|
||||||
new_group_name = "{0}({1})".format(name, current_index)
|
new_group_name = "{0}({1})".format(name, current_index)
|
||||||
else:
|
else:
|
||||||
new_group_name = "{0}#{1}".format(name, current_index)
|
new_group_name = "{0}#{1}".format(name, current_index)
|
||||||
node_rename_list.append({"node": node,
|
node_rename_list.append({"node": node,
|
||||||
"new_name": new_group_name})
|
"new_name": new_group_name})
|
||||||
|
|
||||||
for node_info in node_rename_list:
|
for rename_dict in node_rename_list:
|
||||||
node = node_info["node"]
|
node = rename_dict["node"]
|
||||||
new_name = node_info.get("new_name")
|
new_name = rename_dict.get("new_name")
|
||||||
|
|
||||||
if hasattr(node, "isOutsideBuildArea"):
|
if hasattr(node, "isOutsideBuildArea"):
|
||||||
is_outside_build_area = node.isOutsideBuildArea() # type: ignore
|
is_outside_build_area = node.isOutsideBuildArea() # type: ignore
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue