Simplify the expensive call to the validation state

Since the support angle needs to be between 0 and 90, we don't have to rely on the (expensive)
validator. We can just check that ourselves.
This commit is contained in:
Jaime van Kessel 2019-02-19 15:42:51 +01:00
parent 80c83617bc
commit d53bac6eb8

View file

@ -69,8 +69,7 @@ class SolidView(View):
if support_angle_stack is not None and Application.getInstance().getPreferences().getValue("view/show_overhang"):
angle = support_angle_stack.getProperty("support_angle", "value")
# Make sure the overhang angle is valid before passing it to the shader
# Note: if the overhang angle is set to its default value, it does not need to get validated (validationState = None)
if angle is not None and global_container_stack.getProperty("support_angle", "validationState") in [None, ValidatorState.Valid]:
if angle is not None and angle >= 0 and angle <= 90:
self._enabled_shader.setUniformValue("u_overhangAngle", math.cos(math.radians(90 - angle)))
else:
self._enabled_shader.setUniformValue("u_overhangAngle", math.cos(math.radians(0))) #Overhang angle of 0 causes no area at all to be marked as overhang.