diff --git a/cura/CuraPackageManager.py b/cura/CuraPackageManager.py index 0cb18ccc92..720406fbc6 100644 --- a/cura/CuraPackageManager.py +++ b/cura/CuraPackageManager.py @@ -4,6 +4,7 @@ import os from typing import Any, cast, Dict, List, Set, Tuple, TYPE_CHECKING, Optional +from UM.Logger import Logger from cura.CuraApplication import CuraApplication # To find some resource types. from cura.Settings.GlobalStack import GlobalStack @@ -70,9 +71,9 @@ class CuraPackageManager(PackageManager): parsed_guid = XmlMaterialProfile.getMetadataFromSerialized(f.read(), "GUID") if guid == parsed_guid: return package_id - continue - + Logger.error("Could not find package_id for file: {} with GUID: {} ".format(file_name, guid)) + return "" def getMachinesUsingPackage(self, package_id: str) -> Tuple[List[Tuple[GlobalStack, str, str]], List[Tuple[GlobalStack, str, str]]]: """Returns a list of where the package is used diff --git a/plugins/3MFWriter/ThreeMFWriter.py b/plugins/3MFWriter/ThreeMFWriter.py index 4bb8ab5881..eb96490fdb 100644 --- a/plugins/3MFWriter/ThreeMFWriter.py +++ b/plugins/3MFWriter/ThreeMFWriter.py @@ -9,6 +9,7 @@ from UM.Math.Vector import Vector from UM.Logger import Logger from UM.Math.Matrix import Matrix from UM.Application import Application +from UM.Message import Message from UM.Scene.SceneNode import SceneNode from cura.CuraApplication import CuraApplication @@ -269,7 +270,14 @@ class ThreeMFWriter(MeshWriter): package_id = package_manager.getMaterialFilePackageId(extruder.material.getFileName(), extruder.material.getMetaDataEntry("GUID")) package_data = package_manager.getInstalledPackageInfo(package_id) - if not package_data or package_data.get("is_bundled"): + if not package_data: + message = Message(catalog.i18nc("@error:uninstall", + "It was not possible to store material package information in project file: {material}. This project may not open correctly on other systems.".format(material=extruder.getName())), + title=catalog.i18nc("@info:title", "Failed to save material package information"), + message_type=Message.MessageType.WARNING) + message.show() + + if package_data.get("is_bundled"): continue material_metadata = {"id": package_id,