mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
Simplify & cleanup objects mode
CURA-6283
This commit is contained in:
parent
502eea4d26
commit
bd39a9c591
1 changed files with 10 additions and 17 deletions
|
@ -72,7 +72,7 @@ class ObjectsModel(ListModel):
|
||||||
self._update_timer.start()
|
self._update_timer.start()
|
||||||
|
|
||||||
def _update(self, *args) -> None:
|
def _update(self, *args) -> None:
|
||||||
nodes = []
|
nodes = [] # type: List[Dict[str, Union[str, int, bool, SceneNode]]]
|
||||||
filter_current_build_plate = Application.getInstance().getPreferences().getValue("view/filter_current_build_plate")
|
filter_current_build_plate = Application.getInstance().getPreferences().getValue("view/filter_current_build_plate")
|
||||||
active_build_plate_number = self._build_plate_number
|
active_build_plate_number = self._build_plate_number
|
||||||
|
|
||||||
|
@ -133,12 +133,12 @@ class ObjectsModel(ListModel):
|
||||||
else:
|
else:
|
||||||
node_info.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 find out the names for all nodes that need to be renamed.
|
||||||
node_rename_list = [] # type: List[Dict[str, Union[str, SceneNode]]]
|
all_nodes = [] # type: List[SceneNode]
|
||||||
for name, node_info 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.index_to_node.values():
|
for node in node_info.index_to_node.values():
|
||||||
node_rename_list.append({"node": node})
|
all_nodes.append(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
|
||||||
|
@ -151,13 +151,13 @@ class ObjectsModel(ListModel):
|
||||||
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,
|
from UM.Logger import Logger
|
||||||
"new_name": new_group_name})
|
old_name = node.getName()
|
||||||
|
node.setName(new_group_name)
|
||||||
for rename_dict in node_rename_list:
|
Logger.log("d", "Node [%s] renamed to [%s]", old_name, new_group_name)
|
||||||
node = rename_dict["node"]
|
all_nodes.append(node)
|
||||||
new_name = rename_dict.get("new_name")
|
|
||||||
|
|
||||||
|
for node in all_nodes:
|
||||||
if hasattr(node, "isOutsideBuildArea"):
|
if hasattr(node, "isOutsideBuildArea"):
|
||||||
is_outside_build_area = node.isOutsideBuildArea() # type: ignore
|
is_outside_build_area = node.isOutsideBuildArea() # type: ignore
|
||||||
else:
|
else:
|
||||||
|
@ -165,13 +165,6 @@ class ObjectsModel(ListModel):
|
||||||
|
|
||||||
node_build_plate_number = node.callDecoration("getBuildPlateNumber")
|
node_build_plate_number = node.callDecoration("getBuildPlateNumber")
|
||||||
|
|
||||||
from UM.Logger import Logger
|
|
||||||
|
|
||||||
if new_name is not None:
|
|
||||||
old_name = node.getName()
|
|
||||||
node.setName(new_name)
|
|
||||||
Logger.log("d", "Node [%s] renamed to [%s]", old_name, new_name)
|
|
||||||
|
|
||||||
nodes.append({
|
nodes.append({
|
||||||
"name": node.getName(),
|
"name": node.getName(),
|
||||||
"selected": Selection.isSelected(node),
|
"selected": Selection.isSelected(node),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue