chiark / gitweb /
Add UM2go and UM2extended to config wizard. Still missing firmware and UM2go is missi...
[cura.git] / Cura / gui / sceneView.py
index bfa742779c0ca182499207c8d8eebe31b6dba0c9..c81ea4986415370b11a5a66aca021e508c9de116 100644 (file)
@@ -1236,36 +1236,55 @@ class SceneView(openglGui.glGuiPanel):
 
                size = [profile.getMachineSettingFloat('machine_width'), profile.getMachineSettingFloat('machine_depth'), profile.getMachineSettingFloat('machine_height')]
 
-               machine = profile.getMachineSetting('machine_type')
-               if machine.startswith('ultimaker'):
-                       if machine not in self._platformMesh:
-                               meshes = meshLoader.loadMeshes(resources.getPathForMesh(machine + '_platform.stl'))
+               machine_type = profile.getMachineSetting('machine_type')
+               if machine_type not in self._platformMesh:
+                       self._platformMesh[machine_type] = None
+
+                       filename = None
+                       texture_name = None
+                       offset = [0,0,0]
+                       texture_offset = [0,0,0]
+                       if machine_type == 'ultimaker2' or machine_type == 'ultimaker2extended':
+                               filename = resources.getPathForMesh('ultimaker2_platform.stl')
+                               offset = [0,-37,145]
+                               texture_name = 'Ultimaker2backplate.png'
+                               texture_offset = [0,150,-5]
+                       if machine_type == 'ultimaker_plus':
+                               filename = resources.getPathForMesh('ultimaker2_platform.stl')
+                               offset = [0,-37,145]
+                               texture_offset = [0,150,-5]
+                               texture_name = 'UltimakerPlusbackplate.png'
+                       if machine_type == 'ultimaker':
+                               filename = resources.getPathForMesh('ultimaker_platform.stl')
+                               offset = [0,0,2.5]
+                       if machine_type == 'Witbox':
+                               filename = resources.getPathForMesh('Witbox_platform.stl')
+                               offset = [0,-37,145]
+
+                       if filename is not None:
+                               meshes = meshLoader.loadMeshes(filename)
                                if len(meshes) > 0:
-                                       self._platformMesh[machine] = meshes[0]
-                               else:
-                                       self._platformMesh[machine] = None
-                               if machine == 'ultimaker2' or machine == 'ultimaker_plus':
-                                       self._platformMesh[machine]._drawOffset = numpy.array([0,-37,145], numpy.float32)
-                               else:
-                                       self._platformMesh[machine]._drawOffset = numpy.array([0,0,2.5], numpy.float32)
+                                       self._platformMesh[machine_type] = meshes[0]
+                                       self._platformMesh[machine_type]._drawOffset = numpy.array(offset, numpy.float32)
+                                       self._platformMesh[machine_type].texture = None
+                                       if texture_name is not None:
+                                               self._platformMesh[machine_type].texture = openglHelpers.loadGLTexture(texture_name)
+                                               self._platformMesh[machine_type].texture_offset = texture_offset
+               if self._platformMesh[machine_type] is not None:
+                       mesh = self._platformMesh[machine_type]
                        glColor4f(1,1,1,0.5)
                        self._objectShader.bind()
-                       self._renderObject(self._platformMesh[machine], False, False)
+                       self._renderObject(mesh, False, False)
                        self._objectShader.unbind()
 
                        #For the Ultimaker 2 render the texture on the back plate to show the Ultimaker2 text.
-                       if machine == 'ultimaker2' or machine == 'ultimaker_plus':
-                               if not hasattr(self._platformMesh[machine], 'texture'):
-                                       if machine == 'ultimaker2':
-                                               self._platformMesh[machine].texture = openglHelpers.loadGLTexture('Ultimaker2backplate.png')
-                                       else:
-                                               self._platformMesh[machine].texture = openglHelpers.loadGLTexture('UltimakerPlusbackplate.png')
-                               glBindTexture(GL_TEXTURE_2D, self._platformMesh[machine].texture)
+                       if mesh.texture is not None:
+                               glBindTexture(GL_TEXTURE_2D, mesh.texture)
                                glEnable(GL_TEXTURE_2D)
                                glPushMatrix()
                                glColor4f(1,1,1,1)
 
-                               glTranslate(0,150,-5)
+                               glTranslate(mesh.texture_offset[0], mesh.texture_offset[1], mesh.texture_offset[2])
                                h = 50
                                d = 8
                                w = 100
@@ -1293,20 +1312,6 @@ class SceneView(openglGui.glGuiPanel):
                                glDisable(GL_TEXTURE_2D)
                                glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
                                glPopMatrix()
-                               
-               elif machine.startswith('Witbox'):
-                       if machine not in self._platformMesh:
-                               meshes = meshLoader.loadMeshes(resources.getPathForMesh(machine + '_platform.stl'))
-                               if len(meshes) > 0:
-                                       self._platformMesh[machine] = meshes[0]
-                               else:
-                                       self._platformMesh[machine] = None
-                               if machine == 'Witbox':
-                                       self._platformMesh[machine]._drawOffset = numpy.array([0,-37,145], numpy.float32)
-                       glColor4f(1,1,1,0.5)
-                       self._objectShader.bind()
-                       self._renderObject(self._platformMesh[machine], False, False)
-                       self._objectShader.unbind()
                else:
                        glColor4f(0,0,0,1)
                        glLineWidth(3)