mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 22:25:53 +08:00
Merge branch 'master' of github.com:Ultimaker/cura
This commit is contained in:
commit
3852b0d1c3
@ -528,6 +528,7 @@ class CuraContainerRegistry(ContainerRegistry):
|
||||
extruder_quality_changes_container = self.findInstanceContainers(name = machine.qualityChanges.getName(), extruder = extruder_id)
|
||||
if extruder_quality_changes_container:
|
||||
extruder_quality_changes_container = extruder_quality_changes_container[0]
|
||||
|
||||
quality_changes_id = extruder_quality_changes_container.getId()
|
||||
extruder_stack.setQualityChangesById(quality_changes_id)
|
||||
else:
|
||||
@ -538,15 +539,80 @@ class CuraContainerRegistry(ContainerRegistry):
|
||||
if extruder_quality_changes_container:
|
||||
quality_changes_id = extruder_quality_changes_container.getId()
|
||||
extruder_stack.setQualityChangesById(quality_changes_id)
|
||||
else:
|
||||
# if we still cannot find a quality changes container for the extruder, create a new one
|
||||
container_id = self.uniqueName(extruder_stack.getId() + "_user")
|
||||
container_name = machine.qualityChanges.getName()
|
||||
extruder_quality_changes_container = InstanceContainer(container_id)
|
||||
extruder_quality_changes_container.setName(container_name)
|
||||
extruder_quality_changes_container.addMetaDataEntry("type", "quality_changes")
|
||||
extruder_quality_changes_container.addMetaDataEntry("setting_version", CuraApplication.SettingVersion)
|
||||
extruder_quality_changes_container.addMetaDataEntry("extruder", extruder_stack.definition.getId())
|
||||
extruder_quality_changes_container.addMetaDataEntry("quality_type", machine.qualityChanges.getMetaDataEntry("quality_type"))
|
||||
extruder_quality_changes_container.setDefinition(machine.qualityChanges.getDefinition().getId())
|
||||
|
||||
if not extruder_quality_changes_container:
|
||||
Logger.log("w", "Could not find quality_changes named [%s] for extruder [%s]",
|
||||
machine.qualityChanges.getName(), extruder_stack.getId())
|
||||
else:
|
||||
# move all per-extruder settings to the extruder's quality changes
|
||||
for qc_setting_key in machine.qualityChanges.getAllKeys():
|
||||
settable_per_extruder = machine.getProperty(qc_setting_key, "settable_per_extruder")
|
||||
if settable_per_extruder:
|
||||
setting_value = machine.qualityChanges.getProperty(qc_setting_key, "value")
|
||||
|
||||
setting_definition = machine.getSettingDefinition(qc_setting_key)
|
||||
new_instance = SettingInstance(setting_definition, definition_changes)
|
||||
new_instance.setProperty("value", setting_value)
|
||||
new_instance.resetState() # Ensure that the state is not seen as a user state.
|
||||
extruder_quality_changes_container.addInstance(new_instance)
|
||||
extruder_quality_changes_container.setDirty(True)
|
||||
|
||||
machine.qualityChanges.removeInstance(qc_setting_key, postpone_emit=True)
|
||||
else:
|
||||
extruder_stack.setQualityChangesById("empty_quality_changes")
|
||||
|
||||
self.addContainer(extruder_stack)
|
||||
|
||||
# Also need to fix the other qualities that are suitable for this machine. Those quality changes may still have
|
||||
# per-extruder settings in the container for the machine instead of the extruder.
|
||||
quality_changes_machine_definition_id = machine.qualityChanges.getDefinition().getId()
|
||||
qcs = self.findInstanceContainers(type = "quality_changes", definition = quality_changes_machine_definition_id)
|
||||
qc_groups = {} # map of qc names -> qc containers
|
||||
for qc in qcs:
|
||||
qc_name = qc.getName()
|
||||
if qc_name not in qc_groups:
|
||||
qc_groups[qc_name] = []
|
||||
qc_groups[qc_name].append(qc)
|
||||
# try to find from the quality changes cura directory too
|
||||
quality_changes_container = self._findQualityChangesContainerInCuraFolder(machine.qualityChanges.getName())
|
||||
if quality_changes_container:
|
||||
qc_groups[qc_name].append(quality_changes_container)
|
||||
|
||||
for qc_name, qc_list in qc_groups.items():
|
||||
qc_dict = {"global": None, "extruders": []}
|
||||
for qc in qc_list:
|
||||
extruder_def_id = qc.getMetaDataEntry("extruder")
|
||||
if extruder_def_id is not None:
|
||||
qc_dict["extruders"].append(qc)
|
||||
else:
|
||||
qc_dict["global"] = qc
|
||||
if qc_dict["global"] is not None and len(qc_dict["extruders"]) == 1:
|
||||
# move per-extruder settings
|
||||
for qc_setting_key in qc_dict["global"].getAllKeys():
|
||||
settable_per_extruder = machine.getProperty(qc_setting_key, "settable_per_extruder")
|
||||
if settable_per_extruder:
|
||||
setting_value = qc_dict["global"].getProperty(qc_setting_key, "value")
|
||||
|
||||
setting_definition = machine.getSettingDefinition(qc_setting_key)
|
||||
new_instance = SettingInstance(setting_definition, definition_changes)
|
||||
new_instance.setProperty("value", setting_value)
|
||||
new_instance.resetState() # Ensure that the state is not seen as a user state.
|
||||
qc_dict["extruders"][0].addInstance(new_instance)
|
||||
qc_dict["extruders"][0].setDirty(True)
|
||||
|
||||
qc_dict["global"].removeInstance(qc_setting_key, postpone_emit=True)
|
||||
|
||||
# Set next stack at the end
|
||||
extruder_stack.setNextStack(machine)
|
||||
|
||||
@ -575,6 +641,9 @@ class CuraContainerRegistry(ContainerRegistry):
|
||||
if parser["general"]["name"] == name:
|
||||
# load the container
|
||||
container_id = os.path.basename(file_path).replace(".inst.cfg", "")
|
||||
if self.findInstanceContainers(id = container_id):
|
||||
# this container is already in the registry, skip it
|
||||
continue
|
||||
|
||||
instance_container = InstanceContainer(container_id)
|
||||
with open(file_path, "r") as f:
|
||||
|
@ -418,9 +418,15 @@ class FlavorParser:
|
||||
self._layer_number += 1
|
||||
current_path.clear()
|
||||
|
||||
material_color_map = numpy.zeros((10, 4), dtype = numpy.float32)
|
||||
material_color_map = numpy.zeros((8, 4), dtype = numpy.float32)
|
||||
material_color_map[0, :] = [0.0, 0.7, 0.9, 1.0]
|
||||
material_color_map[1, :] = [0.7, 0.9, 0.0, 1.0]
|
||||
material_color_map[2, :] = [0.9, 0.0, 0.7, 1.0]
|
||||
material_color_map[3, :] = [0.7, 0.0, 0.0, 1.0]
|
||||
material_color_map[4, :] = [0.0, 0.7, 0.0, 1.0]
|
||||
material_color_map[5, :] = [0.0, 0.0, 0.7, 1.0]
|
||||
material_color_map[6, :] = [0.3, 0.3, 0.3, 1.0]
|
||||
material_color_map[7, :] = [0.7, 0.7, 0.7, 1.0]
|
||||
layer_mesh = self._layer_data_builder.build(material_color_map)
|
||||
decorator = LayerDataDecorator()
|
||||
decorator.setLayerData(layer_mesh)
|
||||
|
@ -104,7 +104,7 @@ class SimulationView(View):
|
||||
title = catalog.i18nc("@info:title", "Simulation View"))
|
||||
|
||||
def _resetSettings(self):
|
||||
self._layer_view_type = 0 # 0 is material color, 1 is color by linetype, 2 is speed
|
||||
self._layer_view_type = 0 # 0 is material color, 1 is color by linetype, 2 is speed, 3 is layer thickness
|
||||
self._extruder_count = 0
|
||||
self._extruder_opacity = [1.0, 1.0, 1.0, 1.0]
|
||||
self._show_travel_moves = 0
|
||||
|
@ -176,7 +176,6 @@ Item
|
||||
viewSettings.show_feedrate_gradient = viewSettings.show_gradient && (type_id == 2);
|
||||
viewSettings.show_thickness_gradient = viewSettings.show_gradient && (type_id == 3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Label
|
||||
|
Loading…
x
Reference in New Issue
Block a user