From 5be8b2810dbcde6274513f71abaadf9e792b5fa6 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Thu, 22 Nov 2018 22:10:54 +0100 Subject: [PATCH 1/5] Fix: if load a model and scale it up to 0.1mm and then load another model then Cura will crash. It happens because the model 1 does not have any points for arranging it on the build plate CURA-5867 --- cura/Arranging/Arrange.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cura/Arranging/Arrange.py b/cura/Arranging/Arrange.py index 5657ee991a..32796005c8 100644 --- a/cura/Arranging/Arrange.py +++ b/cura/Arranging/Arrange.py @@ -66,6 +66,11 @@ class Arrange: continue vertices = vertices.getMinkowskiHull(Polygon.approximatedCircle(min_offset)) points = copy.deepcopy(vertices._points) + + # After scaling (like up to 0.1 mm) the node might not have points + if len(points) == 0: + continue + shape_arr = ShapeArray.fromPolygon(points, scale = scale) arranger.place(0, 0, shape_arr) From 1b11164340d93ee6f955a6b710dd2dbe3865489a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 18 Dec 2018 16:09:19 +0100 Subject: [PATCH 2/5] Remove unused import and add documentation --- cura/Machines/Models/FavoriteMaterialsModel.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cura/Machines/Models/FavoriteMaterialsModel.py b/cura/Machines/Models/FavoriteMaterialsModel.py index cc273e55ce..98a2a01597 100644 --- a/cura/Machines/Models/FavoriteMaterialsModel.py +++ b/cura/Machines/Models/FavoriteMaterialsModel.py @@ -1,10 +1,9 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from UM.Logger import Logger from cura.Machines.Models.BaseMaterialsModel import BaseMaterialsModel - +## Model that shows the list of favorite materials. class FavoriteMaterialsModel(BaseMaterialsModel): def __init__(self, parent = None): super().__init__(parent) From c66257bf4d42c5649606de352cf41496bd7a90dd Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 18 Dec 2018 16:18:01 +0100 Subject: [PATCH 3/5] Use item instead of transparent rectangle This is faster to render. Contributes to issue CURA-6032. --- .../qml/Preferences/Materials/MaterialsBrandSection.qml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/resources/qml/Preferences/Materials/MaterialsBrandSection.qml b/resources/qml/Preferences/Materials/MaterialsBrandSection.qml index a3a0e4708f..c40693e343 100644 --- a/resources/qml/Preferences/Materials/MaterialsBrandSection.qml +++ b/resources/qml/Preferences/Materials/MaterialsBrandSection.qml @@ -1,5 +1,5 @@ // Copyright (c) 2018 Ultimaker B.V. -// Uranium is released under the terms of the LGPLv3 or higher. +// Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 import QtQuick.Controls 1.4 @@ -69,11 +69,7 @@ Rectangle } style: ButtonStyle { - background: Rectangle - { - anchors.fill: parent - color: "transparent" - } + background: Item { } } } } From c0c45519a06847d49a745dd2d23537350b937710 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 18 Dec 2018 16:49:41 +0100 Subject: [PATCH 4/5] Change another useless rectangle into an item It's more efficient to render. Also changed some code style. Contributes to issue CURA-6032. --- .../qml/Preferences/Materials/MaterialsSlot.qml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/resources/qml/Preferences/Materials/MaterialsSlot.qml b/resources/qml/Preferences/Materials/MaterialsSlot.qml index a706aaf2b9..fb3cb9607d 100644 --- a/resources/qml/Preferences/Materials/MaterialsSlot.qml +++ b/resources/qml/Preferences/Materials/MaterialsSlot.qml @@ -1,5 +1,5 @@ // Copyright (c) 2018 Ultimaker B.V. -// Uranium is released under the terms of the LGPLv3 or higher. +// Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 import QtQuick.Controls 1.4 @@ -70,7 +70,8 @@ Rectangle } onClicked: { - if (materialSlot.is_favorite) { + if (materialSlot.is_favorite) + { base.materialManager.removeFavorite(material.root_material_id) materialSlot.is_favorite = false return @@ -81,13 +82,10 @@ Rectangle } style: ButtonStyle { - background: Rectangle - { - anchors.fill: parent - color: "transparent" - } + background: Item { } } - UM.RecolorImage { + UM.RecolorImage + { anchors { verticalCenter: favorite_button.verticalCenter From 66ed9ed201dd3873c98fda46508243e4902a41ce Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 18 Dec 2018 16:52:04 +0100 Subject: [PATCH 5/5] Remove optimisation that broke updates of models upon metadata change If the metadata changed, such as whether a material was favourite or not, then the materials models were not updating any more because the actual list of available materials was still the same. I've removed this optimisation and tested performance locally. It seems to be slightly slower (though that might be placebo or measurement error). However most of the performance boost of cura-6016 was resulting from different changes there so the interface still seems to be quite a lot faster than what it used to be. Contributes to issue CURA-6032. --- cura/Machines/Models/BaseMaterialsModel.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cura/Machines/Models/BaseMaterialsModel.py b/cura/Machines/Models/BaseMaterialsModel.py index 629e5c2b48..212e4fcf1e 100644 --- a/cura/Machines/Models/BaseMaterialsModel.py +++ b/cura/Machines/Models/BaseMaterialsModel.py @@ -106,10 +106,7 @@ class BaseMaterialsModel(ListModel): return False extruder_stack = global_stack.extruders[extruder_position] - available_materials = self._material_manager.getAvailableMaterialsForMachineExtruder(global_stack, extruder_stack) - if available_materials == self._available_materials: - return False - self._available_materials = available_materials + self._available_materials = self._material_manager.getAvailableMaterialsForMachineExtruder(global_stack, extruder_stack) if self._available_materials is None: return False