mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-04 11:14:21 +08:00
3MF now handles loading of multiple nodes correctly
Contributes to CURA-1263
This commit is contained in:
parent
0a9db4ee0f
commit
fce75febef
@ -11,7 +11,6 @@ from UM.Scene.GroupDecorator import GroupDecorator
|
|||||||
import UM.Application
|
import UM.Application
|
||||||
from UM.Job import Job
|
from UM.Job import Job
|
||||||
|
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
@ -112,9 +111,7 @@ class ThreeMFReader(MeshReader):
|
|||||||
return temp_mat
|
return temp_mat
|
||||||
|
|
||||||
def read(self, file_name):
|
def read(self, file_name):
|
||||||
result = SceneNode()
|
result = []
|
||||||
group_decorator = GroupDecorator()
|
|
||||||
result.addDecorator(group_decorator)
|
|
||||||
# The base object of 3mf is a zipped archive.
|
# The base object of 3mf is a zipped archive.
|
||||||
archive = zipfile.ZipFile(file_name, "r")
|
archive = zipfile.ZipFile(file_name, "r")
|
||||||
self._base_name = os.path.basename(file_name)
|
self._base_name = os.path.basename(file_name)
|
||||||
@ -174,18 +171,11 @@ class ThreeMFReader(MeshReader):
|
|||||||
# Pre multiply the transformation with the loaded transformation, so the data is handled correctly.
|
# Pre multiply the transformation with the loaded transformation, so the data is handled correctly.
|
||||||
build_item_node.setTransformation(build_item_node.getLocalTransformation().preMultiply(transformation_matrix))
|
build_item_node.setTransformation(build_item_node.getLocalTransformation().preMultiply(transformation_matrix))
|
||||||
|
|
||||||
result.addChild(build_item_node)
|
result.append(build_item_node)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Logger.log("e", "exception occured in 3mf reader: %s", e)
|
Logger.log("e", "An exception occurred in 3mf reader: %s", e)
|
||||||
try: # Selftest - There might be more functions that should fail
|
|
||||||
bounding_box = result.getBoundingBox()
|
|
||||||
bounding_box.isValid()
|
|
||||||
except:
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
result.setEnabled(False) # The result should not be moved in any way, so disable it.
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
## Create a scale vector based on a unit string.
|
## Create a scale vector based on a unit string.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user