|
@@ -733,6 +733,9 @@ class MachineManager(QObject):
|
|
|
|
|
|
old_material = self._active_container_stack.material
|
|
|
old_quality = self._active_container_stack.quality
|
|
|
+ old_quality_type = None
|
|
|
+ if old_quality and old_quality.getId() != self._empty_quality_container.getId():
|
|
|
+ old_quality_type = old_quality.getMetaDataEntry("quality_type")
|
|
|
old_quality_changes = self._active_container_stack.qualityChanges
|
|
|
if not old_material:
|
|
|
Logger.log("w", "While trying to set the active material, no material was found to replace it.")
|
|
@@ -773,13 +776,28 @@ class MachineManager(QObject):
|
|
|
quality_manager.getWholeMachineDefinition(global_stack.definition),
|
|
|
[material_container])
|
|
|
|
|
|
- if not candidate_quality or isinstance(candidate_quality, type(self._empty_quality_changes_container)):
|
|
|
+ if not candidate_quality or candidate_quality.getId() == self._empty_quality_changes_container:
|
|
|
Logger.log("d", "Attempting to find fallback quality")
|
|
|
# Fall back to a quality (which must be compatible with all other extruders)
|
|
|
new_qualities = quality_manager.findAllUsableQualitiesForMachineAndExtruders(
|
|
|
self._global_container_stack, ExtruderManager.getInstance().getExtruderStacks())
|
|
|
- if new_qualities:
|
|
|
- new_quality_id = new_qualities[0].getId() # Just pick the first available one
|
|
|
+
|
|
|
+ quality_types = sorted([q.getMetaDataEntry("quality_type") for q in new_qualities], reverse = True)
|
|
|
+ quality_type_to_use = None
|
|
|
+ if quality_types:
|
|
|
+ # try to use the same quality as before, otherwise the first one in the quality_types
|
|
|
+ quality_type_to_use = quality_types[0]
|
|
|
+ if old_quality_type is not None and old_quality_type in quality_type_to_use:
|
|
|
+ quality_type_to_use = old_quality_type
|
|
|
+
|
|
|
+ new_quality = None
|
|
|
+ for q in new_qualities:
|
|
|
+ if quality_type_to_use is not None and q.getMetaDataEntry("quality_type") == quality_type_to_use:
|
|
|
+ new_quality = q
|
|
|
+ break
|
|
|
+
|
|
|
+ if new_quality is not None:
|
|
|
+ new_quality_id = new_quality.getId() # Just pick the first available one
|
|
|
else:
|
|
|
Logger.log("w", "No quality profile found that matches the current machine and extruders.")
|
|
|
else:
|