mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Cache values to speed up the rendering
CURA-7106
This commit is contained in:
parent
1b973b3f3c
commit
16bc2071ee
2 changed files with 33 additions and 4 deletions
|
@ -46,6 +46,9 @@ class SettingOverrideDecorator(SceneNodeDecorator):
|
|||
|
||||
self._is_non_printing_mesh = False
|
||||
self._is_non_thumbnail_visible_mesh = False
|
||||
self._is_support_mesh = False
|
||||
self._is_cutting_mesh = False
|
||||
self._is_infill_mesh = False
|
||||
|
||||
self._stack.propertyChanged.connect(self._onSettingChanged)
|
||||
|
||||
|
@ -104,7 +107,7 @@ class SettingOverrideDecorator(SceneNodeDecorator):
|
|||
"""
|
||||
|
||||
# for support_meshes, always use the support_extruder
|
||||
if self.getStack().userChanges.getProperty("support_mesh", "value"):
|
||||
if self._is_support_mesh:
|
||||
global_container_stack = Application.getInstance().getGlobalContainerStack()
|
||||
if global_container_stack:
|
||||
return str(global_container_stack.getProperty("support_extruder_nr", "value"))
|
||||
|
@ -114,6 +117,24 @@ class SettingOverrideDecorator(SceneNodeDecorator):
|
|||
container_stack = containers[0]
|
||||
return container_stack.getMetaDataEntry("position", default=None)
|
||||
|
||||
def isCuttingMesh(self):
|
||||
return self._is_cutting_mesh
|
||||
|
||||
def isSupportMesh(self):
|
||||
return self._is_support_mesh
|
||||
|
||||
def isInfillMesh(self):
|
||||
return self._is_infill_mesh
|
||||
|
||||
def _evaluateIsCuttingMesh(self):
|
||||
return bool(self._stack.userChanges.getProperty("cutting_mesh", "value"))
|
||||
|
||||
def _evaluateIsSupportMesh(self):
|
||||
return bool(self._stack.userChanges.getProperty("support_mesh", "value"))
|
||||
|
||||
def _evaluateInfillMesh(self):
|
||||
return bool(self._stack.userChanges.getProperty("infill_mesh", "value"))
|
||||
|
||||
def isNonPrintingMesh(self):
|
||||
return self._is_non_printing_mesh
|
||||
|
||||
|
@ -132,6 +153,14 @@ class SettingOverrideDecorator(SceneNodeDecorator):
|
|||
# Trigger slice/need slicing if the value has changed.
|
||||
self._is_non_printing_mesh = self._evaluateIsNonPrintingMesh()
|
||||
self._is_non_thumbnail_visible_mesh = self._evaluateIsNonThumbnailVisibleMesh()
|
||||
|
||||
if setting_key == "support_mesh":
|
||||
self._is_support_mesh = self._evaluateIsSupportMesh()
|
||||
elif setting_key == "cutting_mesh":
|
||||
self._is_cutting_mesh = self._evaluateIsCuttingMesh()
|
||||
elif setting_key == "infill_mesh":
|
||||
self._is_infill_mesh = self._evaluateInfillMesh()
|
||||
|
||||
Application.getInstance().getBackend().needsSlicing()
|
||||
Application.getInstance().getBackend().tickle()
|
||||
|
||||
|
|
|
@ -224,13 +224,13 @@ class SolidView(View):
|
|||
pass
|
||||
|
||||
if node.callDecoration("isNonPrintingMesh"):
|
||||
if per_mesh_stack and (per_mesh_stack.getProperty("infill_mesh", "value") or per_mesh_stack.getProperty("cutting_mesh", "value")):
|
||||
if per_mesh_stack and (node.callDecoration("isInfillMesh") or node.callDecoration("isCuttingMesh")):
|
||||
renderer.queueNode(node, shader = self._non_printing_shader, uniforms = uniforms, transparent = True)
|
||||
else:
|
||||
renderer.queueNode(node, shader = self._non_printing_shader, transparent = True)
|
||||
elif getattr(node, "_outside_buildarea", False):
|
||||
renderer.queueNode(node, shader = self._disabled_shader)
|
||||
elif per_mesh_stack and per_mesh_stack.getProperty("support_mesh", "value"):
|
||||
elif per_mesh_stack and node.callDecoration("isSupportMesh"):
|
||||
# Render support meshes with a vertical stripe that is darker
|
||||
shade_factor = 0.6
|
||||
uniforms["diffuse_color_2"] = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue