mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Add thread yields to several long running and heavy processing jobs
Contributes to CURA-358
This commit is contained in:
parent
653b46d825
commit
0b2f0b2604
3 changed files with 11 additions and 1 deletions
|
@ -10,6 +10,7 @@ from UM.Scene.SceneNode import SceneNode
|
|||
from UM.Scene.GroupDecorator import GroupDecorator
|
||||
from UM.Math.Quaternion import Quaternion
|
||||
|
||||
from UM.Job import Job
|
||||
|
||||
import os
|
||||
import struct
|
||||
|
@ -53,6 +54,7 @@ class ThreeMFReader(MeshReader):
|
|||
#for vertex in object.mesh.vertices.vertex:
|
||||
for vertex in object.findall(".//3mf:vertex", self._namespaces):
|
||||
vertex_list.append([vertex.get("x"), vertex.get("y"), vertex.get("z")])
|
||||
Job.yieldThread()
|
||||
|
||||
triangles = object.findall(".//3mf:triangle", self._namespaces)
|
||||
|
||||
|
@ -64,6 +66,8 @@ class ThreeMFReader(MeshReader):
|
|||
v2 = int(triangle.get("v2"))
|
||||
v3 = int(triangle.get("v3"))
|
||||
mesh.addFace(vertex_list[v1][0],vertex_list[v1][1],vertex_list[v1][2],vertex_list[v2][0],vertex_list[v2][1],vertex_list[v2][2],vertex_list[v3][0],vertex_list[v3][1],vertex_list[v3][2])
|
||||
Job.yieldThread()
|
||||
|
||||
#TODO: We currently do not check for normals and simply recalculate them.
|
||||
mesh.calculateNormals()
|
||||
node.setMeshData(mesh)
|
||||
|
@ -116,6 +120,8 @@ class ThreeMFReader(MeshReader):
|
|||
node.rotate(rotation)
|
||||
result.addChild(node)
|
||||
|
||||
Job.yieldThread()
|
||||
|
||||
#If there is more then one object, group them.
|
||||
try:
|
||||
if len(objects) > 1:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue