mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-21 05:37:50 -06:00
Correctly detect old project files for conflicts
CURA-4053 - In Cura 2.5, there is no definition_changes in the stack. This is now taken into account when doing conflicts detection. - In Cura 2.5, we have empty containers named as "empty_variant" and such. Those are now properly handled in conflict detection.
This commit is contained in:
parent
7148c71877
commit
9288f408e5
1 changed files with 13 additions and 0 deletions
|
@ -56,6 +56,9 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
|
|
||||||
self._id_mapping = {}
|
self._id_mapping = {}
|
||||||
|
|
||||||
|
# In Cura 2.5 and 2.6, the empty profiles used to have those long names
|
||||||
|
self._old_empty_profile_id_dict = {"empty_%s" % k: "empty" for k in ["material", "variant"]}
|
||||||
|
|
||||||
## Get a unique name based on the old_id. This is different from directly calling the registry in that it caches results.
|
## Get a unique name based on the old_id. This is different from directly calling the registry in that it caches results.
|
||||||
# This has nothing to do with speed, but with getting consistent new naming for instances & objects.
|
# This has nothing to do with speed, but with getting consistent new naming for instances & objects.
|
||||||
def getNewId(self, old_id):
|
def getNewId(self, old_id):
|
||||||
|
@ -249,6 +252,11 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
# Check if there are any changes at all in any of the container stacks.
|
# Check if there are any changes at all in any of the container stacks.
|
||||||
id_list = self._getContainerIdListFromSerialized(serialized)
|
id_list = self._getContainerIdListFromSerialized(serialized)
|
||||||
for index, container_id in enumerate(id_list):
|
for index, container_id in enumerate(id_list):
|
||||||
|
# take into account the old empty container IDs
|
||||||
|
container_id = self._old_empty_profile_id_dict.get(container_id, container_id)
|
||||||
|
# HACK: there used to be 5, now we have one more 5 - definition changes
|
||||||
|
if len(id_list) == 6 and index == 5:
|
||||||
|
index = 6
|
||||||
if global_stack.getContainer(index).getId() != container_id:
|
if global_stack.getContainer(index).getId() != container_id:
|
||||||
machine_conflict = True
|
machine_conflict = True
|
||||||
break
|
break
|
||||||
|
@ -282,6 +290,11 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
# check if there are any changes at all in any of the container stacks.
|
# check if there are any changes at all in any of the container stacks.
|
||||||
id_list = self._getContainerIdListFromSerialized(serialized)
|
id_list = self._getContainerIdListFromSerialized(serialized)
|
||||||
for index, container_id in enumerate(id_list):
|
for index, container_id in enumerate(id_list):
|
||||||
|
# take into account the old empty container IDs
|
||||||
|
container_id = self._old_empty_profile_id_dict.get(container_id, container_id)
|
||||||
|
# HACK: there used to be 5, now we have one more 5 - definition changes
|
||||||
|
if len(id_list) == 6 and index == 5:
|
||||||
|
index = 6
|
||||||
if existing_extruder_stack.getContainer(index).getId() != container_id:
|
if existing_extruder_stack.getContainer(index).getId() != container_id:
|
||||||
machine_conflict = True
|
machine_conflict = True
|
||||||
break
|
break
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue