Skip to content

Commit

Permalink
Merge branch 'tdx-integration' of github.com:pskowronskiTDx/Cura into…
Browse files Browse the repository at this point in the history
… tdx-integration
  • Loading branch information
Patryk Skowroński committed Nov 14, 2024
2 parents cab2ee4 + 67d977f commit 429818c
Show file tree
Hide file tree
Showing 7,737 changed files with 66,137 additions and 8,787 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 2 additions & 2 deletions conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "5.9.0-alpha.0"
version: "5.10.0-alpha.0"
requirements:
- "cura_resources/(latest)@ultimaker/testing"
- "uranium/(latest)@ultimaker/testing"
Expand All @@ -10,7 +10,7 @@ requirements:
- "pynest2d/5.3.0"
- "native_cad_plugin/2.0.0"
requirements_internal:
- "fdm_materials/5.8.1"
- "fdm_materials/(latest)@ultimaker/testing"
- "cura_private_data/(latest)@internal/testing"
urls:
default:
Expand Down
2 changes: 1 addition & 1 deletion cura/ApplicationMetadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# Each release has a fixed SDK version coupled with it. It doesn't make sense to make it configurable because, for
# example Cura 3.2 with SDK version 6.1 will not work. So the SDK version is hard-coded here and left out of the
# CuraVersion.py.in template.
CuraSDKVersion = "8.8.0"
CuraSDKVersion = "8.9.0"

try:
from cura.CuraVersion import CuraLatestURL
Expand Down
2 changes: 1 addition & 1 deletion cura/CuraApplication.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class CuraApplication(QtApplication):
# SettingVersion represents the set of settings available in the machine/extruder definitions.
# You need to make sure that this version number needs to be increased if there is any non-backwards-compatible
# changes of the settings.
SettingVersion = 23
SettingVersion = 24

Created = False

Expand Down
1 change: 1 addition & 0 deletions cura/Machines/MachineNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def __init__(self, container_id: str) -> None:
self.preferred_variant_name = my_metadata.get("preferred_variant_name", "")
self.preferred_material = my_metadata.get("preferred_material", "")
self.preferred_quality_type = my_metadata.get("preferred_quality_type", "")
self.supports_abstract_color = parseBool(my_metadata.get("supports_abstract_color", "false"))

self._loadAll()

Expand Down
7 changes: 3 additions & 4 deletions cura/Machines/Models/QualityManagementModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,12 @@ def renameQualityChangesGroup(self, quality_changes_group: "QualityChangesGroup"
# have no container for the global stack, because "my_profile" just got renamed to "my_new_profile". This results
# in crashes because the rest of the system assumes that all data in a QualityChangesGroup will be correct.
#
# Renaming the container for the global stack in the end seems to be ok, because the assumption is mostly based
# on the quality changes container for the global stack.
# This is why we use the "supress_signals" flag for the set name. This basically makes the change silent.
for metadata in quality_changes_group.metadata_per_extruder.values():
extruder_container = cast(InstanceContainer, container_registry.findContainers(id = metadata["id"])[0])
extruder_container.setName(new_name)
extruder_container.setName(new_name, supress_signals=True)
global_container = cast(InstanceContainer, container_registry.findContainers(id = quality_changes_group.metadata_for_global["id"])[0])
global_container.setName(new_name)
global_container.setName(new_name, supress_signals=True)

quality_changes_group.name = new_name

Expand Down
4 changes: 4 additions & 0 deletions cura/Machines/VariantNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def _loadAll(self) -> None:
filtered_materials = [material for material in materials if not self.machine.isExcludedMaterialBaseFile(material["id"])]

for material in filtered_materials:
if material.get("abstract_color", False) and not self.machine.supports_abstract_color:
continue # do not show abstract color profiles if the machine does not support them
base_file = material["base_file"]
if base_file not in self.materials:
self.materials[base_file] = MaterialNode(material["id"], variant = self)
Expand Down Expand Up @@ -126,6 +128,8 @@ def _materialAdded(self, container: ContainerInterface) -> None:
return # We won't add any materials.
material_definition = container.getMetaDataEntry("definition")

if (not self.machine.supports_abstract_color) and container.getMetaDataEntry("abstract_color", False):
return
base_file = container.getMetaDataEntry("base_file")
if self.machine.isExcludedMaterialBaseFile(base_file):
return # Material is forbidden for this printer.
Expand Down
10 changes: 6 additions & 4 deletions cura/PrinterOutput/FormatMaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ class FormatMaps:

# A map from the material-name in their native file-formats to some info, including the internal name we use.
MATERIAL_MAP = {
"abs": {"name": "ABS", "guid": "2780b345-577b-4a24-a2c5-12e6aad3e690"},
"abs": {"name": "ABS", "guid": "e0f1d581-cc6b-4e36-8f3c-3f5601ecba5f"},
"abs-cf10": {"name": "ABS-CF", "guid": "495a0ce5-9daf-4a16-b7b2-06856d82394d"},
"abs-wss1": {"name": "ABS-R", "guid": "88c8919c-6a09-471a-b7b6-e801263d862d"},
"asa": {"name": "ASA", "guid": "f79bc612-21eb-482e-ad6c-87d75bdde066"},
"nylon12-cf": {"name": "Nylon 12 CF", "guid": "3c6f2877-71cc-4760-84e6-4b89ab243e3b"},
"nylon": {"name": "Nylon", "guid": "283d439a-3490-4481-920c-c51d8cdecf9c"},
"nylon-cf": {"name": "Nylon CF", "guid": "17abb865-ca73-4ccd-aeda-38e294c9c60b"},
"nylon": {"name": "Nylon", "guid": "9475b03d-fd19-48a2-b7b5-be1fb46abb02"},
"pc": {"name": "PC", "guid": "62414577-94d1-490d-b1e4-7ef3ec40db02"},
"petg": {"name": "PETG", "guid": "69386c85-5b6c-421a-bec5-aeb1fb33f060"},
"petg": {"name": "PETG", "guid": "2d004bbd-d1bb-47f8-beac-b066702d5273"},
"pla": {"name": "PLA", "guid": "abb9c58e-1f56-48d1-bd8f-055fde3a5b56"},
"pva": {"name": "PVA", "guid": "add51ef2-86eb-4c39-afd5-5586564f0715"},
"wss1": {"name": "RapidRinse", "guid": "a140ef8f-4f26-4e73-abe0-cfc29d6d1024"},
Expand All @@ -44,7 +45,8 @@ class FormatMaps:
"cpe": {"name": "CPE", "guid": "da1872c1-b991-4795-80ad-bdac0f131726"},
"hips": {"name": "HIPS", "guid": "a468d86a-220c-47eb-99a5-bbb47e514eb0"},
"tpu": {"name": "TPU 95A", "guid": "19baa6a9-94ff-478b-b4a1-8157b74358d2"},
"im-pla": {"name": "Tough", "guid": "de031137-a8ca-4a72-bd1b-17bb964033ad"}
"im-pla": {"name": "Tough", "guid": "96fca5d9-0371-4516-9e96-8e8182677f3c"}
# /!\ When changing this list, make sure the changes are reported accordingly on Digital Factory
}

__inverse_printer_name: Optional[Dict[str, str]] = None
Expand Down
1 change: 1 addition & 0 deletions packaging/AppImage-builder/AppImageBuilder.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ AppDir:
QT_PLUGIN_PATH: "$APPDIR/qt/plugins"
QML2_IMPORT_PATH: "$APPDIR/qt/qml"
QT_QPA_PLATFORMTHEME: xdgdesktopportal
QT_QPA_PLATFORM: xcb
GDK_PIXBUF_MODULEDIR: $APPDIR/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders
GDK_PIXBUF_MODULE_FILE: $APPDIR/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache
path_mappings:
Expand Down
1 change: 1 addition & 0 deletions packaging/NSIS/Ultimaker-Cura.nsi.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ CreateShortCut "$SMPROGRAMS\{{ app_name }}\UltiMaker Cura website.lnk" "$INSTDIR
WriteRegStr ${REG_ROOT} "${REG_APP_PATH}" "" "$INSTDIR\${MAIN_APP_EXE}"
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayName" "${APP_NAME}"
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "QuietUninstallString" '"$INSTDIR\uninstall.exe" /S'
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayIcon" "$INSTDIR\${MAIN_APP_EXE}"
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayVersion" "${VERSION}"
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "Publisher" "${COMP_NAME}"
Expand Down
1 change: 1 addition & 0 deletions plugins/3MFReader/ThreeMFReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def _convertSavitarNodeToUMNode(savitar_node: Savitar.SceneNode, file_name: str
vertices = numpy.resize(data, (int(data.size / 3), 3))
mesh_builder.setVertices(vertices)
mesh_builder.calculateNormals(fast=True)
mesh_builder.setMeshId(node_id)
if file_name:
# The filename is used to give the user the option to reload the file if it is changed on disk
# It is only set for the root node of the 3mf file
Expand Down
1 change: 0 additions & 1 deletion plugins/3MFReader/ThreeMFWorkspaceReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1354,7 +1354,6 @@ def _updateActiveMachine(self, global_stack):
return
machine_manager.setQualityChangesGroup(quality_changes_group, no_dialog = True)
else:
self._quality_type_to_apply = self._quality_type_to_apply.lower() if self._quality_type_to_apply else None
quality_group_dict = container_tree.getCurrentQualityGroups()
if self._quality_type_to_apply in quality_group_dict:
quality_group = quality_group_dict[self._quality_type_to_apply]
Expand Down
25 changes: 22 additions & 3 deletions plugins/3MFWriter/ThreeMFWorkspaceWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
from threading import Lock
import zipfile
from typing import Dict, Any
from pathlib import Path
from zipfile import ZipFile

from UM.Application import Application
from UM.Logger import Logger
from UM.PluginRegistry import PluginRegistry
from UM.Preferences import Preferences
from UM.Settings.ContainerRegistry import ContainerRegistry
from UM.Workspace.WorkspaceWriter import WorkspaceWriter
Expand All @@ -33,7 +36,7 @@ def setExportModel(self, model: SettingsExportModel) -> None:
if self._ucp_model != model:
self._ucp_model = model

def _write(self, stream, nodes, mode=WorkspaceWriter.OutputMode.BinaryMode):
def _write(self, stream, nodes, mode, include_log):
application = Application.getInstance()
machine_manager = application.getMachineManager()

Expand Down Expand Up @@ -79,6 +82,11 @@ def _write(self, stream, nodes, mode=WorkspaceWriter.OutputMode.BinaryMode):
if self._ucp_model is not None:
user_settings_data = self._getUserSettings(self._ucp_model)
ThreeMFWriter._storeMetadataJson(user_settings_data, archive, USER_SETTINGS_PATH)

# Write log file
if include_log:
ThreeMFWorkspaceWriter._writeLogFile(archive)

except PermissionError:
self.setInformation(catalog.i18nc("@error:zip", "No permission to write the workspace here."))
Logger.error("No permission to write workspace to this stream.")
Expand Down Expand Up @@ -125,8 +133,8 @@ def _write(self, stream, nodes, mode=WorkspaceWriter.OutputMode.BinaryMode):

return True

def write(self, stream, nodes, mode=WorkspaceWriter.OutputMode.BinaryMode):
success = self._write(stream, nodes, mode=WorkspaceWriter.OutputMode.BinaryMode)
def write(self, stream, nodes, mode=WorkspaceWriter.OutputMode.BinaryMode, **kwargs):
success = self._write(stream, nodes, WorkspaceWriter.OutputMode.BinaryMode, kwargs.get("include_log", False))
self._ucp_model = None
return success

Expand Down Expand Up @@ -191,6 +199,17 @@ def _writeContainerToArchive(container, archive):
Logger.error("File became inaccessible while writing to it: {archive_filename}".format(archive_filename = archive.fp.name))
return

@staticmethod
def _writeLogFile(archive: ZipFile) -> None:
"""Helper function that writes the Cura log file to the archive.
:param archive: The archive to write to.
"""
file_logger = PluginRegistry.getInstance().getPluginObject("FileLogger")
file_logger.flush()
for file_path in file_logger.getFilesPaths():
archive.write(file_path, arcname=f"log/{Path(file_path).name}")

@staticmethod
def _getUserSettings(model: SettingsExportModel) -> Dict[str, Dict[str, Any]]:
user_settings = {}
Expand Down
31 changes: 29 additions & 2 deletions plugins/CuraEngineBackend/CuraEngineBackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ def __init__(self) -> None:
"""

super().__init__()
self._init_done = False
self._immediate_slice_after_init = False

# Find out where the engine is located, and how it is called.
# This depends on how Cura is packaged and which OS we are running on.
executable_name = "CuraEngine"
Expand Down Expand Up @@ -197,7 +200,8 @@ def __init__(self) -> None:
self._slicing_error_message.actionTriggered.connect(self._reportBackendError)

self._resetLastSliceTimeStats()
self._snapshot: Optional[QImage] = None
self._snapshot: Optional[QImage] = None
self._last_socket_error: Optional[Arcus.Error] = None

application.initializationFinished.connect(self.initialize)

Expand Down Expand Up @@ -267,6 +271,10 @@ def initialize(self) -> None:
self._machine_error_checker = application.getMachineErrorChecker()
self._machine_error_checker.errorCheckFinished.connect(self._onStackErrorCheckFinished)

self._init_done = True
if self._immediate_slice_after_init:
self.slice()

def close(self) -> None:
"""Terminate the engine process.
Expand Down Expand Up @@ -341,6 +349,11 @@ def getLatestSnapshot(self) -> Optional[QImage]:
def slice(self) -> None:
"""Perform a slice of the scene."""

if not self._init_done:
self._immediate_slice_after_init = True
return
self._immediate_slice_after_init = False

self._createSnapshot()

self.startPlugins()
Expand Down Expand Up @@ -569,7 +582,20 @@ def _onStartSliceCompleted(self, job: StartSliceJob) -> None:
return

# Preparation completed, send it to the backend.
self._socket.sendMessage(job.getSliceMessage())
immediate_success = self._socket.sendMessage(job.getSliceMessage())
if (not CuraApplication.getInstance().getUseExternalBackend()) and (not immediate_success):
if self._last_socket_error is not None and self._last_socket_error.getErrorCode() == Arcus.ErrorCode.MessageTooBigError:
error_txt = catalog.i18nc("@info:status", "Unable to send the model data to the engine. Please try to use a less detailed model, or reduce the number of instances.")
else:
error_txt = catalog.i18nc("@info:status", "Unable to send the model data to the engine. Please try again, or contact support.")

self._error_message = Message(error_txt,
title=catalog.i18nc("@info:title", "Unable to slice"),
message_type=Message.MessageType.WARNING)
self._error_message.show()
self.setState(BackendState.Error)
self.backendError.emit(job)
return

# Notify the user that it's now up to the backend to do its job
self.setState(BackendState.Processing)
Expand Down Expand Up @@ -691,6 +717,7 @@ def _onSocketError(self, error: Arcus.Error) -> None:
if error.getErrorCode() == Arcus.ErrorCode.Debug:
return

self._last_socket_error = error
self._terminate()
self._createSocket()

Expand Down
1 change: 1 addition & 0 deletions plugins/CuraEngineBackend/StartSliceJob.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ def _buildExtruderMessage(self, stack: ContainerStack) -> None:

# Replace the setting tokens in start and end g-code.
extruder_nr = stack.getProperty("extruder_nr", "value")
settings["machine_extruder_prestart_code"] = self._expandGcodeTokens(settings["machine_extruder_prestart_code"], extruder_nr)
settings["machine_extruder_start_code"] = self._expandGcodeTokens(settings["machine_extruder_start_code"], extruder_nr)
settings["machine_extruder_end_code"] = self._expandGcodeTokens(settings["machine_extruder_end_code"], extruder_nr)

Expand Down
73 changes: 65 additions & 8 deletions plugins/MachineSettingsAction/MachineSettingsExtruderTab.qml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Item
{
anchors.top: parent.top
anchors.left: parent.left
width: parent.width * 2 / 3
width: parent.width / 2

spacing: base.columnSpacing

Expand Down Expand Up @@ -139,6 +139,39 @@ Item
decimals: 0
forceUpdateOnChangeFunction: forceUpdateFunction
}
}


// =======================================
// Right-side column "Nozzle Settings"
// =======================================
Column
{
anchors.top: parent.top
anchors.right: parent.right
width: parent.width / 2

spacing: base.columnSpacing

UM.Label // Title Label
{
text: catalog.i18nc("@title:label", " ")
font: UM.Theme.getFont("medium_bold")
}

Cura.NumericTextFieldWithUnit
{
id: extruderChangeDurationFieldId
containerStackId: base.extruderStackId
settingKey: "machine_extruder_change_duration"
settingStoreIndex: propertyStoreIndex
labelText: catalog.i18nc("@label", "Extruder Change duration")
labelFont: base.labelFont
labelWidth: base.labelWidth
controlWidth: base.controlWidth
unitText: catalog.i18nc("@label", "s")
forceUpdateOnChangeFunction: forceUpdateFunction
}

Cura.NumericTextFieldWithUnit
{
Expand Down Expand Up @@ -179,18 +212,42 @@ Item
anchors.right: parent.right
anchors.margins: UM.Theme.getSize("default_margin").width

Cura.GcodeTextArea // "Extruder Start G-code"
Column
{
anchors.top: parent.top
anchors.left: parent.left
anchors.bottom: buttonLearnMore.top
anchors.bottomMargin: UM.Theme.getSize("default_margin").height
anchors.left: parent.left
width: base.columnWidth - UM.Theme.getSize("default_margin").width

width: parent.width / 2

labelText: catalog.i18nc("@title:label", "Extruder Start G-code")
containerStackId: base.extruderStackId
settingKey: "machine_extruder_start_code"
settingStoreIndex: propertyStoreIndex
spacing: base.columnSpacing

Cura.GcodeTextArea // "Extruder Prestart G-code"
{
anchors.top: parent.top
anchors.left: parent.left
height: (parent.height / 2) - UM.Theme.getSize("default_margin").height
width: base.columnWidth - UM.Theme.getSize("default_margin").width

labelText: catalog.i18nc("@title:label", "Extruder Prestart G-code")
containerStackId: base.extruderStackId
settingKey: "machine_extruder_prestart_code"
settingStoreIndex: propertyStoreIndex
}

Cura.GcodeTextArea // "Extruder Start G-code"
{
anchors.bottom: parent.bottom
anchors.left: parent.left
height: (parent.height / 2) - UM.Theme.getSize("default_margin").height
width: base.columnWidth - UM.Theme.getSize("default_margin").width

labelText: catalog.i18nc("@title:label", "Extruder Start G-code")
containerStackId: base.extruderStackId
settingKey: "machine_extruder_start_code"
settingStoreIndex: propertyStoreIndex
}
}

Cura.GcodeTextArea // "Extruder End G-code"
Expand Down
Loading

0 comments on commit 429818c

Please sign in to comment.