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

@ -12,12 +12,12 @@ from UM.Mesh.MeshBuilder import MeshBuilder
from UM.Mesh.MeshReader import MeshReader
from UM.Scene.GroupDecorator import GroupDecorator
from cura.Settings.SettingOverrideDecorator import SettingOverrideDecorator
from cura.ZOffsetDecorator import ZOffsetDecorator
from UM.Application import Application
from cura.Settings.ExtruderManager import ExtruderManager
from cura.QualityManager import QualityManager
from UM.Scene.SceneNode import SceneNode
from cura.SliceableObjectDecorator import SliceableObjectDecorator
from cura.ZOffsetDecorator import ZOffsetDecorator
MYPY = False
@ -47,7 +47,7 @@ class ThreeMFReader(MeshReader):
def _createMatrixFromTransformationString(self, transformation):
if transformation == "":
return Matrix()
splitted_transformation = transformation.split()
## Transformation is saved as:
## 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.
if settings:
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.
if global_container_stack:
multi_extrusion = global_container_stack.getProperty("machine_extruder_count", "value") > 1
@ -144,15 +144,12 @@ class ThreeMFReader(MeshReader):
if len(um_node.getChildren()) > 0:
group_decorator = GroupDecorator()
um_node.addDecorator(group_decorator)
um_node.setSelectable(True)
if um_node.getMeshData():
# Assuming that all nodes with mesh data are printable objects
# affects (auto) slicing
sliceable_decorator = SliceableObjectDecorator()
um_node.addDecorator(sliceable_decorator)
return um_node
def read(self, file_name):
@ -172,18 +169,10 @@ class ThreeMFReader(MeshReader):
transform_matrix = Matrix()
mesh_data = um_node.getMeshData()
if mesh_data is not None:
extents = mesh_data.getExtents()
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.multiply(um_node.getLocalTransformation())
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.
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)
except Exception:

View file

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

View file

@ -342,7 +342,7 @@ Item
{
id: slider
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.topMargin: UM.Theme.getSize("slider_layerview_margin").height
anchors.right: layerViewMenu.right