mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 20:35:53 +08:00
Merge branch 'master' of https://github.com/Ultimaker/Cura
This commit is contained in:
commit
27a4cbbb2e
@ -90,8 +90,8 @@ class QualityManager:
|
||||
|
||||
# Fall back to using generic materials and qualities if nothing could be found.
|
||||
if not result and material_containers and len(material_containers) == 1:
|
||||
basic_material = self._getBasicMaterial(material_containers[0])
|
||||
result = self._getFilteredContainersForStack(machine_definition, [basic_material], **criteria)
|
||||
basic_materials = self._getBasicMaterials(material_containers[0])
|
||||
result = self._getFilteredContainersForStack(machine_definition, basic_materials, **criteria)
|
||||
return result[0] if result else None
|
||||
|
||||
## Find all suitable qualities for a combination of machine and material.
|
||||
@ -103,8 +103,8 @@ class QualityManager:
|
||||
criteria = {"type": "quality" }
|
||||
result = self._getFilteredContainersForStack(machine_definition, [material_container], **criteria)
|
||||
if not result:
|
||||
basic_material = self._getBasicMaterial(material_container)
|
||||
result = self._getFilteredContainersForStack(machine_definition, [basic_material], **criteria)
|
||||
basic_materials = self._getBasicMaterials(material_container)
|
||||
result = self._getFilteredContainersForStack(machine_definition, basic_materials, **criteria)
|
||||
return result
|
||||
|
||||
## Find all quality changes for a machine.
|
||||
@ -154,16 +154,24 @@ class QualityManager:
|
||||
#
|
||||
# This tries to find a generic or basic version of the given material.
|
||||
# \param material_container \type{InstanceContainer} the material
|
||||
# \return \type{Option[InstanceContainer]} the basic material or None if one could not be found.
|
||||
def _getBasicMaterial(self, material_container):
|
||||
# \return \type{List[InstanceContainer]} the basic material or None if one could not be found.
|
||||
def _getBasicMaterials(self, material_container):
|
||||
base_material = material_container.getMetaDataEntry("material")
|
||||
if material_container.getDefinition().getMetaDataEntry("has_machine_quality"):
|
||||
definition_id = material_container.getDefinition().getMetaDataEntry("quality_definition", material_container.getDefinition().getId())
|
||||
else:
|
||||
definition_id = "fdmprinter"
|
||||
|
||||
if base_material:
|
||||
# There is a basic material specified
|
||||
criteria = { "type": "material", "name": base_material, "definition": "fdmprinter" }
|
||||
criteria = { "type": "material", "name": base_material, "definition": definition_id }
|
||||
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**criteria)
|
||||
return containers[0] if containers else None
|
||||
containers = [basic_material for basic_material in containers if
|
||||
basic_material.getMetaDataEntry("variant") == material_container.getMetaDataEntry(
|
||||
"variant")]
|
||||
return containers
|
||||
|
||||
return None
|
||||
return []
|
||||
|
||||
def _getFilteredContainers(self, **kwargs):
|
||||
return self._getFilteredContainersForStack(None, None, **kwargs)
|
||||
|
@ -77,6 +77,7 @@ class ThreeMFReader(MeshReader):
|
||||
mesh_data = mesh_builder.build().getTransformed(rotation)
|
||||
|
||||
if not len(mesh_data.getVertices()):
|
||||
Logger.log("d", "One of the objects does not have vertices. Skipping it.")
|
||||
continue # This object doesn't have data, so skip it.
|
||||
|
||||
node.setMeshData(mesh_data)
|
||||
@ -114,6 +115,7 @@ class ThreeMFReader(MeshReader):
|
||||
try:
|
||||
node.getBoundingBox() # Selftest - There might be more functions that should fail
|
||||
except:
|
||||
Logger.log("w", "Bounding box test for object failed. Skipping this object")
|
||||
continue
|
||||
|
||||
result.addChild(node)
|
||||
@ -125,7 +127,10 @@ class ThreeMFReader(MeshReader):
|
||||
group_decorator = GroupDecorator()
|
||||
result.addDecorator(group_decorator)
|
||||
elif len(objects) == 1:
|
||||
result = result.getChildren()[0] # Only one object found, return that.
|
||||
if result.getChildren():
|
||||
result = result.getChildren()[0] # Only one object found, return that.
|
||||
else: # we failed to load any data
|
||||
return None
|
||||
except Exception as e:
|
||||
Logger.log("e", "exception occured in 3mf reader: %s", e)
|
||||
try: # Selftest - There might be more functions that should fail
|
||||
|
Loading…
x
Reference in New Issue
Block a user