mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-30 00:55:12 +08:00
Merge branch 'fix/3MFWriter' of https://github.com/nilsiism/Cura
This commit is contained in:
commit
4a5aecc1e4
@ -114,22 +114,24 @@ class ThreeMFWriter(MeshWriter):
|
||||
|
||||
mesh_data = um_node.getMeshData()
|
||||
|
||||
node_matrix = um_node.getLocalTransformation()
|
||||
node_matrix.preMultiply(transformation)
|
||||
|
||||
if center_mesh:
|
||||
node_matrix = Matrix()
|
||||
center_matrix = Matrix()
|
||||
# compensate for original center position, if object(s) is/are not around its zero position
|
||||
if mesh_data is not None:
|
||||
extents = mesh_data.getExtents()
|
||||
if extents is not None:
|
||||
# We use a different coordinate space while writing, so flip Z and Y
|
||||
center_vector = Vector(extents.center.x, extents.center.y, extents.center.z)
|
||||
node_matrix.setByTranslation(center_vector)
|
||||
node_matrix.multiply(um_node.getLocalTransformation())
|
||||
else:
|
||||
node_matrix = um_node.getLocalTransformation()
|
||||
center_vector = Vector(-extents.center.x, -extents.center.y, -extents.center.z)
|
||||
center_matrix.setByTranslation(center_vector)
|
||||
node_matrix.preMultiply(center_matrix)
|
||||
|
||||
matrix_string = ThreeMFWriter._convertMatrixToString(node_matrix.preMultiply(transformation))
|
||||
matrix_string = ThreeMFWriter._convertMatrixToString(node_matrix)
|
||||
|
||||
savitar_node.setTransformation(matrix_string)
|
||||
|
||||
if mesh_data is not None:
|
||||
savitar_node.getMeshData().setVerticesFromBytes(mesh_data.getVerticesAsByteArray())
|
||||
indices_array = mesh_data.getIndicesAsByteArray()
|
||||
|
Loading…
x
Reference in New Issue
Block a user