Merge pull request #18453 from Ultimaker/CURA_11403-saving-pap-and-3mf

saving extruder settings on model
This commit is contained in:
Remco Burema 2024-02-29 09:45:10 +01:00 committed by GitHub
commit c817f11c02
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -175,9 +175,9 @@ class ThreeMFWriter(MeshWriter):
def getArchive(self): def getArchive(self):
return self._archive return self._archive
def _addShareLogoToThumbnail(self, primary_image): def _addLogoToThumbnail(self, primary_image, logo_name):
# Load the icon png image # Load the icon png image
icon_image = QImage(Resources.getPath(Resources.Images, "cura-share.png")) icon_image = QImage(Resources.getPath(Resources.Images, logo_name))
# Resize icon_image to be 1/4 of primary_image size # Resize icon_image to be 1/4 of primary_image size
new_width = int(primary_image.width() / 4) new_width = int(primary_image.width() / 4)
@ -217,7 +217,9 @@ class ThreeMFWriter(MeshWriter):
snapshot = self._createSnapshot() snapshot = self._createSnapshot()
if snapshot: if snapshot:
if export_settings_model != None: if export_settings_model != None:
self._addShareLogoToThumbnail(snapshot) self._addLogoToThumbnail(snapshot, "cura-share.png")
elif export_settings_model == None and self._store_archive:
self._addLogoToThumbnail(snapshot, "cura-icon.png")
thumbnail_buffer = QBuffer() thumbnail_buffer = QBuffer()
thumbnail_buffer.open(QBuffer.OpenModeFlag.ReadWrite) thumbnail_buffer.open(QBuffer.OpenModeFlag.ReadWrite)
snapshot.save(thumbnail_buffer, "PNG") snapshot.save(thumbnail_buffer, "PNG")
@ -272,7 +274,8 @@ class ThreeMFWriter(MeshWriter):
transformation_matrix.preMultiply(translation_matrix) transformation_matrix.preMultiply(translation_matrix)
root_node = UM.Application.Application.getInstance().getController().getScene().getRoot() root_node = UM.Application.Application.getInstance().getController().getScene().getRoot()
exported_model_settings = ThreeMFWriter._extractModelExportedSettings(export_settings_model) exported_model_settings = ThreeMFWriter._extractModelExportedSettings(export_settings_model) if export_settings_model != None else None
for node in nodes: for node in nodes:
if node == root_node: if node == root_node:
for root_child in node.getChildren(): for root_child in node.getChildren():