Browse Source

Get the overhang angle from the proper multiextrusion stack

CURA-2289
fieldOfView 8 years ago
parent
commit
7a6124f221
1 changed files with 10 additions and 2 deletions
  1. 10 2
      plugins/SolidView/SolidView.py

+ 10 - 2
plugins/SolidView/SolidView.py

@@ -13,6 +13,7 @@ from UM.Settings.Validator import ValidatorState
 from UM.View.GL.OpenGL import OpenGL
 from UM.View.GL.OpenGL import OpenGL
 
 
 import cura.Settings
 import cura.Settings
+from cura.Settings.ExtruderManager import ExtruderManager
 
 
 import math
 import math
 
 
@@ -45,8 +46,16 @@ class SolidView(View):
 
 
         global_container_stack = Application.getInstance().getGlobalContainerStack()
         global_container_stack = Application.getInstance().getGlobalContainerStack()
         if global_container_stack:
         if global_container_stack:
+            multi_extrusion = global_container_stack.getProperty("machine_extruder_count", "value") > 1
+
+            if multi_extrusion:
+                support_extruder_nr = global_container_stack.getProperty("support_extruder_nr", "value")
+                support_angle_stack = ExtruderManager.getInstance().getExtruderStack(support_extruder_nr)
+            else:
+                support_angle_stack = global_container_stack
+
             if Preferences.getInstance().getValue("view/show_overhang"):
             if Preferences.getInstance().getValue("view/show_overhang"):
-                angle = global_container_stack.getProperty("support_angle", "value")
+                angle = support_angle_stack.getProperty("support_angle", "value")
                 # Make sure the overhang angle is valid before passing it to the shader
                 # 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)
                 # 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 global_container_stack.getProperty("support_angle", "validationState") in [None, ValidatorState.Valid]:
@@ -56,7 +65,6 @@ class SolidView(View):
             else:
             else:
                 self._enabled_shader.setUniformValue("u_overhangAngle", math.cos(math.radians(0)))
                 self._enabled_shader.setUniformValue("u_overhangAngle", math.cos(math.radians(0)))
 
 
-            multi_extrusion = global_container_stack.getProperty("machine_extruder_count", "value") > 1
 
 
         for node in DepthFirstIterator(scene.getRoot()):
         for node in DepthFirstIterator(scene.getRoot()):
             if not node.render(renderer):
             if not node.render(renderer):