diff --git a/README.md b/README.md index a3e7f9c0d5..c1ebb0993b 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,6 @@ Please checkout [cura-build](https://github.com/Ultimaker/cura-build) Third party plugins ------------- -* [Print Cost Calculator](https://github.com/nallath/PrintCostCalculator): Calculates weight and monetary cost of your print. * [Post Processing Plugin](https://github.com/nallath/PostProcessingPlugin): Allows for post-processing scripts to run on g-code. * [Barbarian Plugin](https://github.com/nallath/BarbarianPlugin): Simple scale tool for imperial to metric. * [X3G Writer](https://github.com/Ghostkeeper/X3GWriter): Adds support for exporting X3G files. diff --git a/cura/Settings/ContainerManager.py b/cura/Settings/ContainerManager.py index 9a2282c8c0..0d776aec20 100644 --- a/cura/Settings/ContainerManager.py +++ b/cura/Settings/ContainerManager.py @@ -218,20 +218,25 @@ class ContainerManager(QObject): entries = entry_name.split("/") entry_name = entries.pop() + sub_item_changed = False if entries: root_name = entries.pop(0) root = container.getMetaDataEntry(root_name) item = root - for entry in entries: + for _ in range(len(entries)): item = item.get(entries.pop(0), { }) + if item[entry_name] != entry_value: + sub_item_changed = True item[entry_name] = entry_value entry_name = root_name entry_value = root container.setMetaDataEntry(entry_name, entry_value) + if sub_item_changed: #If it was only a sub-item that has changed then the setMetaDataEntry won't correctly notice that something changed, and we must manually signal that the metadata changed. + container.metaDataChanged.emit(container) return True diff --git a/cura/Settings/MaterialManager.py b/cura/Settings/MaterialManager.py index abfafc5f9f..8bb7b525f8 100644 --- a/cura/Settings/MaterialManager.py +++ b/cura/Settings/MaterialManager.py @@ -49,6 +49,8 @@ class MaterialManager(QObject): if button == "Undo": container_manager = ContainerManager.getInstance() container_manager.setContainerMetaDataEntry(self._material_diameter_warning_message.material_id, "properties/diameter", self._material_diameter_warning_message.previous_diameter) + approximate_previous_diameter = str(round(float(self._material_diameter_warning_message.previous_diameter))) + container_manager.setContainerMetaDataEntry(self._material_diameter_warning_message.material_id, "approximate_diameter", approximate_previous_diameter) message.hide() else: Logger.log("w", "Unknown button action for material diameter warning message: {action}".format(action = button)) \ No newline at end of file diff --git a/plugins/CuraEngineBackend/StartSliceJob.py b/plugins/CuraEngineBackend/StartSliceJob.py index c83ffb655d..f2e9cb7db2 100644 --- a/plugins/CuraEngineBackend/StartSliceJob.py +++ b/plugins/CuraEngineBackend/StartSliceJob.py @@ -44,6 +44,14 @@ class GcodeStartEndFormatter(Formatter): ## Job class that builds up the message of scene data to send to CuraEngine. class StartSliceJob(Job): + ## Meshes that are sent to the engine regardless of being outside of the + # build volume. + # + # If these settings are True for any mesh, the build volume is ignored. + # Note that Support Mesh is not in here because it actually generates + # g-code in the volume of the mesh. + _not_printed_mesh_settings = {"anti_overhang_mesh", "infill_mesh", "cutting_mesh"} + def __init__(self, slice_message): super().__init__() @@ -132,7 +140,8 @@ class StartSliceJob(Job): temp_list = [] for node in DepthFirstIterator(self._scene.getRoot()): if type(node) is SceneNode and node.getMeshData() and node.getMeshData().getVertices() is not None: - if not getattr(node, "_outside_buildarea", False): + if not getattr(node, "_outside_buildarea", False)\ + or (node.callDecoration("getStack") and any(node.callDecoration("getStack").getProperty(setting, "value") for setting in self._not_printed_mesh_settings)): temp_list.append(node) Job.yieldThread() diff --git a/resources/qml/Preferences/MaterialView.qml b/resources/qml/Preferences/MaterialView.qml index 39f2db0695..39692a9f84 100644 --- a/resources/qml/Preferences/MaterialView.qml +++ b/resources/qml/Preferences/MaterialView.qml @@ -169,9 +169,11 @@ TabView // This does not use a SettingPropertyProvider, because we need to make the change to all containers // which derive from the same base_file var old_diameter = Cura.ContainerManager.getContainerProperty(base.containerId, "material_diameter", "value").toString(); - base.setMetaDataEntry("approximate_diameter", properties.approximate_diameter, Math.round(value).toString()); + var old_approximate_diameter = Cura.ContainerManager.getContainerMetaDataEntry(base.containerId, "approximate_diameter"); + base.setMetaDataEntry("approximate_diameter", old_approximate_diameter, Math.round(value).toString()); base.setMetaDataEntry("properties/diameter", properties.diameter, value); - if (Cura.MachineManager.filterMaterialsByMachine && properties.approximate_diameter != Cura.MachineManager.activeMachine.approximateMaterialDiameter) + var new_approximate_diameter = Cura.ContainerManager.getContainerMetaDataEntry(base.containerId, "approximate_diameter"); + if (Cura.MachineManager.filterMaterialsByMachine && new_approximate_diameter != Cura.MachineManager.activeMachine.approximateMaterialDiameter) { Cura.MaterialManager.showMaterialWarningMessage(base.containerId, old_diameter); } diff --git a/tests/Settings/TestGlobalStack.py b/tests/Settings/TestGlobalStack.py index 3cac17fa3a..c6491d574c 100755 --- a/tests/Settings/TestGlobalStack.py +++ b/tests/Settings/TestGlobalStack.py @@ -12,6 +12,7 @@ from UM.Settings.InstanceContainer import InstanceContainer #To test against the from UM.Settings.SettingInstance import InstanceState import UM.Settings.ContainerRegistry import UM.Settings.ContainerStack +import UM.Settings.SettingDefinition #To add settings to the definition. ## Fake container registry that always provides all containers you ask of. @pytest.yield_fixture() @@ -96,11 +97,14 @@ def test_addExtruder(global_stack): #Exceptional cases. (0, 0), (-10.1, -10), - (-1, -1) + (-1, -1), + (9000.1, 9000) ]) def test_approximateMaterialDiameter(diameter, approximate_diameter, global_stack): global_stack.definition = DefinitionContainer(container_id = "TestDefinition") - global_stack.definition._metadata["material_diameter"] = str(diameter) + material_diameter = UM.Settings.SettingDefinition.SettingDefinition(key = "material_diameter", container = global_stack.definition) + material_diameter.addSupportedProperty("value", UM.Settings.SettingDefinition.DefinitionPropertyType.Any, default = diameter) + global_stack.definition.definitions.append(material_diameter) assert float(global_stack.approximateMaterialDiameter) == approximate_diameter ## Tests getting the material diameter when there is no material diameter.