Merge branch '3.0'

This commit is contained in:
Ghostkeeper 2017-09-22 09:55:05 +02:00
commit 12ccc8abe0
No known key found for this signature in database
GPG Key ID: C5F96EE2BC0F7E75
9 changed files with 69 additions and 68 deletions

View File

@ -61,8 +61,6 @@ class QualityManager:
machine_definition = global_stack.definition machine_definition = global_stack.definition
result = self.findAllQualityChangesForMachine(machine_definition) result = self.findAllQualityChangesForMachine(machine_definition)
for extruder in self.findAllExtruderDefinitionsForMachine(machine_definition):
result.extend(self.findAllQualityChangesForExtruder(extruder))
result = [quality_change for quality_change in result if quality_change.getName() == quality_changes_name] result = [quality_change for quality_change in result if quality_change.getName() == quality_changes_name]
return result return result
@ -151,7 +149,7 @@ class QualityManager:
else: else:
definition_id = "fdmprinter" definition_id = "fdmprinter"
filter_dict = { "type": "quality_changes", "extruder": None, "definition": definition_id } filter_dict = { "type": "quality_changes", "definition": definition_id }
quality_changes_list = ContainerRegistry.getInstance().findInstanceContainers(**filter_dict) quality_changes_list = ContainerRegistry.getInstance().findInstanceContainers(**filter_dict)
return quality_changes_list return quality_changes_list

View File

@ -965,7 +965,7 @@ class MachineManager(QObject):
if container_type == "quality": if container_type == "quality":
stack.quality.nameChanged.disconnect(self._onQualityNameChanged) stack.quality.nameChanged.disconnect(self._onQualityNameChanged)
stack.setQuality(container, postpone_emit = postpone_emit) stack.setQuality(container, postpone_emit = postpone_emit)
stack.qualityChanges.nameChanged.connect(self._onQualityNameChanged) stack.quality.nameChanged.connect(self._onQualityNameChanged)
elif container_type == "quality_changes" or container_type is None: elif container_type == "quality_changes" or container_type is None:
# If the container is an empty container, we need to change the quality_changes. # If the container is an empty container, we need to change the quality_changes.
# Quality can never be set to empty. # Quality can never be set to empty.

View File

@ -75,6 +75,7 @@ class ProfilesModel(InstanceContainersModel):
# The actual list of quality profiles come from the first extruder in the extruder list. # The actual list of quality profiles come from the first extruder in the extruder list.
result = QualityManager.getInstance().findAllQualitiesForMachineAndMaterials(global_stack_definition, result = QualityManager.getInstance().findAllQualitiesForMachineAndMaterials(global_stack_definition,
materials) materials)
for quality in QualityManager.getInstance().findAllUsableQualitiesForMachineAndExtruders( for quality in QualityManager.getInstance().findAllUsableQualitiesForMachineAndExtruders(
global_container_stack, extruder_stacks): global_container_stack, extruder_stacks):
if quality not in result: if quality not in result:

View File

@ -25,21 +25,30 @@ class QualityAndUserProfilesModel(ProfilesModel):
machine_definition = quality_manager.getParentMachineDefinition(global_container_stack.getBottom()) machine_definition = quality_manager.getParentMachineDefinition(global_container_stack.getBottom())
quality_changes_list = quality_manager.findAllQualityChangesForMachine(machine_definition) quality_changes_list = quality_manager.findAllQualityChangesForMachine(machine_definition)
# Detecting if the machine has multiple extrusion
multiple_extrusion = False
# Get the list of extruders and place the selected extruder at the front of the list. # Get the list of extruders and place the selected extruder at the front of the list.
extruder_manager = ExtruderManager.getInstance() extruder_manager = ExtruderManager.getInstance()
active_extruder = extruder_manager.getActiveExtruderStack() active_extruder = extruder_manager.getActiveExtruderStack()
extruder_stacks = extruder_manager.getActiveExtruderStacks() extruder_stacks = extruder_manager.getActiveExtruderStacks()
if active_extruder in extruder_stacks: if active_extruder in extruder_stacks:
multiple_extrusion = True
extruder_stacks.remove(active_extruder) extruder_stacks.remove(active_extruder)
extruder_stacks = [active_extruder] + extruder_stacks extruder_stacks = [active_extruder] + extruder_stacks
# Fetch the list of useable qualities across all extruders. # Fetch the list of useable qualities across all extruders.
# The actual list of quality profiles come from the first extruder in the extruder list. # The actual list of quality profiles come from the first extruder in the extruder list.
quality_list = QualityManager.getInstance().findAllUsableQualitiesForMachineAndExtruders(global_container_stack, quality_list = quality_manager.findAllUsableQualitiesForMachineAndExtruders(global_container_stack,
extruder_stacks) extruder_stacks)
# 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 qc.getMetaDataEntry("quality_type") in quality_type_set and qc.getMetaDataEntry("extruder") is None]
if multiple_extrusion:
# If the printer has multiple extruders then quality changes related to the current extruder are kept
filtered_quality_changes = [qc for qc in quality_changes_list if qc.getMetaDataEntry("quality_type") in quality_type_set and qc.getMetaDataEntry("extruder") == active_extruder.definition.getId()]
else:
# If not, the quality changes of the global stack are selected
filtered_quality_changes = [qc for qc in quality_changes_list if qc.getMetaDataEntry("quality_type") in quality_type_set]
return quality_list + filtered_quality_changes return quality_list + filtered_quality_changes

View File

@ -12,12 +12,12 @@ from UM.Mesh.MeshBuilder import MeshBuilder
from UM.Mesh.MeshReader import MeshReader from UM.Mesh.MeshReader import MeshReader
from UM.Scene.GroupDecorator import GroupDecorator from UM.Scene.GroupDecorator import GroupDecorator
from cura.Settings.SettingOverrideDecorator import SettingOverrideDecorator from cura.Settings.SettingOverrideDecorator import SettingOverrideDecorator
from cura.ZOffsetDecorator import ZOffsetDecorator
from UM.Application import Application from UM.Application import Application
from cura.Settings.ExtruderManager import ExtruderManager from cura.Settings.ExtruderManager import ExtruderManager
from cura.QualityManager import QualityManager from cura.QualityManager import QualityManager
from UM.Scene.SceneNode import SceneNode from UM.Scene.SceneNode import SceneNode
from cura.SliceableObjectDecorator import SliceableObjectDecorator from cura.SliceableObjectDecorator import SliceableObjectDecorator
from cura.ZOffsetDecorator import ZOffsetDecorator
MYPY = False MYPY = False
@ -47,7 +47,7 @@ class ThreeMFReader(MeshReader):
def _createMatrixFromTransformationString(self, transformation): def _createMatrixFromTransformationString(self, transformation):
if transformation == "": if transformation == "":
return Matrix() return Matrix()
splitted_transformation = transformation.split() splitted_transformation = transformation.split()
## Transformation is saved as: ## Transformation is saved as:
## M00 M01 M02 0.0 ## M00 M01 M02 0.0
@ -105,8 +105,8 @@ class ThreeMFReader(MeshReader):
# Add the setting override decorator, so we can add settings to this node. # Add the setting override decorator, so we can add settings to this node.
if settings: if settings:
um_node.addDecorator(SettingOverrideDecorator()) um_node.addDecorator(SettingOverrideDecorator())
global_container_stack = Application.getInstance().getGlobalContainerStack()
global_container_stack = Application.getInstance().getGlobalContainerStack()
# Ensure the correct next container for the SettingOverride decorator is set. # Ensure the correct next container for the SettingOverride decorator is set.
if global_container_stack: if global_container_stack:
multi_extrusion = global_container_stack.getProperty("machine_extruder_count", "value") > 1 multi_extrusion = global_container_stack.getProperty("machine_extruder_count", "value") > 1
@ -144,15 +144,12 @@ class ThreeMFReader(MeshReader):
if len(um_node.getChildren()) > 0: if len(um_node.getChildren()) > 0:
group_decorator = GroupDecorator() group_decorator = GroupDecorator()
um_node.addDecorator(group_decorator) um_node.addDecorator(group_decorator)
um_node.setSelectable(True) um_node.setSelectable(True)
if um_node.getMeshData(): if um_node.getMeshData():
# Assuming that all nodes with mesh data are printable objects # Assuming that all nodes with mesh data are printable objects
# affects (auto) slicing # affects (auto) slicing
sliceable_decorator = SliceableObjectDecorator() sliceable_decorator = SliceableObjectDecorator()
um_node.addDecorator(sliceable_decorator) um_node.addDecorator(sliceable_decorator)
return um_node return um_node
def read(self, file_name): def read(self, file_name):
@ -172,18 +169,10 @@ class ThreeMFReader(MeshReader):
transform_matrix = Matrix() transform_matrix = Matrix()
mesh_data = um_node.getMeshData() mesh_data = um_node.getMeshData()
if mesh_data is not None: if mesh_data is not None:
extents = mesh_data.getExtents() extents = mesh_data.getExtents()
center_vector = Vector(extents.center.x, extents.center.y, extents.center.z) center_vector = Vector(extents.center.x, extents.center.y, extents.center.z)
# If the object in a saved project is below the bed, keep it that way
if extents.minimum.z < 0.0:
um_node.addDecorator(ZOffsetDecorator())
um_node.callDecoration("setZOffset", extents.minimum.z)
transform_matrix.setByTranslation(center_vector) transform_matrix.setByTranslation(center_vector)
transform_matrix.multiply(um_node.getLocalTransformation()) transform_matrix.multiply(um_node.getLocalTransformation())
um_node.setTransformation(transform_matrix) um_node.setTransformation(transform_matrix)
@ -215,6 +204,13 @@ class ThreeMFReader(MeshReader):
# Pre multiply the transformation with the loaded transformation, so the data is handled correctly. # Pre multiply the transformation with the loaded transformation, so the data is handled correctly.
um_node.setTransformation(um_node.getLocalTransformation().preMultiply(transformation_matrix)) um_node.setTransformation(um_node.getLocalTransformation().preMultiply(transformation_matrix))
# Check if the model is positioned below the build plate and honor that when loading project files.
if um_node.getMeshData() is not None:
minimum_z_value = um_node.getMeshData().getExtents(um_node.getWorldTransformation()).minimum.y # y is z in transformation coordinates
if minimum_z_value < 0:
um_node.addDecorator(ZOffsetDecorator())
um_node.callDecoration("setZOffset", minimum_z_value)
result.append(um_node) result.append(um_node)
except Exception: except Exception:

View File

@ -195,8 +195,8 @@ class CuraEngineBackend(QObject, Backend):
self.backendStateChange.emit(BackendState.Done) self.backendStateChange.emit(BackendState.Done)
Logger.log("w", "Slice unnecessary, nothing has changed that needs reslicing.") Logger.log("w", "Slice unnecessary, nothing has changed that needs reslicing.")
return return
if Application.getInstance().getPrintInformation():
Application.getInstance().getPrintInformation().setToZeroPrintInformation() Application.getInstance().getPrintInformation().setToZeroPrintInformation()
self._stored_layer_data = [] self._stored_layer_data = []
self._stored_optimized_layer_data = [] self._stored_optimized_layer_data = []

View File

@ -342,7 +342,7 @@ Item
{ {
id: slider id: slider
width: handleSize width: handleSize
height: parent.height - 2*UM.Theme.getSize("slider_layerview_margin").height height: UM.Theme.getSize("layerview_menu_size").height
anchors.top: parent.bottom anchors.top: parent.bottom
anchors.topMargin: UM.Theme.getSize("slider_layerview_margin").height anchors.topMargin: UM.Theme.getSize("slider_layerview_margin").height
anchors.right: layerViewMenu.right anchors.right: layerViewMenu.right

View File

@ -53,7 +53,7 @@ Item
Component.onCompleted: Component.onCompleted:
{ {
qualityRow.updateAvailableTotalTicks() qualityRow.updateQualitySliderProperties()
} }
Connections Connections
@ -61,17 +61,10 @@ Item
target: Cura.MachineManager target: Cura.MachineManager
onActiveQualityChanged: onActiveQualityChanged:
{ {
qualityRow.updateAvailableTotalTicks() qualityRow.updateQualitySliderProperties()
} }
} }
/*
Component.onCompleted:
{
updateCurrentQualityIndex();
updateBar();
}
*/
id: qualityRow id: qualityRow
@ -84,7 +77,7 @@ Item
property var sliderAvailableMax : 0 property var sliderAvailableMax : 0
property var sliderMarginRight : 0 property var sliderMarginRight : 0
function updateAvailableTotalTicks() function updateQualitySliderProperties()
{ {
qualityRow.totalTicks = Cura.ProfilesModel.rowCount() - 1 // minus one, because slider starts from 0 qualityRow.totalTicks = Cura.ProfilesModel.rowCount() - 1 // minus one, because slider starts from 0
@ -142,12 +135,6 @@ Item
qualityRow.sliderAvailableMin = availableMin qualityRow.sliderAvailableMin = availableMin
qualityRow.sliderAvailableMax = availableMax qualityRow.sliderAvailableMax = availableMax
//console.log("==>>FIND.availableMin: " + availableMin)
//console.log("==>>FIND.availableMax: " + availableMax)
//console.log("==>>FIND.qualitySliderSelectedValue: " + qualitySliderSelectedValue)
//console.log("==>>FIND.sliderMarginRightVALUE: "+ sliderMarginRight)
} }
height: UM.Theme.getSize("sidebar_margin").height height: UM.Theme.getSize("sidebar_margin").height
@ -179,10 +166,8 @@ Item
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: UM.Theme.getSize("sidebar_margin").height / 2 anchors.topMargin: UM.Theme.getSize("sidebar_margin").height / 2
color: UM.Theme.getColor("text") color: UM.Theme.getColor("text")
text: text: Cura.ProfilesModel.getItem(index).layer_height_without_unit
{
return Cura.ProfilesModel.getItem(index).layer_height_without_unit
}
width: 1 width: 1
x: x:
{ {
@ -213,7 +198,7 @@ Item
height: 2 height: 2
color: UM.Theme.getColor("quality_slider_unavailable") color: UM.Theme.getColor("quality_slider_unavailable")
//radius: parent.radius //radius: parent.radius
y: 9 anchors.verticalCenter: qualityRowSlider.verticalCenter
x: 0 x: 0
} }
@ -248,26 +233,24 @@ Item
value: qualityRow.qualitySliderSelectedValue value: qualityRow.qualitySliderSelectedValue
width:{ width: qualityRow.qualitySliderStep * (qualityRow.availableTotalTicks)
return qualityRow.qualitySliderStep * (qualityRow.availableTotalTicks)
}
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin:{ anchors.rightMargin: qualityRow.sliderMarginRight
return qualityRow.sliderMarginRight
}
style: SliderStyle style: SliderStyle
{ {
//Draw Available line //Draw Available line
groove: Rectangle { groove: Rectangle {
implicitHeight: 2 implicitHeight: 2
anchors.verticalCenter: qualityRowSlider.verticalCenter
color: UM.Theme.getColor("quality_slider_available") color: UM.Theme.getColor("quality_slider_available")
radius: 1 radius: 1
} }
handle: Item { handle: Item {
Rectangle { Rectangle {
id: qualityhandleButton id: qualityhandleButton
anchors.verticalCenter: qualityRowSlider.verticalCenter
anchors.centerIn: parent anchors.centerIn: parent
color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
implicitWidth: 10 implicitWidth: 10
@ -334,7 +317,7 @@ Item
id: infillCellLeft id: infillCellLeft
anchors.top: qualityRow.bottom anchors.top: qualityRow.bottom
anchors.topMargin: UM.Theme.getSize("sidebar_margin").height anchors.topMargin: UM.Theme.getSize("sidebar_margin").height * 2
anchors.left: parent.left anchors.left: parent.left
width: UM.Theme.getSize("sidebar").width * .45 - UM.Theme.getSize("sidebar_margin").width width: UM.Theme.getSize("sidebar").width * .45 - UM.Theme.getSize("sidebar_margin").width
@ -386,6 +369,8 @@ Item
anchors.top: selectedInfillRateText.bottom anchors.top: selectedInfillRateText.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: infillIcon.left
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width
height: UM.Theme.getSize("sidebar_margin").height height: UM.Theme.getSize("sidebar_margin").height
width: infillCellRight.width - UM.Theme.getSize("sidebar_margin").width - style.handleWidth width: infillCellRight.width - UM.Theme.getSize("sidebar_margin").width - style.handleWidth
@ -442,19 +427,23 @@ Item
} }
} }
Item Rectangle
{ {
width: (infillCellRight.width / 5) - (UM.Theme.getSize("sidebar_margin").width) id: infillIcon
width: (parent.width / 5) - (UM.Theme.getSize("sidebar_margin").width)
height: width height: width
anchors.right: infillCellRight.right anchors.right: parent.right
anchors.top: infillSlider.top anchors.top: parent.top
anchors.topMargin: UM.Theme.getSize("sidebar_margin").height / 2
// we loop over all density icons and only show the one that has the current density and steps // we loop over all density icons and only show the one that has the current density and steps
Repeater Repeater
{ {
id: infillIconList id: infillIconList
model: infillModel model: infillModel
anchors.fill: parent
property int activeIndex: { property int activeIndex: {
for (var i = 0; i < infillModel.count; i++) { for (var i = 0; i < infillModel.count; i++) {
@ -472,21 +461,21 @@ Item
return -1 return -1
} }
Item { Rectangle
{
anchors.fill: parent anchors.fill: parent
visible: infillIconList.activeIndex == index
Rectangle { border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("quality_slider_available")
UM.RecolorImage {
anchors.fill: parent anchors.fill: parent
visible: infillIconList.activeIndex == index anchors.margins: 2
sourceSize.width: width
UM.RecolorImage { sourceSize.height: width
id: infillIcon source: UM.Theme.getIcon(model.icon)
anchors.fill: parent color: UM.Theme.getColor("quality_slider_unavailable")
sourceSize.width: width
sourceSize.height: width
source: UM.Theme.getIcon(model.icon)
color: UM.Theme.getColor("quality_slider_available")
}
} }
} }
} }

View File

@ -34,7 +34,15 @@ Item
Button Button
{ {
text: model.name text: model.name
iconSource: UM.Theme.getIcon(model.icon); iconSource:
{
var result = UM.Theme.getIcon(model.icon)
if(result == "")
{
return model.location + "/" + model.icon
}
return result
}
checkable: true; checkable: true;
checked: model.active; checked: model.active;