Merge branch 'master' into feature_simulation_ux_tweaks

# Conflicts:
#	plugins/SimulationView/SimulationView.qml
This commit is contained in:
fieldOfView 2017-11-21 16:49:41 +01:00
commit 863b40b900
12 changed files with 33 additions and 74 deletions

View file

@ -126,8 +126,6 @@ class CuraApplication(QtApplication):
# Cura will always show the Add Machine Dialog upon start. # Cura will always show the Add Machine Dialog upon start.
stacksValidationFinished = pyqtSignal() # Emitted whenever a validation is finished stacksValidationFinished = pyqtSignal() # Emitted whenever a validation is finished
projectFileLoaded = pyqtSignal(str) # Emitted whenever a project file is loaded
def __init__(self): def __init__(self):
# this list of dir names will be used by UM to detect an old cura directory # this list of dir names will be used by UM to detect an old cura directory
for dir_name in ["extruders", "machine_instances", "materials", "plugins", "quality", "user", "variants"]: for dir_name in ["extruders", "machine_instances", "materials", "plugins", "quality", "user", "variants"]:

View file

@ -71,7 +71,7 @@ class PrintInformation(QObject):
Application.getInstance().globalContainerStackChanged.connect(self._updateJobName) Application.getInstance().globalContainerStackChanged.connect(self._updateJobName)
Application.getInstance().fileLoaded.connect(self.setBaseName) Application.getInstance().fileLoaded.connect(self.setBaseName)
Application.getInstance().projectFileLoaded.connect(self.setProjectName) Application.getInstance().workspaceLoaded.connect(self.setProjectName)
Preferences.getInstance().preferenceChanged.connect(self._onPreferencesChanged) Preferences.getInstance().preferenceChanged.connect(self._onPreferencesChanged)
self._active_material_container = None self._active_material_container = None
@ -264,12 +264,13 @@ class PrintInformation(QObject):
def jobName(self): def jobName(self):
return self._job_name return self._job_name
def _updateJobName(self, empty_name = False): def _updateJobName(self, is_project_name_empty = False):
# if the project name is set, we use the project name as the job name, so the job name should not get updated # if the project name is set, we use the project name as the job name, so the job name should not get updated
# if a model file is loaded after that. # if a model file is loaded after that.
if self._project_name != "": if self._project_name != "":
if empty_name: if is_project_name_empty:
self._project_name = "" self._project_name = ""
else:
return return
if self._base_name == "": if self._base_name == "":
@ -312,7 +313,7 @@ class PrintInformation(QObject):
if name.endswith(".curaproject"): if name.endswith(".curaproject"):
name = name[:name.rfind(".curaproject")] name = name[:name.rfind(".curaproject")]
self._base_name = name self._base_name = name
self._updateJobName(empty_name = is_empty) self._updateJobName(is_project_name_empty = is_empty)
## Created an acronymn-like abbreviated machine name from the currently active machine name ## Created an acronymn-like abbreviated machine name from the currently active machine name
# Called each time the global stack is switched # Called each time the global stack is switched

View file

@ -183,20 +183,11 @@ class QualityManager:
materials = [] materials = []
# TODO: fix this
if extruder_stacks:
# Multi-extruder machine detected
for stack in extruder_stacks: for stack in extruder_stacks:
if stack.getId() == active_stack_id and machine_manager.newMaterial: if stack.getId() == active_stack_id and machine_manager.newMaterial:
materials.append(machine_manager.newMaterial) materials.append(machine_manager.newMaterial)
else: else:
materials.append(stack.material) materials.append(stack.material)
else:
# Machine with one extruder
if global_container_stack.getId() == active_stack_id and machine_manager.newMaterial:
materials.append(machine_manager.newMaterial)
else:
materials.append(global_container_stack.material)
quality_types = self.findAllQualityTypesForMachineAndMaterials(global_machine_definition, materials) quality_types = self.findAllQualityTypesForMachineAndMaterials(global_machine_definition, materials)

View file

@ -24,9 +24,6 @@ class UserProfilesModel(ProfilesModel):
quality_manager = QualityManager.getInstance() quality_manager = QualityManager.getInstance()
machine_definition = quality_manager.getParentMachineDefinition(global_container_stack.definition) machine_definition = quality_manager.getParentMachineDefinition(global_container_stack.definition)
quality_changes_list = quality_manager.findAllQualityChangesForMachine(machine_definition) quality_changes_list = quality_manager.findAllQualityChangesForMachine(machine_definition)
extruder_manager = ExtruderManager.getInstance()
active_extruder = extruder_manager.getActiveExtruderStack()
extruder_stacks = self._getOrderedExtruderStacksList() extruder_stacks = self._getOrderedExtruderStacksList()
# Fetch the list of usable qualities across all extruders. # Fetch the list of usable qualities across all extruders.
@ -35,10 +32,6 @@ class UserProfilesModel(ProfilesModel):
# Filter the quality_change by the list of available quality_types # Filter the quality_change by the list of available quality_types
quality_type_set = set([x.getMetaDataEntry("quality_type") for x in quality_list]) quality_type_set = set([x.getMetaDataEntry("quality_type") for x in quality_list])
filtered_quality_changes = [qc for qc in quality_changes_list if filtered_quality_changes = [qc for qc in quality_changes_list if qc.getMetaDataEntry("quality_type") in quality_type_set]
qc.getMetaDataEntry("quality_type") in quality_type_set and
qc.getMetaDataEntry("extruder") is not None and
(qc.getMetaDataEntry("extruder") == active_extruder.definition.getMetaDataEntry("quality_definition") or
qc.getMetaDataEntry("extruder") == active_extruder.definition.getId())]
return filtered_quality_changes return filtered_quality_changes

View file

@ -902,7 +902,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
base_file_name = os.path.basename(file_name) base_file_name = os.path.basename(file_name)
if base_file_name.endswith(".curaproject.3mf"): if base_file_name.endswith(".curaproject.3mf"):
base_file_name = base_file_name[:base_file_name.rfind(".curaproject.3mf")] base_file_name = base_file_name[:base_file_name.rfind(".curaproject.3mf")]
Application.getInstance().projectFileLoaded.emit(base_file_name) self.setWorkspaceName(base_file_name)
return nodes return nodes
## HACK: Replaces the material container in the given stack with a newly created material container. ## HACK: Replaces the material container in the given stack with a newly created material container.

View file

@ -1,4 +1,4 @@
# Copyright (c) 2016 Aleph Objects, Inc. # Copyright (c) 2017 Aleph Objects, Inc.
# Cura is released under the terms of the LGPLv3 or higher. # Cura is released under the terms of the LGPLv3 or higher.
from UM.Application import Application from UM.Application import Application
@ -166,8 +166,8 @@ class GCodeReader(MeshReader):
return line_width return line_width
def _gCode0(self, position, params, path): def _gCode0(self, position, params, path):
x, y, z, f, e = position x, y, z, f, e = position
if self._is_absolute_positioning: if self._is_absolute_positioning:
x = params.x if params.x is not None else x x = params.x if params.x is not None else x
y = params.y if params.y is not None else y y = params.y if params.y is not None else y

View file

@ -20,7 +20,7 @@ from cura.Settings.ExtruderManager import ExtruderManager
import os.path import os.path
## RenderPass used to display g-code paths. ## RenderPass used to display g-code paths.
from plugins.SimulationView.NozzleNode import NozzleNode from .NozzleNode import NozzleNode
class SimulationPass(RenderPass): class SimulationPass(RenderPass):
@ -100,7 +100,6 @@ class SimulationPass(RenderPass):
if isinstance(node, ToolHandle): if isinstance(node, ToolHandle):
tool_handle_batch.addItem(node.getWorldTransformation(), mesh = node.getSolidMesh()) tool_handle_batch.addItem(node.getWorldTransformation(), mesh = node.getSolidMesh())
elif isinstance(node, NozzleNode): elif isinstance(node, NozzleNode):
nozzle_node = node nozzle_node = node
nozzle_node.setVisible(False) nozzle_node.setVisible(False)
@ -172,11 +171,11 @@ class SimulationPass(RenderPass):
batch.render(self._scene.getActiveCamera()) batch.render(self._scene.getActiveCamera())
# The nozzle is drawn once we know the correct position # The nozzle is drawn once we know the correct position
if self._layer_view.getActivity() and nozzle_node is not None: if not self._compatibility_mode and self._layer_view.getActivity() and nozzle_node is not None:
if head_position is not None: if head_position is not None:
nozzle_node.setVisible(True) nozzle_node.setVisible(True)
nozzle_node.setPosition(head_position) nozzle_node.setPosition(head_position)
nozzle_batch = RenderBatch(self._nozzle_shader, type = RenderBatch.RenderType.Solid) nozzle_batch = RenderBatch(self._nozzle_shader, type = RenderBatch.RenderType.Transparent)
nozzle_batch.addItem(nozzle_node.getWorldTransformation(), mesh = nozzle_node.getMeshData()) nozzle_batch.addItem(nozzle_node.getWorldTransformation(), mesh = nozzle_node.getMeshData())
nozzle_batch.render(self._scene.getActiveCamera()) nozzle_batch.render(self._scene.getActiveCamera())

View file

@ -199,6 +199,7 @@ Item
{ {
layerTypeCombobox.currentIndex = UM.SimulationView.compatibilityMode ? 1 : UM.Preferences.getValue("layerview/layer_view_type"); layerTypeCombobox.currentIndex = UM.SimulationView.compatibilityMode ? 1 : UM.Preferences.getValue("layerview/layer_view_type");
layerTypeCombobox.updateLegends(layerTypeCombobox.currentIndex); layerTypeCombobox.updateLegends(layerTypeCombobox.currentIndex);
playButton.pauseSimulation();
viewSettings.extruder_opacities = UM.Preferences.getValue("layerview/extruder_opacities").split("|"); viewSettings.extruder_opacities = UM.Preferences.getValue("layerview/extruder_opacities").split("|");
viewSettings.show_travel_moves = UM.Preferences.getValue("layerview/show_travel_moves"); viewSettings.show_travel_moves = UM.Preferences.getValue("layerview/show_travel_moves");
viewSettings.show_helpers = UM.Preferences.getValue("layerview/show_helpers"); viewSettings.show_helpers = UM.Preferences.getValue("layerview/show_helpers");

View file

@ -15,7 +15,6 @@ class SimulationViewProxy(QObject):
self._controller = Application.getInstance().getController() self._controller = Application.getInstance().getController()
self._controller.activeViewChanged.connect(self._onActiveViewChanged) self._controller.activeViewChanged.connect(self._onActiveViewChanged)
self._onActiveViewChanged() self._onActiveViewChanged()
self.is_simulationView_selected = False self.is_simulationView_selected = False
currentLayerChanged = pyqtSignal() currentLayerChanged = pyqtSignal()
@ -238,7 +237,6 @@ class SimulationViewProxy(QObject):
def _onActiveViewChanged(self): def _onActiveViewChanged(self):
active_view = self._controller.getActiveView() active_view = self._controller.getActiveView()
if isinstance(active_view, SimulationView.SimulationView.SimulationView): if isinstance(active_view, SimulationView.SimulationView.SimulationView):
# remove other connection if once the SimulationView was created. # remove other connection if once the SimulationView was created.
if self.is_simulationView_selected: if self.is_simulationView_selected:
active_view.currentLayerNumChanged.disconnect(self._onLayerChanged) active_view.currentLayerNumChanged.disconnect(self._onLayerChanged)

View file

@ -45,6 +45,15 @@ _OLD_NOT_SUPPORTED_PROFILES = [
] ]
# Some containers have their specific empty containers, those need to be set correctly.
_EMPTY_CONTAINER_DICT = {
"1": "empty_quality_changes",
"2": "empty_quality",
"3": "empty_material",
"4": "empty_variant",
}
class VersionUpgrade30to31(VersionUpgrade): class VersionUpgrade30to31(VersionUpgrade):
## Gets the version number from a CFG file in Uranium's 3.0 format. ## Gets the version number from a CFG file in Uranium's 3.0 format.
# #
@ -126,6 +135,11 @@ class VersionUpgrade30to31(VersionUpgrade):
if quality_profile_id in _OLD_NOT_SUPPORTED_PROFILES: if quality_profile_id in _OLD_NOT_SUPPORTED_PROFILES:
parser["containers"]["2"] = "empty_quality" parser["containers"]["2"] = "empty_quality"
# fix empty containers
for key, specific_empty_container in _EMPTY_CONTAINER_DICT.items():
if parser.has_option("containers", key) and parser["containers"][key] == "empty":
parser["containers"][key] = specific_empty_container
# Update version numbers # Update version numbers
if "general" not in parser: if "general" not in parser:
parser["general"] = {} parser["general"] = {}

View file

@ -346,7 +346,7 @@ Column
Label { Label {
id: materialInfoLabel id: materialInfoLabel
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: catalog.i18nc("@label", "<a href='%1'>Check material compatibility</a>") text: catalog.i18nc("@label", "<a href='%1'>Check compatibility</a>")
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text") color: UM.Theme.getColor("text")
linkColor: UM.Theme.getColor("text_link") linkColor: UM.Theme.getColor("text_link")

View file

@ -1,36 +0,0 @@
[general]
version = 2
name = Fine
definition = ultimaker3
[metadata]
type = quality
quality_type = normal
material = generic_bam_ultimaker3_AA_0.4
weight = 0
setting_version = 4
[values]
default_material_print_temperature = 225
cool_fan_full_at_height = =layer_height_0 + 2 * layer_height
cool_fan_speed_max = =cool_fan_speed
cool_min_speed = 7
machine_nozzle_cool_down_speed = 0.75
machine_nozzle_heat_up_speed = 1.6
material_standby_temperature = 100
# prime_tower_enable: see CURA-4248
prime_tower_enable = =min(extruderValues('material_surface_energy')) < 100
skin_overlap = 10
speed_layer_0 = 20
top_bottom_thickness = 1
wall_thickness = 1
support_interface_enable = True
support_interface_density = =min(extruderValues('material_surface_energy'))
support_interface_pattern = ='lines' if support_interface_density < 100 else 'concentric'
support_top_distance = =math.ceil(min(extruderValues('material_adhesion_tendency')) / 1) * layer_height
support_bottom_distance = =math.ceil(min(extruderValues('material_adhesion_tendency')) / 2) * layer_height
support_angle = 45
support_join_distance = 5
support_offset = 2
support_pattern = triangles
support_infill_rate = 10