Do not show any object shadows in all_at_once mode.

Also DRYed up the one_at_a_time check

CURA-6522
This commit is contained in:
Nino van Hooff 2019-12-04 15:33:31 +01:00
parent b30b641034
commit fc060f7724

View file

@ -97,21 +97,23 @@ class ConvexHullDecorator(SceneNodeDecorator):
return None return None
# Parent can be None if node is just loaded. # Parent can be None if node is just loaded.
if self._global_stack \ if self._is_singular_one_at_a_time_node():
and self._global_stack.getProperty("print_sequence", "value") == "one_at_a_time" \
and not self.hasGroupAsParent(self._node):
hull = self.getConvexHullHeadFull() hull = self.getConvexHullHeadFull()
hull = self._add2DAdhesionMargin(hull) hull = self._add2DAdhesionMargin(hull)
return hull return hull
return self._compute2DConvexHull() return self._compute2DConvexHull()
## Get the convex hull of the node with the full head size ## For one at the time this is the convex hull of the node with the full head size
# In case of printing all at once this is None.
def getConvexHullHeadFull(self) -> Optional[Polygon]: def getConvexHullHeadFull(self) -> Optional[Polygon]:
if self._node is None: if self._node is None:
return None return None
return self._compute2DConvexHeadFull() if self._is_singular_one_at_a_time_node():
return self._compute2DConvexHeadFull()
return None
@staticmethod @staticmethod
def hasGroupAsParent(node: "SceneNode") -> bool: def hasGroupAsParent(node: "SceneNode") -> bool:
@ -121,20 +123,19 @@ class ConvexHullDecorator(SceneNodeDecorator):
return bool(parent.callDecoration("isGroup")) return bool(parent.callDecoration("isGroup"))
## Get convex hull of the object + head size ## Get convex hull of the object + head size
# In case of printing all at once this is the same as the convex hull. # In case of printing all at once this is None.
# For one at the time this is area with intersection of mirrored head # For one at the time this is area with intersection of mirrored head
def getConvexHullHead(self) -> Optional[Polygon]: def getConvexHullHead(self) -> Optional[Polygon]:
if self._node is None: if self._node is None:
return None return None
if self._node.callDecoration("isNonPrintingMesh"): if self._node.callDecoration("isNonPrintingMesh"):
return None return None
if self._global_stack: if self._is_singular_one_at_a_time_node():
if self._global_stack.getProperty("print_sequence", "value") == "one_at_a_time" and not self.hasGroupAsParent(self._node): head_with_fans = self._compute2DConvexHeadMin()
head_with_fans = self._compute2DConvexHeadMin() if head_with_fans is None:
if head_with_fans is None: return None
return None head_with_fans_with_adhesion_margin = self._add2DAdhesionMargin(head_with_fans)
head_with_fans_with_adhesion_margin = self._add2DAdhesionMargin(head_with_fans) return head_with_fans_with_adhesion_margin
return head_with_fans_with_adhesion_margin
return None return None
## Get convex hull of the node ## Get convex hull of the node
@ -147,10 +148,9 @@ class ConvexHullDecorator(SceneNodeDecorator):
if self._node.callDecoration("isNonPrintingMesh"): if self._node.callDecoration("isNonPrintingMesh"):
return None return None
if self._global_stack: if self._is_singular_one_at_a_time_node():
if self._global_stack.getProperty("print_sequence", "value") == "one_at_a_time" and not self.hasGroupAsParent(self._node): # Printing one at a time and it's not an object in a group
# Printing one at a time and it's not an object in a group return self._compute2DConvexHull()
return self._compute2DConvexHull()
return None return None
## The same as recomputeConvexHull, but using a timer if it was set. ## The same as recomputeConvexHull, but using a timer if it was set.
@ -175,9 +175,7 @@ class ConvexHullDecorator(SceneNodeDecorator):
self._convex_hull_node = None self._convex_hull_node = None
return return
if self._global_stack \ if self._is_singular_one_at_a_time_node():
and self._global_stack.getProperty("print_sequence", "value") == "one_at_a_time" \
and not self.hasGroupAsParent(self._node):
# In one-at-a-time mode, every printed object gets it's own adhesion # In one-at-a-time mode, every printed object gets it's own adhesion
printing_area = self.getAdhesionArea() printing_area = self.getAdhesionArea()
else: else:
@ -426,6 +424,14 @@ class ConvexHullDecorator(SceneNodeDecorator):
return True return True
return self.__isDescendant(root, node.getParent()) return self.__isDescendant(root, node.getParent())
## True if print_sequence is one_at_a_time and _node is not part of a group
def _is_singular_one_at_a_time_node(self) -> bool:
if self._node is None:
return False
return self._global_stack \
and self._global_stack.getProperty("print_sequence", "value") == "one_at_a_time" \
and not self.hasGroupAsParent(self._node)
_affected_settings = [ _affected_settings = [
"adhesion_type", "raft_margin", "print_sequence", "adhesion_type", "raft_margin", "print_sequence",
"skirt_gap", "skirt_line_count", "skirt_brim_line_width", "skirt_distance", "brim_line_count"] "skirt_gap", "skirt_line_count", "skirt_brim_line_width", "skirt_distance", "brim_line_count"]