Only scale convex hull if there is a non-1 scaling factor

This will save some processing power for the very common case where there is no scaling factor.

Contributes to issue CURA-7118.
This commit is contained in:
Ghostkeeper 2020-09-02 02:10:19 +02:00
parent a6707217c7
commit bc0ac0f2a0
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -381,8 +381,11 @@ class ConvexHullDecorator(SceneNodeDecorator):
"""
scale_factor = self._global_stack.getProperty("material_shrinkage_percentage", "value") / 100.0
center = self.getNode().getBoundingBox().center
result = convex_hull.scale(scale_factor, [center.x, center.z]) # Yes, use Z instead of Y. Mixed conventions there with how the OpenGL coordinates are transmitted.
if scale_factor != 1.0:
center = self.getNode().getBoundingBox().center
result = convex_hull.scale(scale_factor, [center.x, center.z]) # Yes, use Z instead of Y. Mixed conventions there with how the OpenGL coordinates are transmitted.
else:
result = convex_hull
horizontal_expansion = max(
self._getSettingProperty("xy_offset", "value"),